$(function(){

	var jsWaitTime = 8;
	var jsTransitionTime = 2.5;
	var isHovered = 0;
	var items = $(".jsCarousel li");

	$(".jsCarousel").hover(function(){isHovered = 1;},function(){isHovered = 0;});
	$(items).each(function(i){$(this).css("z-index", i+1);});

	setInterval(function(){
		if (isHovered == 0) {
			$(items).each(function(i){
				/ * Increment elements z-index up by 1 */
				$(this).css("z-index", (parseInt($(this).css("z-index"))+1));
				$(items).each(function(){
					/* If this is the highest element in the stack */
					if (parseInt($(this).css("z-index")) > $(items).length) {
						/* Animate the info div closing */
						$(this).find("div:first").slideUp("normal", function(){
							/* Fade out this element */
							$(this).parent().fadeOut((jsTransitionTime * 1000), function(){
								/* Reset z-index to 1, making lowest element in stack */
								$(this).css("z-index", 1);
								$(this).find("div:first").show();
								$(this).show();
							});
						});
					}
				});
			});
		}
	}, (jsWaitTime * 1000))

});
