function validaCampos(){
	
	dados = document.formContato;
	if (dados.email.value == ""){
		alert("O campo e-mail deve ser preenchido!");
		dados.email.focus();
		return false;
	}
	parte1 = dados.email.value.indexOf("@");
	parte2 = dados.email.value.indexOf(".");
	parte3 = dados.email.value.length;
		if (!(parte1 >= 3 && parte2 >= 6 && parte3 >= 9)) {
		alert ("O campo " + dados.email.name + " deve ser conter um e-mail válido!");
		dados.email.focus();
		return false;
	}
	if (dados.assunto.value == ""){
		alert("O campo assunto deve ser preenchido!");
		dados.assunto.focus();
		return false;
	}
	if (dados.assunto.value == ""){
		alert("O campo Telefone deve ser preenchido!");
		dados.assunto.focus();
		return false;
	}
	if (dados.mensagem.value == ""){
		alert("O campo mensagem deve ser preenchido!");
		dados.mensagem.focus();
		return false;
	}
	dados.submit();
}


function aparece(nomu) {
	document.all["trsubmenu" + nomu].style.display="block"
	document.all["submenu" + nomu].style.display="block"
}

function some(numu) {
	document.all["trsubmenu" + numu].style.display="none"
	document.all["submenu" + numu].style.display="none"
}

function getNumeroRandomico(nroIniItervalo, nroFimItervalo){
	nroFimItervalo++;
	return (Math.floor(Math.random() * (nroFimItervalo-nroIniItervalo))+nroIniItervalo);
}

function getRadonItemArray(arrCompl, qtdeItem){
	var arrTemp = [];
	var achou = 0;
	var str = "";
	while (achou < qtdeItem)
	{
		var indiceTemp = getNumeroRandomico(0, arrCompl.length-1);
		if (str.indexOf("("+indiceTemp+")") == -1)
		{
			arrTemp[arrTemp.length] = arrCompl[indiceTemp];
			str += "("+indiceTemp+")";
			achou++;
		}
	}
	return arrTemp;
}

function writeBarraLateral(quantidade){
	document.write('<div style="width:168px; border:1px solid #E4E4E4; margin-left:5px; padding-right:3px; padding-bottom:5px; padding-left:2px">')
		document.write('<img src="img/titulo_pagina_programacao.gif" alt="" border="0" style="margin-top:4px">');
		document.write('<br><br>');
		document.write('<div style="margin-left:5px"><img src="img/seta_blue.gif" alt="" border="0"> <span style="font:bold 11px arial; color:#FFCC00">Veja a programação</span></div>');
		
		document.write('<img src="img/divisor.gif" width="163" height="1" alt="" border="0" style="margin-top:8px; margin-bottom:8px">');
		
			for (var i = 0; i < quantidade; i++){
		
			document.write('<div style="margin-left:5px">');
				document.write('<span style="font:bold 10px arial; color:#177A9E">' + programacao[i][1] + '</span>');
				document.write('<div style="font-size:9px; margin-top:4px">' + programacao[i][0] + '</div>');
			document.write('</div>');
			
			document.write('<img src="img/divisor.gif" width="163" height="1" alt="" border="0" style="margin-top:8px; margin-bottom:8px">');
		
			}
		document.write('<span style="width:100%; font:bold 10px arial; color:#177A9E; text-align:right"><a href="programacao.php">Veja mais datas</a></span>');
	document.write('</div>');

}


