$(function() {
	
	//make the header a link
	$("div#header").click(function() {
		window.location.href='/';
	});
	
	//setup the links to the player
	player.setup();
	
});

player = {
	
	setup: function() {
		$("a.playerLink").click(function() {
			//first remove any old player that may be present
			$("div#player").remove();
			// load up our artist ID
			var artistID = $(this).attr('id');
			//create new player div
			$("body").append("<div id='player'></div>");
			$("div#player").load("/music/musicPlayer.php?artist="+artistID, function() {
				player.close();
				$("div#player").fadeIn();
			});
			

		});
		
	},
	
	close: function() {
		$('a.close').click(function() {
			$("div#player").fadeOut('fast', function() {
				$("div#player").remove();
			});
		});
	}
}