atual = 0;
total = imagens.length;

atual2 = 0;
total2 = imagensBox.length;

function proxima(atual){

$(".box1Links").removeClass("swap");

		$('#chamadasPrincipaisH').html('<a href="'+ link[atual] +'"><img src="/noiva/imagem/home/'+ imagens[atual] +'" width="366" height="512" border="0" /></a>');
		
		for(i=0;i<total;i++) {
			$("#linkNavegaH_"+i+"").css("background-color","#F3F3E9");
			$("#linkNavegaH_"+i+"").css("border-color","#F3F3E9");
			$("#legenda_"+i+"").removeClass("corLegenda_h");
			$("#legenda_"+i+"").addClass("corLegenda");
			document.getElementById("imgTV_"+i).style.display = "none";
		}
		if (atual != total-1)
		$("#linkNavegaH_"+(atual+1)+"").css("border-color","#D15F5E");
		$("#linkNavegaH_"+atual+"").css("background-color","#D15F5E");
		$("#linkNavegaH_"+atual+"").css("border-color","#D15F5E");
		$("#legenda_"+atual+"").removeClass("corLegenda");
		$("#legenda_"+atual+"").addClass("corLegenda_h");
		document.getElementById("imgTV_"+atual).style.display = "block";

if(atual == total-1)atual= total;
}

function proxima2(atual2){

		$('#boxDirDesc').html('<div class="descTextoBoxDir"><h3 class="corTitulo"><a href="'+ linkBox[atual2] +'">' + tituloBox[atual2] + '</a></h3><p class="corTitulo"><a href="'+ linkBox[atual2] +'">' + descBox[atual2] + '</a></p></div><a href="'+ linkBox[atual2] +'"><img src="' + imagensBox[atual2] + '" alt="" border="0"></a>');
		
		for(i=0;i<total2;i++) {
			$("#opNavegaH_"+i+"").css("background-color","#F5F5ED");
			$("#opNavegaH_"+i+"").css("border-right-color","#F5F5ED");
			$("#opNavegaH_"+i+"").css("border-bottom-color","#EBEBD7");
		}		
		
		$("#opNavegaH_"+atual2+"").css("background-color","#FFF");
		$("#opNavegaH_"+atual2+"").css("border-color","#FFF");
		if(atual2 != 0) {
		$("#opNavegaH_"+(atual2-1)+"").css("border-bottom-color","#FFF");
		}
	
if(atual2 == total2-1)atual2= total2;
}

function tvflashPub(linkTVFLASH,imagensTVFLASH){

		$(".box1Links").addClass("swap");

		$('#chamadasPrincipaisH').html('<a href="'+ linkTVFLASH +'"><img src="/noiva/imagem/home/'+ imagensTVFLASH +'" width="366" height="512" alt="Publicidade" border="0" /></a>');
		
		for(i=0;i<=4;i++) {
			$("#linkNavegaH_"+i+"").css("background-color","#F3F3E9");
		}

}

function show(){
	$(this).everyTime(5000, 'slideshow', function() {atual++; if(atual >= total){atual = 0; proxima(atual);} else proxima(atual);});
}

function show2(){
	$(this).everyTime(5000, 'slideshow2', function() {atual2++; if(atual2 >= total2){atual2 = 0; proxima2(atual2);} else proxima2(atual2);});
}

function stop(recente){
	$(this).stopTime('slideshow');
	atual = recente;
}

function stop2(recente2){
	$(this).stopTime('slideshow2');
	atual2 = recente2;
}

function init() {
/*TVFLASH SUPERIOR - FIGURAS */
	$('#chamadasPrincipaisH').html('<a href="'+ link[atual] +'"><img src="/noiva/imagem/home/'+ imagens[atual] +'" width="366" height="512"  border="0" /></a>');
	for(i=0;i<total;i++) {
		$('#thumbNavegaH_'+i+'').html('<a id="linkNavegaH_'+i+'" href="'+ link[i] +'" onmouseover="javascript:proxima('+i+');stop('+i+');" onmouseout="javascript:show()"><img src="/noiva/imagem/home/thumbs/'+ imagens[i] +'" width="100" height="100" border="0"/></a>');
	}
	$("#linkNavegaH_"+atual+"").css("background-color","#D15F5E");
	$("#linkNavegaH_"+atual+"").css("border-color","#D15F5E");
	$("#linkNavegaH_"+(atual+1)+"").css("border-color","#D15F5E");
	$("#legenda_"+atual+"").addClass("corLegenda_h");	
	document.getElementById("imgTV_"+atual).style.display = "block";
	var startSS = show();
/*TVFLASH INFERIOR - BOX */
$('#boxDirDesc').html('<div class="descTextoBoxDir"><h3 class="corTitulo"><a href="'+ linkBox[atual2] +'">' + tituloBox[atual2] + '</a></h3><p class="corTitulo"><a href="'+ linkBox[atual2] +'">' + descBox[atual2] + '</a></p></div><a href="'+ linkBox[atual2] +'"><img src="' + imagensBox[atual2] + '" alt="" border="0"></a>');
	for(i=0;i<total2;i++) {
		$('#opcoesNavegaH_'+i+'').html('<a href="'+ linkBox[i] +'" onmouseover="javascript:proxima2('+i+');stop2('+i+');" onmouseout="javascript:show2()"><div id="opNavegaH_'+i+'" class="itensRodape3Dir corItens">'+catBox[i]+'</div></a>');
	}
	$("#opNavegaH_"+atual2+"").css("background-color","#FFF");
	$("#opNavegaH_"+atual2+"").css("border-color","#FFF");
	var startSS = show2();	
	
}

window.onload = init;