var slides;
var duration = 5000;
var all_slides = [];
var current;
function initSlideShow()
{
	if(document.getElementById('week-photo'))
	{
		$("#week-photo").css({"display": "block"});
		current = 0;
		all_slides = $("#week-photo li");
		slides = all_slides.length;
		if(slides>1)
		{
			all_slides.css({"position": "absolute", "top": 0, "left": 0, "display": "none"});
			$(all_slides[0]).css({"display": "block"});
			all_slides[0].parentNode.style.height = all_slides[0].clientHeight + "px";
			setTimeout('rotate(' + 0 +')', duration);
		}
	}
}
function rotate(_index)
{
	$(all_slides[_index]).fadeOut(700);
	if(_index==slides-1)
		_index=-1;
	$(all_slides[++_index]).fadeIn(700);
	$(all_slides[_index]).parent().animate({height: all_slides[_index].clientHeight + "px"}, { duration: 200, queue:false });
	current = _index;
	setTimeout('rotate(' + _index + ')', duration);
}

if (window.addEventListener)
	window.addEventListener("load", initSlideShow, false);
else if (window.attachEvent)
	window.attachEvent("onload", initSlideShow);