// JavaScript Document

var timerRotate=null;
var indexRotate=1;
var maxRotate=5;
var allow=1;

var fnRotate = function(){
	setTheTime();
}

// Inicia a contagem do tempo
var setTheTime = function(){
	allow=1;
	timerRotate=setTimeout(fnTroca, 10000);
}

// Cancela a contagem do tempo
var clearTheTime = function(){
	allow=0;
	//alert("set allow --> " + allow);
	clearTimeout(timerRotate);
}

var fnTroca = function(){
	
	clearTimeout(timerRotate);
	
	//alert(allow);
	
	if(1!=allow) return false;
	
	$('p'+String(indexRotate)).fade();
	
	indexRotate++;
	if(6==indexRotate) indexRotate=1;
	
	$('p'+String(indexRotate)).appear();
	
	fnRotate();
}
