$(document).ready(function(){
	
	//music playlist clicker
	$("div.musicPlaylist ul li a").click(function(){
		//create a handle, we'll use this often
		var clicked = $(this);
		
		//change the now playing title
		$('div.nowplaying p span.audioNP').html(clicked.html());
		
		//first empty the nowplayingContent holding div
		$("div.musicPlayer").empty();
		
		//now embed the new player
		$("div.musicPlayer").append('<object style="width: 200px; height: 30px;" width="200" height="30" codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0"><param name="autoplay" value="true" /><param name="src" value="' + clicked.attr('href') +'" /><embed style="width: 200px; height: 30px;" type="video/quicktime" width="200" height="30" src="' + clicked.attr('media') +'" autoplay="true"></embed></object>');
		
		return false;
	});
	
	$("div.videoPlaylist ul li a").click(function(){
		
		//create a handle, we'll use this often
		var clicked = $(this);
		
		//change the now playing title
		$('div.videoNP span.videoNP').html(clicked.html());
		
		//first empty the nowplayingContent holding div
		$("div.videoPlayer").empty();
		
		//now embed the youtube player
		$("div.videoPlayer").append('<object width="400" height="300"><param name="movie" value="http://www.youtube.com/v/' + clicked.attr('media') + '&hl=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/' + clicked.attr('media') + '&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="400" height="300"></embed></object>');
		
		return false;
	});
	
	//start the music and video players
	$("div.musicPlaylist ul li a:first").click();
	$("div.videoPlaylist ul li a:first").click();
});