var arrDestques = [
	["img/fotos/001_p.jpg", "", "1"],
	["img/fotos/002_p.jpg", "", "2"],
	["img/fotos/013_p.jpg", "", "13"],
	["img/fotos/014_p.jpg", "", "14"],
	["img/fotos/015_p.jpg", "", "15"],
	["img/fotos/016_p.jpg", "", "16"]
]

var arrDestques2 = [
	["img/fotos/005_p.jpg", "", "5"],
	["img/fotos/006_p.jpg", "", "6"],
	["img/fotos/010_p.jpg", "", "10"],
	["img/fotos/011_p.jpg", "", "11"],
	["img/fotos/017_p.jpg", "", "17"]
]

var arrDestques3 = [
	["img/fotos/007_p.jpg", "", "7"],
	["img/fotos/008_p.jpg", "", "8"],
	["img/fotos/009_p.jpg", "", "9"]
]
function validaCampos(){
	
	dados = document.formContato;
	if (dados.nome.value == ""){
		alert("O campo nome deve ser preenchido!");
		dados.nome.focus();
		return false;
	}
	if (dados.email.value == ""){
		alert("O campo e-mail deve ser preenchido!");
		dados.email.focus();
		return false;
	}
	
	parte1 = document.formContato.email.value.indexOf("@");
	parte2 = document.formContato.email.value.indexOf(".");
	parte3 = document.formContato.email.value.length;
		if (!(parte1 >= 3 && parte2 >= 6 && parte3 >= 9)) {
		alert ("O campo " + document.formContato.email.name + " deve ser conter um e-mail válido!");
		document.formContato.email.focus();
		return false;
	}
	
	if (dados.assunto.value == ""){
		alert("O campo assunto 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 writeMenu(){
	document.write('<tr>')
	document.write('<td width="36" height="27"></td>');
	document.write('<td width="28" height="27"><img src="img/border_left_bloco_principal.gif" width="28" height="27" alt="" border="0"></td>');
	document.write('<td width="656" height="27" background="img/border_center_bloco_principal.gif" valign="top">');
		document.write('<table cellpadding="0" cellspacing="0" border="0" width="550">');
			document.write('<tr>');
				document.write('<td><a href="index.php"><img src="img/bt_home.gif" alt="" border="0" style="margin-left:205px; margin-top:2px"></a></td>');
				document.write('<td><a href="institucional.php"><img src="img/bt_institucional.gif" alt="" border="0" style="margin-left:5px; margin-top:2px"></a></td>');		
				document.write('<td><a id="abreMENU" href="javascript:void(null)" onMouseOver="if (menus){menus[0].onmouseover(this)}" onMouseOut="if (menus){menus[0].onmouseout()}"><img src="img/bt_suites.gif" alt="" border="0" style="margin-left:5px; margin-top:2px"></a></td>');
				document.write('<td><a href="cardapio.php"><img src="img/bt_cardapio.gif" alt="" border="0" style="margin-left:5px; margin-top:2px"></a></td>');
				document.write('<td><a href="contato.php"><img src="img/bt_contato.gif" alt="" border="0" style="margin-left:5px; margin-top:2px"></a></td>');
			document.write('</tr>');
		document.write('</table>');
		
		document.write('<div id="Layer1" style="position:absolute; left:547px; width:63px; padding:0px; z-index:1000; background-color:#F9B66C; border-top:1px solid #DAEE9A; border-left:1px solid #DAEE9A; font-size:10px; color:#5D6449; border-right:1px solid #DAEE9A; visibility:hidden; margin-top:12px"></div>');
		document.write('<div id="menu" style="position:absolute; left:10px; width:400px; height:23px; z-index:1000;"></div>');


	document.write('</td>');
	document.write('<td width="46" height="27"><img src="img/border_right_bloco_principal.gif" alt="" border="0"></td>');
document.write('</tr>');

					
}


function menu(){

	submenu = [];
	for(i=0; i<1; i++) submenu[i] = [];
	textmenu = [];
	for(i=0; i<1; i++) textmenu[i] = [];
	textmenu[0][0] = ["Ouro","Prata","Rosas"]
	textmenu[0][1] = ["ouro.php","prata.php","rosas.php"];
	menus = [];
	if(document.getElementById){
		menus[0] = document.getElementById("Layer1");
		menuinterno = document.getElementById("menu");
		//menu.setAttribute("position","absolute")
		function over(){ this.style.backgroundColor = '#F1FBD1'; }
		function out(){ this.style.backgroundColor = '#E9F8B9'; }
		function show(obj){
			this.style.visibility='visible';
		}
		function hide(){ this.style.visibility='hidden'; }
		for(j=0; j<textmenu.length; j++){	
			for (i=0; i<textmenu[j][0].length; i++){
				//alert(textmenu[j][0][i])
				textmenu[j][0][i] = "<a href='"+textmenu[j][1][i]+"' style='color:#5E6350; text-decoration:none'>" + textmenu[j][0][i] + "</a>";
				submenu[j][i] = document.createElement("DIV");
				submenu[j][i].setAttribute("className", "special");
				submenu[j][i].innerHTML = textmenu[j][0][i];
				submenu[j][i].style.padding = "3px";
				submenu[j][i].onmouseover = over;
				submenu[j][i].onmouseout = out;
				menus[j].appendChild(submenu[j][i]);
			}
			var metrics = getObjectMetrics( document.getElementById("abreMENU") );
			if ( metrics ) {
				menus[j].style.top = metrics.y+11;
				menus[j].style.left = metrics.x;
			}

			
			
//			menus[j].style.top = (parseInt(menuinterno.style.top)+parseInt(menuinterno.style.height));
			menus[j].onmouseover = show;
			menus[j].onmouseout = hide;
		}
		
	}
}


function getObjectMetrics(objTemp){
	if (!objTemp) return false;
	var metrics = {w:objTemp.offsetWidth, h:objTemp.offsetHeight, x:0, y:0, xw:0, yh:0};
	do{
		metrics.x += objTemp.offsetLeft;
		metrics.y += objTemp.offsetTop;
		objTemp = objTemp.offsetParent;
	}while(objTemp.tagName != "BODY")
	metrics.xw = (metrics.w + metrics.x);
	metrics.yh = (metrics.h + metrics.y);
	return metrics;
}

/************************************************************************************************/
/*********************************************** NOVAS FUNÇÕES **********************************/
/************************************************************************************************/


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;
}
	
	
// 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="cursor:hand; pointer:hand" onclick="abreFoto('+arrDestques[dest][2]+')" id="' +arrDestques[dest][2]+ ';" width="265">';
			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('<div class="bordaBox" align="center" style="width:275px; margin-right:5px; margin-top:5px">');
	document.write('<b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b>');
		document.write('<div class="conteudo" style="text-align:left">');
			
			document.write('<div id="divDestaque" style="padding-left:4px; overflow:hidden">');
			
			document.write('</div>');
		
		document.write('</div>');
	document.write('<b class="b4"></b><b class="b3"></b><b class="b2"></b><b class="b1"></b>');
document.write('</div>');

getDestaques();

document.write('<table align="center" cellpadding="0" cellspacing="0" border="0" width="275" style="margin-top:4px; margin-right:5px">');
	document.write('<tr>');
		document.write('<td bgcolor="#A4B63D" onclick="voltar()"style="cursor:hand; color:white; padding:1px; border:1px solid #7E8B36" align="center"><b>Anterior</b></td>');
		document.write('<td width="2%"></td>');
		document.write('<td bgcolor="#A4B63D" onclick="avancar()" style="cursor:hand; color:white; padding:1px; border:1px solid #7E8B36" align="center"><b>Próximo</b></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 + ')" style="cursor:hand; pointer:hand" onclick="abreFoto('+arrDestques2[dest2][2]+')" id="' +arrDestques2[dest2][2]+ ';" 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('<div class="bordaBox" align="center" style="width:275px; margin-right:5px; margin-top:5px">');
	document.write('<b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b>');
		document.write('<div class="conteudo" style="text-align:left">');
			
			document.write('<div id="divDestaque2" style="padding-left:4px; overflow:hidden">');
			
			document.write('</div>');
		
		document.write('</div>');
	document.write('<b class="b4"></b><b class="b3"></b><b class="b2"></b><b class="b1"></b>');
document.write('</div>');

getDestaques2();

document.write('<table align="center" cellpadding="0" cellspacing="0" border="0" width="275" style="margin-top:4px; margin-right:5px">');
	document.write('<tr>');
		document.write('<td bgcolor="#A4B63D" onclick="voltar2()"style="cursor:hand; color:white; padding:1px; border:1px solid #7E8B36" align="center"><b>Anterior</b></td>');
		document.write('<td width="2%"></td>');
		document.write('<td bgcolor="#A4B63D" onclick="avancar2()" style="cursor:hand; color:white; padding:1px; border:1px solid #7E8B36" align="center"><b>Próximo</b></td>');
	document.write('</tr>');
document.write('</table>');


}


