function rotateImages() {
	var oCurPhoto = $('#photoShow div.current');
	var oNxtPhoto = oCurPhoto.next();
	if (oNxtPhoto.length == 0) {
		oNxtPhoto = $('#photoShow div:first');
	};
	
	oCurPhoto.removeClass('current').addClass('abs').fadeOut(500);
	oNxtPhoto.addClass('current').fadeIn(500);
	
	var oCurThumb = $('#thumbs img.active');
	var oNxtThumb = oCurThumb.parent().next().children();
	if (oNxtThumb.length == 0) {
		oNxtThumb = $('#thumbs img:first');
	};	
	
	oCurThumb.removeClass('active');
	oNxtThumb.addClass('active');
	
};

$(function() {
	$('#photoShow div.current ~ div').hide();
	
	var myTimer = setInterval("rotateImages()", 5000);
	
	$("a.carocontrol").hover(function(){
		clearInterval(myTimer);
		myTimer = "";
		var linkNum = $(this).attr("name");
		$('#thumbs img.carothumb').removeClass('active');
		$(this).children().addClass('active');
		$('#photoShow div.current').removeClass('current').addClass('abs').hide();
		$('#photoShow div.abs').hide();
		$('#photoShow div.pic' + linkNum).addClass('current').css({ opacity: 1.0 }).stop().show();
	}, function (){
		if(myTimer==""){
			myTimer = setInterval('rotateImages()', 5000);
		};
	});
});	