function writeFotos(numero){
	document.write('<div style="width:168px; height:126px; border:1px solid #E4E4E4; margin-top:5px; margin-left:5px; padding-right:3px; padding-bottom:5px; padding-left:2px">');
		document.write('<div style="margin-left:5px; margin-top:5px"><img src="img/seta_blue.gif" alt="" border="0"> <span style="font:bold 11px arial; color:#FFCC00">Eventos recentes</span></div>');
		
		document.write('<img src="img/divisor.gif" width="163" height="1" alt="" border="0" style="margin-top:8px; margin-bottom:0px">');
			
			document.write('<table cellpadding="0" cellspacing="0" border="0" width="100%" align="center">');
			
			var dados = getRadonItemArray(fotos, numero);
			for (var i = 0; i < dados.length; i++){
			
				document.write('<tr>');
					document.write('<td align="center">');
						
						document.write('<table cellpadding="0" cellspacing="0" align="center" style="margin-top:5px">');
							document.write('<tr>');
								document.write('<td><img src="img/anterior.gif" alt="" border="0" style="cursor:hand; pointer:hand"></td>');
								document.write('<td align="center" valign="middle" style="border-top:1px solid #E0E0E0; border-bottom:1px solid #E0E0E0; overflow:hidden"><img src="img/fotos/' + dados[i][0] + '_p.jpg" alt="" border="0" style="pointer:hand; cursor:hand" onclick="abreFoto(' + dados[i][0] + ')" id="' + dados[i][0] + ';"></td>');
								document.write('<td><img src="img/posterior.gif" alt="" border="0" style="cursor:hand; pointer:hand"></td>');
							document.write('</tr>');
						document.write('</table>');
						
						document.write('<div style="background-color:#EDEDED; width:95%; padding:2px">Clique para ampliar</div>');
					document.write('</td>');
				document.write('</tr>');
				
				document.write('<tr>');
					document.write('<td><img src="img/divisor.gif" width="163" height="1" alt="" border="0" style="margin-top:8px; margin-bottom:3px"></td>');
				document.write('</tr>');
			
			
			}		
					
			document.write('</table>');		
	document.write('</div>');
	
}


function writeListaProgramacao(){
	document.write('<table width="540">')
		document.write('<tr>')
			document.write('<td class="tabela"><b>Curso</b></td>')
			document.write('<td class="tabela"><b>Início</b></td>')
			document.write('<td class="tabela"><b>Horário</b></td>')
			document.write('<td class="tabela"><b>Duração</b></td>')
			document.write('<td class="tabela"><b>Local</b></td>')
		document.write('</tr>')
	
		for (var i = 0; i < programacao.length; i++){
		
		document.write('<tr>')
			document.write('<td class="tabela">' + programacao[i][1] + '</td>')
			document.write('<td class="tabela">' + programacao[i][2] + '</td>')
			document.write('<td class="tabela">' + programacao[i][3] + '</td>')
			document.write('<td class="tabela">' + programacao[i][4] + '</td>')
			document.write('<td class="tabela">' + programacao[i][5] + '</td>')
		document.write('</tr>')
		
		}
		
	document.write('</table>')		
		
}

function abreFoto(nroFoto){
  idFoto = nroFoto;
  open("abreFoto.php",idFoto, "toolbar=no,location=no,status=no,menubar=no,resizable=no,scrollbars=no,width=1,height=1,top=5000,left=5");
}


// DESTAQUE HOME 1

var currentImg = "one";
var currentDest = 0;
function showDest(dest){
	if ( !document.getElementById("boxDest" + dest) ){
		var objDivTemp = document.getElementById("divDestaque").appendChild(document.createElement("DIV"));
			objDivTemp.id = "boxDest" + dest;
			objDivTemp.className = "off";
			var html = '<img id="imgDestOne" src="'+arrDestques[dest][0]+'" onload="showDest(' + dest + ')" border="0" style="">';
			if ( arrDestques[dest][1] != "" ){
				html = '<a href="'+arrDestques[dest][1]+'">' + html + '</a>';
			}
			objDivTemp.innerHTML = html;
	} else {
		document.getElementById("btDest_" + currentDest).className 	= "dest_pagina";
		document.getElementById("btDest_" + dest).className 		= "dest_pagina_sel";
		document.getElementById("boxDest" + currentDest).className 	= "off";
		document.getElementById("boxDest" + dest).className 		= "on";
		currentDest = dest;
		desligaTimeOutDest();
		timeOutDest();
	}
}
function timeOutDest(){
	window.timeOut = window.setTimeout("avancar()", 4000);
}
function desligaTimeOutDest(){
	if(window.timeOut){
		clearTimeout(window.timeOut);
		window.timeOut=null;
	}
}

function getDestaques(){
	document.write('<table width="100%" cellpadding="0" cellspacing="0" height="1"><tr>');
	if ( arrDestques.length > 0 ){
		for ( var i = 0; i < arrDestques.length; i++ ){
			document.write('<td id="btDest_' + i + '" onclick="showDest(' + i + ')"></td>')
		}
		
	}
	document.write('</tr></table>');
	showDest(0);
}


