atual = 0;
total = imagens.length;

function proxima(atual){

$(".box1Links").removeClass("swap");

		$('#chamadasPrinsipaisH').html('<a href="'+ link[atual] +'"><img src="/imagem/home/'+ imagens[atual] +'" width="350" height="397" alt="'+ chamada[atual] +'" border="0" /></a><div class="box1_imagemAberturaSobre"><div class="box1_tituloMateriaAbertura">'+ titulo[atual] +'</div><h1 class="box1_olhoMateriaAbertura">'+ chamada[atual] +'</h1></div>');
		
		for(i=0;i<=3;i++) {
			$("#linkNavegaH_"+i+"").css("background-color","#000000");
		}
		$("#linkNavegaH_"+atual+"").css("background-color","#cc0000");

if(atual == 3)atual= 4;
}

function tvflashPub(linkTVFLASH,imagensTVFLASH){

		$(".box1Links").addClass("swap");

		$('#chamadasPrinsipaisH').html('<a href="'+ linkTVFLASH +'"><img src="/imagem/home/tv-flash/'+ imagensTVFLASH +'" width="350" height="490" alt="Publicidade" border="0" /></a>');
		
		for(i=0;i<=3;i++) {
			$("#linkNavegaH_"+i+"").css("background-color","#000000");
		}

}

function show(){
	$(this).everyTime(5000, 'slideshow', function() {atual++; if(atual >= 4){ tvflashPub(linkTVFLASH,imagensTVFLASH); atual = -1;} else proxima(atual);});
}

function stop(recente){
	$(this).stopTime('slideshow');
	atual = recente;
}


function init() {
	$('#chamadasPrinsipaisH').html('<a href="'+ link[atual] +'"><img src="/imagem/home/'+ imagens[atual] +'" width="350" height="397" alt="'+ chamada[atual] +'" border="0" /></a><div class="box1_imagemAberturaSobre"><div class="box1_tituloMateriaAbertura">'+ titulo[atual] +'</div><h1 class="box1_olhoMateriaAbertura">'+ chamada[atual] +'</h1></div>');
	for(i=0;i<=3;i++) {
		$('#thumbNavegaH_'+i+'').html('<a id="linkNavegaH_'+i+'" href="'+ link[i] +'" onmouseover="javascript:proxima('+i+');stop('+i+');" onmouseout="javascript:show()"><img src="/imagem/home/thumbs/'+ imagens[i] +'" width="75" height="75" border="0" alt="'+ titulo[atual] +'"/></a>');
	}
	$("#linkNavegaH_"+atual+"").css("background-color","#cc0000");
	var startSS = show();
}

window.onload = init;