var timoutId;

$(document).ready(function() {
	var items = $("#leftColHome .rotateItem");

	curIndex = -1;
	nextIndex = 0;
	
	function Rotate(block1, block2, curIndex, nextIndex)
	{
		$(block1).fadeOut(500, function(){
			$(block2).fadeIn(500);
		});
	}
	function Rotation()
	{
		curIndex=nextIndex;
		nextIndex++;
		
		if (curIndex==items.length-1)
		{
			nextIndex=0;
		}
		Rotate(items[curIndex], items[nextIndex], curIndex, nextIndex);
		timoutId = window.setTimeout(function() {Rotation()}, 5000);
	}
	
	timoutId = setTimeout(function() {Rotation()}, 5000);
	
});

function setVisible(itemIndex)
{
	clearTimeout(timoutId);
	$("#leftColHome .rotateItem").stop().hide();
	$("#rotate" + itemIndex).show();
}