function writeDestaque(){


document.write('<table cellpadding="0" cellspacing="0" align="center" style="margin-top:5px">');
	document.write('<tr>');
		document.write('<td><img src="img/bt_voltar.gif" width="15" height="79" alt="" border="0" onclick="voltar()" style="cursor:hand; pointer:hand"></td>');
		document.write('<td id="divDestaque" align="center" valign="middle" style="border-top:1px solid #E0E0E0; border-bottom:1px solid #E0E0E0; overflow:hidden"></td>');
		document.write('<td><img src="img/bt_avancar.gif" width="15" height="79" alt="" border="0" onclick="avancar()" style="cursor:hand; pointer:hand"></td>');
	document.write('</tr>');
	document.write('<tr>');
		document.write('<td>');
		getDestaques();
		
		document.write('</td>');
	document.write('</tr>');
document.write('</table>');
}






function iniciar(){
	execTimeoutDest();
}
function parar(){
	desligaTimeOutDest();
}
function voltar(){
	var dest = (currentDest == 0)?arrDestques.length-1:(currentDest-1);
	showDest(dest);
}
function avancar(){
	var dest = (currentDest == arrDestques.length-1)?0:(currentDest+1);
	showDest(dest);
}




// DESTAQUE HOME 2



var currentImg2 = "one2";
var currentDest2 = 0;
function showDest2(dest2){
	if ( !document.getElementById("boxDest2" + dest2) ){
		var objDivTemp = document.getElementById("divDestaque2").appendChild(document.createElement("DIV"));
			objDivTemp.id = "boxDest2" + dest2;
			objDivTemp.className = "off2";
			var html2 = '<img id="imgDestOne2" src="'+arrDestques2[dest2][0]+'" onload="showDest2(' + dest2 + ')" border="0" style="">';
			if ( arrDestques2[dest2][1] != "" ){
				html2 = '<a href="'+arrDestques2[dest2][1]+'">' + html2 + '</a>';
			}
			objDivTemp.innerHTML = html2;
	} else {
		document.getElementById("btDest2_" + currentDest2).className 	= "dest_pagina2";
		document.getElementById("btDest2_" + dest2).className 		= "dest_pagina_sel2";
		document.getElementById("boxDest2" + currentDest2).className 	= "off2";
		document.getElementById("boxDest2" + dest2).className 		= "on2";
		currentDest2 = dest2;
		desligaTimeOutDest2();
		timeOutDest2();
	}
}
function timeOutDest2(){
	window.timeOut2 = window.setTimeout("avancar2()", 3000);
}
function desligaTimeOutDest2(){
	if(window.timeOut2){
		clearTimeout(window.timeOut2);
		window.timeOut2=null;
	}
}

function getDestaques2(){
	document.write('<table width="100%" cellpadding="0" cellspacing="0" height="1"><tr>');
	if ( arrDestques2.length > 0 ){
		for ( var i = 0; i < arrDestques2.length; i++ ){
			document.write('<td id="btDest2_' + i + '" onclick="showDest2(' + i + ')"></td>')
		}
		
	}
	document.write('</tr></table>');
	showDest2(0);
}


function writeDestaque2(){


document.write('<table cellpadding="0" cellspacing="0" align="center" style="margin-top:5px">');
	document.write('<tr>');
		document.write('<td><img src="img/bt_voltar.gif" width="15" height="79" alt="" border="0" onclick="voltar2()" style="cursor:hand; pointer:hand"></td>');
		document.write('<td id="divDestaque2" align="center" valign="middle" style="border-top:1px solid #E0E0E0; border-bottom:1px solid #E0E0E0; overflow:hidden"></td>');
		document.write('<td><img src="img/bt_avancar.gif" width="15" height="79" alt="" border="0" onclick="avancar2()" style="cursor:hand; pointer:hand"></td>');
	document.write('</tr>');
	document.write('<tr>');
		document.write('<td>');
		getDestaques2();
		
		document.write('</td>');
	document.write('</tr>');
document.write('</table>');
}


function iniciar2(){
	execTimeoutDest2();
}
function parar2(){
	desligaTimeOutDest2();
}
function voltar(){
	var dest2 = (currentDest2 == 0)?arrDestques2.length-1:(currentDest2-1);
	showDest2(dest2);
}
function avancar2(){
	var dest2 = (currentDest2 == arrDestques2.length-1)?0:(currentDest2+1);
	showDest2(dest2);
}


