﻿curNo = 0;
isPlay = true;
function toggleTout(ctr){
	newTout = touts[ctr]
	if (curNo == ctr) return;
	document.getElementById('cTC' + curNo).className = '';
	//$('#centerToutCont').stop().animate({backgroundImage: 'url(/images/home/tout' + newTout + '.jpg)'}, {duration:500});
	$("#centerTout").stop().fadeTo(500, ".70", function(){
        $(this).css("backgroundImage", "url(./images/tout" + newTout + ".jpg)");  
		document.getElementById('cTC' + ctr).className = 'selected';
		$(this).fadeTo("slow", "1");
    }); 	
	curNo = ctr;
}
function startTimers() {  
	featureTimer = setInterval(changeFeature, 3000); 
}
function togglePlay(off) {
	if (isPlay || off){
		clearInterval(featureTimer);
		isPlay = false;
	}else{
		startTimers();
		isPlay = true;
	}
}
function changeFeature() {
	var newFeature = (curNo == touts.length-1 ? 0 : curNo + 1);
	toggleTout(newFeature);
}
startTimers();
$(document).ready(function () {
	for (i=1;i <= touts.length;i++){
		img = new Image();
		$(img).load().attr('src', './images/home/tout' + i + '.jpg');
	}
});