function iniciar2(){
	execTimeoutDest2();
}
function parar2(){
	desligaTimeOutDest2();
}
function voltar2(){
	var dest2 = (currentDest2 == 0)?arrDestques2.length-1:(currentDest2-1);
	showDest2(dest2);
}
function avancar2(){
	var dest2 = (currentDest2 == arrDestques2.length-1)?0:(currentDest2+1);
	showDest2(dest2);
}




// DESTAQUE HOME 3



var currentImg3 = "one3";
var currentDest3 = 0;
function showDest3(dest3){
	if ( !document.getElementById("boxDest3" + dest3) ){
		var objDivTemp = document.getElementById("divDestaque3").appendChild(document.createElement("DIV"));
			objDivTemp.id = "boxDest3" + dest3;
			objDivTemp.className = "off3";
			var html3 = '<img id="imgDestOne3" src="'+arrDestques3[dest3][0]+'" onload="showDest3(' + dest3 + ')" style="cursor:hand; pointer:hand" onclick="abreFoto('+arrDestques3[dest3][2]+')" id="' +arrDestques3[dest3][2]+ ';" border="0" style="">';
			if ( arrDestques3[dest3][1] != "" ){
				html3 = '<a href="'+arrDestques3[dest3][1]+'">' + html3 + '</a>';
			}
			objDivTemp.innerHTML = html3;
	} else {
		document.getElementById("btDest3_" + currentDest3).className 	= "dest_pagina3";
		document.getElementById("btDest3_" + dest3).className 		= "dest_pagina_sel3";
		document.getElementById("boxDest3" + currentDest3).className 	= "off3";
		document.getElementById("boxDest3" + dest3).className 		= "on3";
		currentDest3 = dest3;
		desligaTimeOutDest3();
		timeOutDest3();
	}
}
function timeOutDest3(){
	window.timeOut3 = window.setTimeout("avancar3()", 3000);
}
function desligaTimeOutDest3(){
	if(window.timeOut3){
		clearTimeout(window.timeOut3);
		window.timeOut3=null;
	}
}

