/* WebDoor */
var aux = -1;
var timer;	
//var idsCarro = 0;
//var indxAtual = 0;
function setRotativo(indx,ligado) {
	var max = 0;
	$("#menu_webdoor A").each(function(i){
		max = i;
	});
	//alert(max);
	if (indx > max) {
		indx = 0 ;
	}
	//alert(indx)
	indxAtual = indx;
	indxAnt = aux;
	//alert(indxAnt+','+indxAtual)
	if(indxAtual == indxAnt){
		//if(idsCarro[indxAtual] && idsCarro.length > 1){
			//window.location = "interna_veiculos.php?id="+idsCarro[indxAtual];
		//}
		
		/*$("#link_dest_"+indxAtual).attr('href',);*/
	}else{
		$("#dest_"+indxAtual).fadeIn("slow");
		$("#dest_"+indxAnt).fadeOut("slow");
		$("#index_" + indxAnt).attr("class", "");
		$("#index_" +indxAtual ).attr("class", "ativo");							
	}
	//if(idsCarro){
	//	setIdCarro(idsCarro[indxAtual]);
	//}
	
	aux = indxAtual;		
	if(ligado == true){
		clearTimeout(timer);
		timer = setTimeout('setRotativo(' + (aux+1) + ',true)', 5000);
	}else{
		clearTimeout(timer);
	}	

}
/* /WebDoor   */
$(document).ready(function(){
	if(document.getElementById('web-dor')){
		setRotativo(0,true);
	}				
	timer = setTimeout('setRotativo(0,true)', 5000);		 				
});