/**
 * BELOW YOU CAN CHANGE THE TIMER AMOUNT, IN SECONDS.
 */
var timerAmountInSeconds = 10;









/**
 * NO NEED TO CHANGE THE CODE BELOW.
 * IT MAKES THE MAGIC HAPPEN.  :)
 */
var currCount = 0;
var heightArr = new Array();

$(document).ready(function(){
	$("#switchContent li").each( function(i) {
		//if(i) 
		$(this).hide();
		//console.log( $(this).height() );
		heightArr[i] = $(this).height();
	});
	
	$("#switchContent li").eq( currCount ).fadeIn( 'slow', startTimer );
});
	

function startTimer()
{
	if( currCount == ( $("#switchContent li").length - 1) )
	{
		currCount = -1;
	}
	var finalTimer = timerAmountInSeconds * 1000;
	
	$.timer(finalTimer, function (timer) {
		currCount++;
		
  		hideContent();
  		timer.stop();
  	});
}

function hideContent()
{
	var hideCount = currCount == 0 ? hideCount = $("#switchContent li").length - 1 : currCount - 1;
	$("#switchContent li").eq( hideCount ).fadeOut( 'slow', showContent );
}

function showContent(){
	$("#switchContent li").eq( currCount ).fadeIn( 'slow', startTimer );
}
