$(document).ready(function(){

	var playItem = 0;

	var myPlayList = [
	
		{name:"<b>The Invisible Kid - <i>Sometimes (Mitch Wells Remix)<\/i><\/b><br>Bikiniwax Records,2009.",mp3:"http://www.mitchwells.com/music/mp3/tik-sometimes-mw.mp3",link:"http://mitchwells.com/music-wp/?p=21"},
	
		{name:"<b>KBOT - <i>Pushing Through<\/i><\/b><br>Lira Son and Mitch Wells. Fugue Records, 2008.",mp3:"http://www.mitchwells.com/music/mp3/kbot-pushing_through.mp3",link:"http://mitchwells.com/music-wp/?p=190"},
		
		{name:"<b>KBOT - <i>Crystallize<\/i><\/b><br>Lira Son and Mitch Wells. Fugue Records, 2008.",mp3:"http://www.mitchwells.com/music/mp3/kbot-crystallize.mp3",link:"http://mitchwells.com/music-wp/?p=192"},
		
		{name:"<b>KBOT - <i>Chain Gang<\/i><\/b><br>Lira Son and Mitch Wells. Fugue Records, 2008.",mp3:"http://www.mitchwells.com/music/mp3/kbot-chain_gang.mp3",link:"http://mitchwells.com/music-wp/?p=194"},
		
		{name:"<b>KBOT - <i>Refine<\/i><\/b><br>Lira Son and Mitch Wells. Fugue Records, 2008.",mp3:"http://www.mitchwells.com/music/mp3/kbot-refine.mp3",link:"http://mitchwells.com/music-wp/?p=352"},
		
		{name:"<b>KBOT - <i>Unlove (Saru Remix)<\/i><\/b><br>Lira Son and Mitch Wells. Fugue Records, 2008.",mp3:"http://www.mitchwells.com/music/mp3/kbot-unlove-saru_remix.mp3",link:"http://mitchwells.com/music-wp/?p=196"},
		
		{name:"<b>KBOT - <i>Not Sorry (Butterface Remix)<\/i><\/b><br>Lira Son and Mitch Wells. Fugue Records, 2008.",mp3:"http://www.mitchwells.com/music/mp3/kbot-not_sorry-butterface.mp3",link:"http://mitchwells.com/music-wp/?p=198"},
		
		{name:"<b>KBOT - <i>Crystallize (DJ Mark King Remix)<\/i><\/b><br>Lira Son and Mitch Wells. Fugue Records, 2008.",mp3:"http://www.mitchwells.com/music/mp3/markking_crystalize.mp3",link:"http://mitchwells.com/music-wp/?p=200"},
		
		{name:"<b>Mitch Wells - <i>Tin Man<\/i><\/b><br>Fugue Records, 2007.",mp3:"http://www.mitchwells.com/music/mp3/mitch_wells-tin_man.mp3",link:"http://mitchwells.com/music-wp/?p=212"},
		
		{name:"<b>Warstein, Yin and Wells - <i>Radiator<\/i><\/b><br>Constar and Mitch Wells. Fugue Records, 2007.",mp3:"http://www.mitchwells.com/music/mp3/radiator-wartstein.mp3",link:"http://mitchwells.com/music-wp/?p=116"},
		
		{name:"<b>Mitch Wells - <i>Love's a Shaker<\/i><\/b><br>Fugue Records, 2007.",mp3:"http://www.mitchwells.com/music/mp3/loves_a_shaker-mitch_wells.mp3",link:"http://mitchwells.com/music-wp/?p=214"},
		
		{name:"<b>Saint M - <i>Cop In My Head<\/i><\/b><br>Mitch Wells. Fugue Records, 2006.",mp3:"http://www.mitchwells.com/music/mp3/saint_m-cop_in_my_head.mp3",link:"http://mitchwells.com/music-wp/?p=121"},
		
		{name:"<b>Saint M - <i>Wouldn't Be A Girl<\/i><\/b><br>Mitch Wells. Fugue Records, 2006.",mp3:"http://www.mitchwells.com/music/mp3/saint_m-wouldnt_be_a_girl.mp3",link:"http://mitchwells.com/music-wp/?p=121"},
		
		{name:"<b>Mitch Wells feat. Nica Ionz - <i>Where I<\/i><\/b><br>DK Records, 2004.",mp3:"http://www.mitchwells.com/music/mp3/mitch_wells-where_i.mp3",link:"http://mitchwells.com/music-wp/?p=216"},
		
		{name:"<b>Where I (Chris & Kai vs. Levin Remix)<\/i><\/b><br>DK Records, 2004.",mp3:"http://www.mitchwells.com/music/mp3/mitch_wells-where_i_chris_k.mp3",link:"http://mitchwells.com/music-wp/?p=216"},
		
		{name:"<b>NYTQ - <i>Good Time<\/i><\/b><br>Pankaj and Mitch Wells. Fugue Records, 2004.",mp3:"http://www.mitchwells.com/music/mp3/nytq-good_time.mp3",link:"http://mitchwells.com/music-wp/?p=236"},
		
		{name:"<b>Mitch Wells + Miss Bliss - <i>Justin's Been Drinking<\/i><\/b><br>Fugue Records, 2004.",mp3:"http://www.mitchwells.com/music/mp3/mitch_wells_bliss-justins.mp3",link:"http://mitchwells.com/music-wp/?p=150"},
		
		{name:"<b>Mitch Wells + Miss Bliss - <i>7x7<\/i><\/b><br>Fugue Records, 2004.",mp3:"http://www.mitchwells.com/music/mp3/mitch_wells_bliss-7x7.mp3",link:"http://mitchwells.com/music-wp/?p=150"},
		
		{name:"<b>Mitch Wells - <i>Figment<\/i><\/b><br>Fugue Records, 2003.",mp3:"http://www.mitchwells.com/music/mp3/figment-wells.mp3",link:"http://mitchwells.com/music-wp/?p=218"},
		
		{name:"<b>Mitch Wells - <i>Figment (Trendroid Remix)<\/i><\/b><br>Fugue Records, 2003.",mp3:"http://www.mitchwells.com/music/mp3/mitch_wells-figment-droidz.mp3",link:"http://mitchwells.com/music-wp/?p=218"},
		
		{name:"<b>Mitch Wells - <i>Secret Communities<\/i><\/b><br>Fugue Records, 2003.",mp3:"http://www.mitchwells.com/music/mp3/secret_communities.mp3",link:"http://mitchwells.com/music-wp/?p=220"},
		
		{name:"<b>Mitch Wells - <i>Slow Withdrawal<\/i><\/b><br>Fugue Records, 2003.",mp3:"http://www.mitchwells.com/music/mp3/mitch_wells-slow_withdrawal.mp3",link:"http://mitchwells.com/music-wp/?p=222"},
		
		{name:"<b>Mitch Wells - <i>Broken Voodoo<\/i><\/b><br>Fugue Records, 2002.",mp3:"http://www.mitchwells.com/music/mp3/mitch_wells-broken_voodoo.mp3",link:"http://mitchwells.com/music-wp/?p=224"},
		
		{name:"<b>Mitch Wells - <i>Sophia Strung Out<\/i><\/b><br>Fugue Records, 2002.",mp3:"http://www.mitchwells.com/music/mp3/mitch_wells-sophia_strung_o.mp3",link:"http://mitchwells.com/music-wp/?p=226"},
		
		{name:"<b>Saru - <i>Something Stronger (Mitch Wells Remix)<\/i><\/b><br>Shadow Records, 2002.",mp3:"http://www.mitchwells.com/music/mp3/saru-something_stronger_mix.mp3",link:"http://mitchwells.com/music-wp/?p=154"},
		
		{name:"<b>Mitch Wells feat Nica Ionz - <i>Twilight<\/i><\/b><br>Fugue Records, 2001.",mp3:"http://www.mitchwells.com/music/mp3/mitch_wells-twilight.mp3",link:"http://mitchwells.com/music-wp/?p=228"},
		
		{name:"<b>Mitch Wells feat Nica Ionz - <i>Twilight (112 Remix)<\/i><\/b><br>Fugue Records, 2001.",mp3:"http://www.mitchwells.com/music/mp3/mitch_wells-twilight_112_mi.mp3",link:"http://mitchwells.com/music-wp/?p=228"},
		
		{name:"<b>Ramada - <i>Circuit Breaker (NYTQ Remix)<\/i><\/b><br>Derailed Records, 2000.",mp3:"http://www.mitchwells.com/music/mp3/ramada-circuit_breaker_nytq.mp3",link:"http://mitchwells.com/music-wp/?p=240"},
		
		{name:"<b>Praga Khan - <i>Power of the Flower (NYTQ Remix)<\/i><\/b><br>Antler-Subway Never Records, 2000.",mp3:"http://www.mitchwells.com/music/mp3/praga_khan-power_flower_nyt.mp3",link:"http://mitchwells.com/music-wp/?p=242"},
		
		{name:"<b>Praga Khan - <i>Lonely (NYTQ Remix)<\/i><\/b><br>Antler-Subway Never Records, 2000.",mp3:"http://www.mitchwells.com/music/mp3/praga_khan-lonely_nytq_remi.mp3",link:"http://mitchwells.com/music-wp/?p=244"},
		
		{name:"<b>Lords of Acid -<i> Lucy's F'n Sky (NYTQ Remix)<\/i><\/b><br>Antler-Subway Never Records, 2000.",mp3:"http://www.mitchwells.com/music/mp3/lords_of_acid-lucys_fn_sky_.mp3",link:"http://mitchwells.com/music-wp/?p=246"},
		
		{name:"<b>NYTQ - <i>What You Need<\/i><\/b><br>Pankaj and Mitch Wells. Derailed Records, 1999.",mp3:"http://www.mitchwells.com/music/mp3/nytq-what_you_need.mp3",link:"http://mitchwells.com/music-wp/?p=248"},
		
		{name:"<b>NYTQ - <i>Just<\/i><\/b><br>Pankaj and Mitch Wells. Sm:)e Communications, 1999.",mp3:"http://www.mitchwells.com/music/mp3/nytq-just.mp3",link:"http://mitchwells.com/music-wp/?p=250"},
		
		{name:"<b>NYTQ - <i>Circadian Izm<\/i><\/b><br>Pankaj and Mitch Wells. Mutiny Records, 1998.",mp3:"http://www.mitchwells.com/music/mp3/nytq-circadian_izm.mp3",link:"http://mitchwells.com/music-wp/?p=252"},
		
		{name:"<b>NYTQ - <i>Circadian Izm (Careful Remix)<\/i><\/b><br>Pankaj and Mitch Wells. Mutiny Records, 1998.",mp3:"http://www.mitchwells.com/music/mp3/nytq-circadian_izm_careful.mp3",link:"http://mitchwells.com/music-wp/?p=252"},
		
		{name:"<b>Mitch Wells - <i>Supermodels of Yesteryear<\/i><\/b><br>1996.",mp3:"http://www.mitchwells.com/music/mp3/mw_supermodelsofyesteryear.mp3",link:"http://mitchwells.com/music-wp/?p=230"},
		
		{name:"<b>Mitch Wells - <i>Sweet Trip<\/i><\/b><br>1995.",mp3:"http://www.mitchwells.com/music/mp3/mw_sweet-trip.mp3",link:"http://mitchwells.com/music-wp/?p=232"},
		
		{name:"<b>Mitch Wells - <i>Shitty Boyfriend<\/i><\/b><br>1992.",mp3:"http://www.mitchwells.com/music/mp3/mw_shittyboyfriend.mp3",link:"http://mitchwells.com/music-wp/?p=234"},
		
		{name:"<b>2 Skinnee J's - <i>Evel<\/i><\/b><br>1991.",mp3:"http://www.mitchwells.com/music/mp3/2sj-evel.mp3",link:"http://mitchwells.com/music-wp/?p=158"},
		
		{name:"<b>2 Skinnee J's - <i>Sensitive 90s Guy<\/i><\/b><br>1991.",mp3:"http://www.mitchwells.com/music/mp3/2sj-sensitive.mp3",link:"http://mitchwells.com/music-wp/?p=158"},
		
		{name:"<b>Innerfear - <i>Heaven<\/i><\/b><br>Steve Branson and Mitch Wells, 1991.",mp3:"http://www.mitchwells.com/music/mp3/innerfear-heaven.mp3",link:"http://mitchwells.com/music-wp/?p=160"},
		
		{name:"<b>Innerfear - <i>Sonic<\/i><\/b><br>Steve Branson and Mitch Wells, 1991.",mp3:"http://www.mitchwells.com/music/mp3/innerfear-sonic.mp3",link:"http://mitchwells.com/music-wp/?p=160"},
		
		{name:"<b>In Vino Veritas - <i>Silence of Sunsets<\/i><\/b><br>Greg Frost, Steve Branson and Mitch Wells, 1988.",mp3:"http://www.mitchwells.com/music/mp3/ivv-silence.mp3",link:"http://mitchwells.com/music-wp/?p=162"},
		
		{name:"<b>In Vino Veritas - <i>Don't Understand<\/i><\/b><br>Greg Frost, Steve Branson and Mitch Wells, 1988.",mp3:"http://www.mitchwells.com/music/mp3/ivv-dont_understand.mp3",link:"http://mitchwells.com/music-wp/?p=162"},
		
	];


	$("#jquery_jplayer").jPlayer({
		ready: function() {
			displayPlayList();
			playListInit(false); // Parameter is a boolean for autoplay.
			demoInstanceInfo($(this), $("#jplayer_info"));
		},
		oggSupport: false
	})
	.jPlayerId("play", "player_play")
	.jPlayerId("pause", "player_pause")
	.jPlayerId("stop", "player_stop")
	.jPlayerId("loadBar", "player_progress_load_bar")
	.jPlayerId("playBar", "player_progress_play_bar")
	.jPlayerId("volumeMin", "player_volume_min")
	.jPlayerId("volumeMax", "player_volume_max")
	.jPlayerId("volumeBar", "player_volume_bar")
	.jPlayerId("volumeBarValue", "player_volume_bar_value")
	.onProgressChange( function(loadPercent, playedPercentRelative, playedPercentAbsolute, playedTime, totalTime) {
		var myPlayedTime = new Date(playedTime);
		var ptMin = (myPlayedTime.getUTCMinutes() < 10) ? "0" + myPlayedTime.getUTCMinutes() : myPlayedTime.getUTCMinutes();
		var ptSec = (myPlayedTime.getUTCSeconds() < 10) ? "0" + myPlayedTime.getUTCSeconds() : myPlayedTime.getUTCSeconds();
		$("#play_time").text(ptMin+":"+ptSec);

		var myTotalTime = new Date(totalTime);
		var ttMin = (myTotalTime.getUTCMinutes() < 10) ? "0" + myTotalTime.getUTCMinutes() : myTotalTime.getUTCMinutes();
		var ttSec = (myTotalTime.getUTCSeconds() < 10) ? "0" + myTotalTime.getUTCSeconds() : myTotalTime.getUTCSeconds();
		$("#total_time").text(ttMin+":"+ttSec);
	})
	.onSoundComplete( function() {
		playListNext();
	});

	$("#ctrl_prev").click( function() {
		playListPrev();
		return false;
	});

	$("#ctrl_next").click( function() {
		playListNext();
		return false;
	});
	
	$("#player_play").click( function() {
	   $("#jquery_jplayer2").pause(); // Pause the other player
	}); 
	
	$("#player_progress_load_bar").click( function() {
	   $("#jquery_jplayer2").pause(); // Pause the other player
	}); 
	
	$("#player_progress_play_bar").click( function() {
	   $("#jquery_jplayer2").pause(); // Pause the other player
	}); 

	function displayPlayList() {
		for (i=0; i < myPlayList.length; i++) {
			$("#playlist_list ul").append("<li id='playlist_item_"+i+"'>"+ myPlayList[i].name +"<\/li>");
			
			var liHeight = document.getElementById("playlist_item_"+i).clientHeight;
			
			$("#playlist_list ul").append("<li class='link' > <a href='"+ myPlayList[i].link+"'><img src=\"images/c-plus-i.png\" ><\/a><\/li>");
			


			
			$("#playlist_item_"+i).data( "index", i ).hover(
				function() {
					if (playItem != $(this).data("index")) {
						$(this).addClass("playlist_hover");
					}
				},
				function() {
					$(this).removeClass("playlist_hover");
				}
			).click( function() {
				var index = $(this).data("index");
				if (playItem != index) {
					playListChange( index );
				}
			});
		}
	}



	function playListInit(autoplay) {
		if(autoplay) {
			playListChange( playItem );
		} else {
			playListConfig( playItem );
		}
	}

	function playListConfig( index ) {
		$("#playlist_item_"+playItem).removeClass("playlist_current");
		$("#playlist_item_"+index).addClass("playlist_current");
		playItem = index;
		$("#jquery_jplayer").setFile(myPlayList[playItem].mp3, myPlayList[playItem].ogg);
	}

	function playListChange( index ) {
		playListConfig( index );
		$("#jquery_jplayer").play();
		$("#jquery_jplayer2").pause(); // Pause the other player

	}

	function playListNext() {
		var index = (playItem+1 < myPlayList.length) ? playItem+1 : 0;
		playListChange( index );
	}

	function playListPrev() {
		var index = (playItem-1 >= 0) ? playItem-1 : myPlayList.length-1;
		playListChange( index );
	}
});


