function createPlayer($file, $play) {
    var flashvars = {
            file:$file, 
            autostart:$play,
            backcolor: "D2BA86", 
	        frontcolor: "333333",
	        lightcolor: "666666"
    }
    var params = {
            allowfullscreen:"false", 
            allowscriptaccess:"always",
            wmode:"opaque"
    }
    var attributes = {
            id:"player1",  
            name:"player1"
    }
    swfobject.embedSWF("/music/player.swf", "musicplayer", "220", "20", "9.0.115", true, flashvars, params, attributes);
}

function createinvPlayer($file, $play, $loop) {
    var flashvars = {
            file:$file, 
            autostart:$play,
            repeat:$loop,
            backcolor: "000000", 
	        frontcolor: "000000",
	        lightcolor: "000000"
    }
    var params = {
            allowfullscreen:"false", 
            allowscriptaccess:"always",
            wmode:"opaque"
    }
    var attributes = {
            id:"player1",  
            name:"player1"
    }
    swfobject.embedSWF("/music/player.swf", "invplayer", "1", "1", "9.0.115", true, flashvars, params, attributes);
}
        
$(document).ready(function(){
	
	createPlayer($("#playlist a:first").attr("href"), "false");
	if($("#invplayer").is("div")){
		createinvPlayer("/Splash.mp3", "true", "single");
		//alert("should play");
	}
	
	$("#playlist a:first").addClass("nowplaying played");
	$("p#listening strong").text($("#playlist a:first").text());
	
	$("a.current").click(function(){
		return false;
	});
	
	$("#playlist a").click(function(){
		if( ! $(this).hasClass("nowplaying")){
			$("#playlist .nowplaying").removeClass("nowplaying");
			$(this).addClass("nowplaying played");
			$("#playerholder").empty().append("<div id='musicplayer'></div>");
			$("p#listening strong").text($(this).text());
			createPlayer(this.href, "true");
		}
		return false;
	});
	
	$("#thumbbox a img").hover(function(){
		$(this).css("padding", "1px");
	},
	function(){
		$(this).css("padding", "0 2px 2px 0");
	});
	
	$("a#jukebox").click(function(){
		window.open("http://www.markortonmusic.com/jukebox.html", "mplayer","location=0,status=0,scrollbars=0,width=400,height=240");
		return false;
	});
		
});
 