var currentItem = 0;
var nextItem;
var dList;


function rotateProducts() {

	if ($("#productFade").css("display") == 'block') {
		if (currentItem == dList.length-1) {
			var itemToHide = dList[currentItem];
			var itemToShow = dList[0];
			currentItem = 0;
		} else {
			var itemToHide = dList[currentItem];
			var itemToShow = dList[currentItem+1];
			currentItem++;
		}
		
		$(itemToHide).fadeOut("slow");
		$(itemToShow).fadeIn("slow");
		
	}
	
}

$(document).ready(function(){ 

	if ($("#productFade").css("display") == 'block') {
		dList = $("#productFade > div");
	}


     setInterval("rotateProducts()",4000);
     })
