$(document).ready(function() {

    // Replace the paragraphs with the flash
    var ps = $('p.audio');
    for (i=0; i < ps.length; i++) {
        var id = ps[i].id;
        var file = id;
        var so = new SWFObject("cmsflash/stream.swf", id, "16", "16", "6");
        so.addVariable("the_file", file);
        so.write(id);
    }


    //replace checkboxes
    var boxs = $('[bob_bands]');

    //Grab the upload form...
    $('a.upload').click(function() {
        var page = $('#c3').load('bob_upload_form.html');
    });

    //Submit A Vote
    $('#votes').submit(function() {
        var val = 'band=' + $("input[name='bob_bands']:checked").val();
		$.post('/bob_vote.php', val, function(data) {
			
			$('.songs').delay(200).fadeTo(250, 0).delay(100).html(data).delay(100).fadeTo(250, 1);
		});
        return false;
    });



	$('.upload').click(function() {
		$.get('/bob_upload_form.html', function(data){
			$('.songs').fadeTo(250, 0, function() {
				$(this).delay(250).html(data).delay(250).fadeTo(250, 1);
			});
		})
		
		
		return false;		
		
	});
});
