//when the dom is ready
$(function(){
	$("#marquee li:not(:first-child)").hide();
		
});
//when everything's been loaded
 $(window).load( function() {

	// set some variables

	var current = 1;
	var total = $("#marquee").children().length;
	var next;
	var timer = setInterval( function() { slide('next'); }, 5000 );
	var running = 1;
	
	function stopTimer(){
		clearInterval(timer);	
	};

	function slide(index){
		//next
		$("#marquee li:nth-child("+current+")").fadeOut('slow');
		if( current == total ){ current=0; } 
		if(index!='next'){ current=index-0; stopTimer();}
		
		next = current+1;	
		$("#marquee li:nth-child(" + next + ")").fadeIn('slow');
		current++;
	}
	
	
});

