var current = 0;

$(document).ready(function() {
	$('#player li').hover(
		function() {
			$(this).addClass("hover");
		},
		function() {
			$(this).removeClass("hover");
		}
	).click(function() {
		
		/*
		$("#player li").removeClass("selected");
		$(this).addClass("selected");
		num = $(this).attr("num");
		
		$("#player > div").stop(true,true).fadeOut(1600);
		$("#player > div[num="+num+"]").stop(true,true).fadeIn(1600);		
		*/
		
		$(document).stopTime("player");
		PlayNow( $(this).attr("id") );
		
	});
	
	$('#player div.mask').css('opacity',0.7);
	
	$(document).everyTime(6000, "player", function() {
		current ++;
		if(current > 2) current = 0;
		PlayNow(current);
	});
	
});

var PlayNow = function(current){
	//alert('change');
	$("#player li").removeClass("selected");
	var $this = $("#player li:eq("+current+")");
	$this.addClass("selected");
	num = $this.attr("num");
	
	$("#player > div").stop(true,true).fadeOut(500);
	$("#player > div:eq("+current+")").stop(true,true).fadeIn(500);	
}