function getDestaques3(){
	document.write('<table width="100%" cellpadding="0" cellspacing="0" height="1"><tr>');
	if ( arrDestques3.length > 0 ){
		for ( var i = 0; i < arrDestques3.length; i++ ){
			document.write('<td id="btDest3_' + i + '" onclick="showDest3(' + i + ')"></td>')
		}
		
	}
	document.write('</tr></table>');
	showDest3(0);
}


function writeDestaque3(){



document.write('<div class="bordaBox" align="center" style="width:275px; margin-right:5px; margin-top:5px">');
	document.write('<b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b>');
		document.write('<div class="conteudo" style="text-align:left">');
			
			document.write('<div id="divDestaque3" style="padding-left:4px; overflow:hidden">');
			
			document.write('</div>');
		
		document.write('</div>');
	document.write('<b class="b4"></b><b class="b3"></b><b class="b2"></b><b class="b1"></b>');
document.write('</div>');

getDestaques3();

document.write('<table align="center" cellpadding="0" cellspacing="0" border="0" width="275" style="margin-top:4px; margin-right:5px">');
	document.write('<tr>');
		document.write('<td bgcolor="#A4B63D" onclick="voltar3()"style="cursor:hand; color:white; padding:1px; border:1px solid #7E8B36" align="center"><b>Anterior</b></td>');
		document.write('<td width="2%"></td>');
		document.write('<td bgcolor="#A4B63D" onclick="avancar3()" style="cursor:hand; color:white; padding:1px; border:1px solid #7E8B36" align="center"><b>Próximo</b></td>');
	document.write('</tr>');
document.write('</table>');


}


function iniciar3(){
	execTimeoutDest3();
}
function parar3(){
	desligaTimeOutDest3();
}
function voltar3(){
	var dest3 = (currentDest3 == 0)?arrDestques3.length-1:(currentDest3-1);
	showDest3(dest3);
}
function avancar3(){
	var dest3 = (currentDest3 == arrDestques3.length-1)?0:(currentDest3+1);
	showDest3(dest3);
}

function abreFoto(nroFoto){
  idFoto = nroFoto;
  open("abreFoto.php",idFoto, "toolbar=no,location=no,status=no,menubar=no,resizable=no,scrollbars=no,width=625,height=410,top=200,left=200");
}






