//funcao para salto de menu------------------------------------------------------------------------- function jump(targ,selObj,restore){ var par = selObj.options[selObj.selectedIndex].value; if(par!=0){ eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); if (restore) selObj.selectedIndex=0; } } //atencao------------------------------------------------------------------------------------------ function atencao(par){ el = document.getElementById(par); el.style.display='block'; } //função abre popup-------------------------------------------------------------------------------- function popup(par,w,h){ window.open(par+'.php','_blank','width='+w+'px height='+h+'px'); } //função abre outra janela------------------------------------------------------------------------- function newWindow(par){ window.open(par); } //função abre outra aba---------------------------------------------------------------------------- function redirect(par,par2){ window.open('?src='+par2+'/'+par); } //função redireciona------------------------------------------------------------------------------- function enviaFor(par){ window.location.href=par+'.php'; } //função limpar FORM------------------------------------------------------------------------------- function limpaForm(par){ var el = document.getElementById(par); el.reset(); } //IMPRIMIR//////////////////////////////////////////////////////////////////// function DoPrinting(){ if (!window.print){ alert("Use o Firefox ou Internet Explorer \n nas versões 4.0 ou superior!") return } window.print() } //Aparece e some div------------------------------------------------------------------------------- function showHide(obj) { var el = document.getElementById(obj); if ( el.style.display != 'none') { el.style.display = 'none'; } else { el.style.display = 'block'; } } //Some div----------------------------------------------------------------------------------------- function disableDiv(obj) { var el = document.getElementById(obj); el.style.display = 'none'; } //VERIFICA SE É NUMERICO--------------------------------------------------------------------------- function ifnumber(id,par){ var el = document.getElementById(id); if(isNaN(el.value)){ el.value=""; el.focus(); alert("SOMENTE VALORES NUMÉRICOS EM " + par); return false; } return true; } //LIBERA CAMPOS------------------------------------------------------------------------------------ function Vazio(id){ if(document.getElementById(id).value.lenght!=""){ document.getElementById(id).value=""; document.getElementById(id).focus(); return false; } return true; } //RECARREGAPAGINA---------------------------------------------------------------------------------- function realoaded(id){ window.location.href = id; } //VERIFICA SE REALMENTE QUER EFETUAR ALGUM PROCEDIMENTO-------------------------------------------- function real(){ var r=confirm("DESEJA REALMENTE DELETAR"); if (r!=true){ //document.write("entrando...."); //window.location.href=""; document.getElementById("cancelar").style.visibility = "visible"; } else{ } } //COMPARA CAPTCHA---------------------------------------------------------------------------------- function CAPTCHA(){ if(document.forms[1].captcha.value!=document.forms[1].confCaptcha.value){ alert("ERRO DE ESCRITA NO CÓDIGO !!!"); document.forms[1].captcha.value=""; forms[1].confCaptcha.focus(); return false; } return true; } //COMPARA SENHA-------------------------------------------------------------------------------------------- function comparaSenha(id,id2){ var el=document.getElementById(id); var el2=document.getElementById(id2); if(el2.value.length<=5){ alert("VALOR DE DÍGITOS INSUFICIENTE PARA SENHA !!!\nFAVOR, CRIAR SENHA COM MÍNIMO DE 6 DÍGITOS."); el2.value=""; el.focus(); return false; } if(el.value!=el2.value){ alert("ERRO NA COMPARAÇÃO DE SENHA !!!"); el.value=""; el2.value=""; el.focus(); return false; } return true; } //----------------------------------------------------------------------------------------------- // FORMATAR CAMPOS DE TELEFONE function formatar(objeto, sMask, evtKeyPress) { //escolha o tipo de mascara na chamada do evento, exemplo: //function formatar(this, '(32)3333-3333', event) var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla; //funcao para formatar campo CPF, DATA, TEL, CEP, COD if(document.all) { // Internet Explorer nTecla = evtKeyPress.keyCode; } else if(document.layers) { // Nestcape nTecla = evtKeyPress.which; } else { nTecla = evtKeyPress.which; if (nTecla == 8) { return true; } } sValue = objeto.value; // Limpa todos os caracteres de formata‡ão que // j estiverem no campo. sValue = sValue.toString().replace( "-", "" ); sValue = sValue.toString().replace( "-", "" ); sValue = sValue.toString().replace( ".", "" ); sValue = sValue.toString().replace( ".", "" ); sValue = sValue.toString().replace( "/", "" ); sValue = sValue.toString().replace( "/", "" ); sValue = sValue.toString().replace( ":", "" ); sValue = sValue.toString().replace( ":", "" ); sValue = sValue.toString().replace( "(", "" ); sValue = sValue.toString().replace( "(", "" ); sValue = sValue.toString().replace( ")", "" ); sValue = sValue.toString().replace( ")", "" ); sValue = sValue.toString().replace( " ", "" ); sValue = sValue.toString().replace( " ", "" ); fldLen = sValue.length; mskLen = sMask.length; i = 0; nCount = 0; sCod = ""; mskLen = fldLen; while (i <= mskLen) { bolMask = ((sMask.charAt(i) == "-") || (sMask.charAt(i) == ".") || (sMask.charAt(i) == "/") || (sMask.charAt(i) == ":")) bolMask = bolMask || ((sMask.charAt(i) == "(") || (sMask.charAt(i) == ")") || (sMask.charAt(i) == " ")) if (bolMask) { sCod += sMask.charAt(i); mskLen++; } else { sCod += sValue.charAt(nCount); nCount++; } i++; } objeto.value = sCod; if (nTecla != 8) { // backspace if (sMask.charAt(i-1) == "9") { // apenas n£meros... return ((nTecla > 47) && (nTecla < 58)); } else { // qualquer caracter... return true; } } else { return true; } } //----------------------------------------------------------------------------------------------------------- // FUNÇÃO PARA FAZER UM FADE IN OU FADE OUT (USADA NA FUNÇÃO SHOWPOPUP) // fadeOut('ID', 1) --> 1 é o tempo // fadeIn('ID', 1) function fadeOut(id, time) { target = document.getElementById(id); alpha = 100; timer = time;//(time*1000)/50; var i = setInterval( function() { if (alpha <= 0) clearInterval(i); setAlpha(target, alpha); alpha -= 2; }, timer); } // FUNÇÃO FADE IN function fadeIn(id, time) { target = document.getElementById(id); alpha = 0; timer = (time*1000)/50;//time; var i = setInterval( function() { if (alpha >= 100) clearInterval(i); setAlpha(target, alpha); alpha += 2; }, timer); } // ESTA FUNÇÃO DEFINE A TRANSPARÊNCIA (USADA NAS FUNÇÕES FADEOUT E FADEIN) function setAlpha(target, alpha) {//setAlpha(id, 5) target.style.filter = "alpha(opacity="+ alpha +")"; target.style.opacity = alpha/15; } //--------------------------------------------------------------------------------------------- //-- inicializa o objeto criado e envia dados(se existirem) ----------------------------------- //--------------------------------------------------------------------------------------------- //FUNCAO ENVIA CONTATO function enviaContato(){ ajaxContato=IniciaAjax(); if(ajaxContato){ ajaxContato.onreadystatechange = function(){ try{ if (ajaxContato.readyState == 1) { document.getElementById("divLoading2").style.display = "block"; } if(ajaxContato.readyState == 4){ document.getElementById("divLoading2").style.display = "none"; if(ajaxContato.status == 200){ //alert(ajaxContato.responseText); trataenviaContato(); } else{ alert("Ocorreu um erro de comunicação."); } } } catch (err){ //alert("Seu navegador não possui suporte javascript!"); } } //traz dados do form var nome = document.getElementById("nome").value; var email = document.getElementById("email").value; var tel = document.getElementById("tel").value; var cidade = document.getElementById("cid").value; var uf = document.getElementById("uf").value; //var assunto = document.getElementById("assunto").value; var mensagem = document.getElementById("men").value; var completa = document.getElementById("completa").value; //monta a query string dados = "nome="+nome+"&email="+email+"&tel="+tel+"&cidade="+cidade+"&uf="+uf+"&mensagem="+mensagem+"&completa="+completa; //alert(dados); //faz requizicao e envio pelo metodo post ou get ajaxContato.open('POST','ScriptsPHP/AjaxContato.php',true); ajaxContato.setRequestHeader('Content-type','application/x-www-form-urlencoded'); ajaxContato.send(dados); } } function trataenviaContato(){ var info = ajaxContato.responseText; if(info==1){alerta="ERRO!!!\nCAMPO NOME VAZIO."; document.getElementById("nome").value=" ";} if(info==2){alerta="ERRO!!!\nCAMPO E-MAIL VAZIO."; } if(info==3){alerta="ERRO!!!\nENVIO INCORRETO !!!"; document.formContato.reset();} if(info==4){alerta="ERRO!!!E-MAIL INCORRETO"; document.getElementById("email").value=" " } if(info==5){alerta="ERRO DE ENVIO.\nSERVIDOR OCUPADO TEMPORARIAMENTE !!!.";} if(info==6){alerta="ENVIO REALIZADO COM SUCESSO."; document.formContato.reset();} alert(alerta); } //--------------------------------------------------------------------------------------------- //-- inicializa o objeto criado e envia dados(se existirem) ----------------------------------- //--------------------------------------------------------------------------------------------- //FUNCAO ENVIA RESERVAS function enviaReservas(){ ajaxReserva=IniciaAjax(); if(ajaxReserva){ ajaxReserva.onreadystatechange = function(){ try{ if (ajaxReserva.readyState == 1) { document.getElementById("divLoading").style.display = "block"; } if(ajaxReserva.readyState == 4){ document.getElementById("divLoading").style.display = "none"; if(ajaxReserva.status == 200){ //alert(ajaxReserva.responseText); trataReservas(); } else{ alert("Ocorreu um erro de comunicação."); } } } catch (err){ //alert("Seu navegador não possui suporte ou recursos para javascript estão desabilitados!"); } } //traz dados do form var nome = document.getElementById("nomeRes").value; var email = document.getElementById("emailRes").value; var tel = document.getElementById("telRes").value; var cidade = document.getElementById("cidRes").value; var uf = document.getElementById("ufRes").value; var obs = document.getElementById("menRes").value; var entrada = document.getElementById("entradaRes").value; var saida = document.getElementById("saidaRes").value; var adulto = document.getElementById("adultoRes").value; var crianca = document.getElementById("criancaRes").value; var bebes = document.getElementById("bebesRes").value; var quarto = document.getElementById("quartoRes").value; var cama = document.getElementById("camaRes").value; var completa = document.getElementById("completa").value; //monta a query string dados = "nome="+nome+"&email="+email+"&tel="+tel+"&cidade="+cidade+"&uf="+uf+"&obs="+obs+"&completa="+completa+"&entrada="+entrada+"&saida="+saida+"&adulto="+adulto+"&crianca="+crianca+"&bebes="+bebes+"&quarto="+quarto+"&cama="+cama; //alert(dados); //faz requizicao e envio pelo metodo post ou get ajaxReserva.open('POST','ScriptsPHP/AjaxReservas.php',true); ajaxReserva.setRequestHeader('Content-type','application/x-www-form-urlencoded'); ajaxReserva.send(dados); } } function trataReservas(){ var info = ajaxReserva.responseText; if(info==1){alerta="ERRO!!!\nCAMPO NOME VAZIO."; document.getElementById("nomeRes").value="";} if(info==2){alerta="ERRO!!!\nCAMPO E-MAIL VAZIO."; } if(info==3){alerta="ERRO!!!\nEMAIL INCORRETO !!!"; document.getElementById("emailRes").value="";} if(info==4){alerta="ERRO!!!TELEFONE VAZIO";} if(info==5){alerta="ERRO!!!SOMENTE VALORES NUMÉRICOS EM TELEFONE"; document.getElementById("telRes").value="";} if(info==6){alerta="RESERVA REALIZADA COM SUCESSO !!!"; document.formReservas.reset();} if(info==7){alerta="ERRO!!!\nCAMPO UF É NECESSÁRIO";} if(info==8){alerta="ERRO!!!\nENVIO INCORRETO";} if(info==9){alerta="ERRO!!!\nSERVIDOR OCUPADO TEMPORARIAMENTE.";} if(info==10){alerta="SUCESSO!!!\nENVIO REALIZADO COM SUCESSO."; document.formReservas.reset();} if(info==11){alerta="ERRO!!!\nCAMPO CIDADE É NECESSÁRIO.";} alert(alerta); } //--------------------------------------------------------------------------------------------- //-- inicializa o objeto criado e envia dados(se existirem) ----------------------------------- //--------------------------------------------------------------------------------------------- //FUNCAO ENVIA NEWS function news(){ ajaxnews=IniciaAjax(); if(ajaxnews){ ajaxnews.onreadystatechange = function(){ try{ if (ajaxnews.readyState == 1) { //document.getElementById("divLoading").style.display = "block"; } if(ajaxnews.readyState == 4){ //document.getElementById("divLoading").style.display = "none"; if(ajaxnews.status == 200){ //alert(ajaxnews.responseText); trataNews(); } else{ alert("Ocorreu um erro de comunicação."); } } } catch (err){ //alert("Seu navegador não possui suporte ou recursos para javascript estão desabilitados!"); } } //captura dados var nome = document.getElementById("nomeNews").value; var email = document.getElementById("emailNews").value; //por default 1 = geral var area = 1; //monta a query string dados = "nome="+nome+"&email="+email+"&area="+area; //alert(dados); //faz requizicao e envio pelo metodo post ou get ajaxnews.open('POST','ScriptsPHP/AjaxNews.php',true); ajaxnews.setRequestHeader('Content-type','application/x-www-form-urlencoded'); ajaxnews.send(dados); } } function trataNews(){ var info = ajaxnews.responseText; if(info==1){alerta="ERRO! NOME É CAMPO OBRIGATÓRIO "; document.getElementById("nomeNews").value="";} if(info==2){alerta="ERRO!!!\nE-MAIL INVÁLIDO !!!"; document.getElementById("emailNews").value="";} if(info==3){alerta="ERRO! E-MAIL É CAMPO OBRIGATÓRIO."; document.getElementById("emailNews").value="";} if(info==4){alerta="ERRO DE ENVIO.\nSERVIDOR OCUPADO TEMPORARIAMENTE."; document.formNews.reset();} if(info==5){alerta="CADASTRO REALIZADO COM SUCESSO !!!."; document.formNews.reset();} if(info==6){alerta="E-MAIL JÁ CADASTRADO!!!."; document.formNews.reset();} alert(alerta); } //--------------------------------------------------------------------------------------------- //-- inicializa o objeto criado e envia dados(se existirem) ----------------------------------- //--------------------------------------------------------------------------------------------- //FUNCAO MOSTRA DADOS function mostraDados(pag){ ajaxShow=IniciaAjax(); if(ajaxShow){ ajaxShow.onreadystatechange = function(){ try{ if (ajaxShow.readyState == 1) { document.getElementById("divLoading").style.display = "block"; } if(ajaxShow.readyState == 4){ document.getElementById("divLoading").style.display = "none"; if(ajaxShow.status == 200){ //alert(ajaxShow.responseText); if(pag=="apousada"){ document.getElementById("apousada").style.display = "block"; document.getElementById("apousada").innerHTML= ajaxShow.responseText; }else if(pag=="faleconosco"){ document.getElementById("faleconosco").style.display = "block"; document.getElementById("faleconosco").innerHTML= ajaxShow.responseText; } else if(pag=="reservas"){ document.getElementById("reservas").style.display = "block"; document.getElementById("reservas").innerHTML= ajaxShow.responseText; } else{ document.getElementById("local").style.display = "block"; document.getElementById("local").innerHTML= ajaxShow.responseText; } } else{ alert("Ocorreu um erro de comunicação."); } } } catch (err){ //alert("Seu navegador não possui suporte ou recursos para javascript estão desabilitados!"); } } //monta a query string dados = "pag="+pag; //alert(dados); //faz requizicao e envio pelo metodo post ou get ajaxShow.open('POST','ScriptsPHP/AjaxMostraDados.php',true); ajaxShow.setRequestHeader('Content-type','application/x-www-form-urlencoded'); ajaxShow.send(dados); } } //--------------------------------------------------------------------------------------------- //-- inicializa o objeto criado e envia dados(se existirem) ----------------------------------- //--------------------------------------------------------------------------------------------- //FUNCAO MOSTRA IMAGEM QUARTO function choose4(valor){ ajax=IniciaAjax(); if(ajax){ ajax.onreadystatechange = function(){ try{ if (ajax.readyState == 1) { document.getElementById("divLoading").style.display = "block"; } if(ajax.readyState == 4){ document.getElementById("divLoading").style.display = "none"; if(ajax.status == 200){ //alert(ajax.responseText); document.getElementById("visualizar").innerHTML = ajax.responseText; } else{ alert("Ocorreu um erro de comunicação."); } } } catch (err){ alert("Seu navegador não possui suporte ou recursos para javascript estão desabilitados!"); } } //traz dados do form //var valor = document.getElementById("quarto").value; //monta a query string dados = "quarto="+valor; //alert(dados); //faz requizicao e envio pelo metodo post ou get ajax.open('POST','ScriptsPHP/AjaxImgQuarto.php',true); ajax.setRequestHeader('Content-type','application/x-www-form-urlencoded'); ajax.send(dados); } } //--------------------------------------------------------------------------------------------- //-- inicializa o objeto criado e envia dados(se existirem) ----------------------------------- //--------------------------------------------------------------------------------------------- //FUNCAO LIGHTBOX LEAL function mostraImg(valor,evento){ ajax=IniciaAjax(); if(ajax){ ajax.onreadystatechange = function(){ try{ if (ajax.readyState == 1) { document.getElementById("fume").style.display = "block"; document.getElementById("englobaFoto").style.display = "block"; document.getElementById("loadingImg").style.display = "block"; } if(ajax.readyState == 4){ document.getElementById("loadingImg").style.display = "none"; if(ajax.status == 200){ //alert(ajax.responseText); //verifica evento if(evento=="on"){ document.getElementById("fume").style.display = "block"; document.getElementById("englobaFoto").style.display = "block"; document.getElementById("englobaFoto").innerHTML = ajax.responseText; } else{ document.getElementById("fume").style.display = "none"; document.getElementById("englobaFoto").style.display = "none"; document.getElementById("englobaFoto").innerHTML = ''; } } else{ alert("Ocorreu um erro de comunicação."); } } } catch (err){ alert("Seu navegador não possui suporte ou recursos para javascript estão desabilitados!"); } } //traz dados do form //var valor = document.getElementById("quarto").value; //monta a query string dados = "img="+valor; //alert(dados); //faz requizicao e envio pelo metodo post ou get ajax.open('POST','ScriptsPHP/AjaxlightFoto.php',true); ajax.setRequestHeader('Content-type','application/x-www-form-urlencoded'); ajax.send(dados); } } //--------------------------------------------------------------------------------------------- //-- inicializa o objeto criado e envia dados(se existirem) ----------------------------------- //--------------------------------------------------------------------------------------------- //FUNCAO MOSTRA TARIFARIO function tarifa(valor){ ajax=IniciaAjax(); if(ajax){ ajax.onreadystatechange = function(){ try{ if (ajax.readyState == 1) { //document.getElementById("loadingImgTarifa").style.display = "block"; } if(ajax.readyState == 4){ //document.getElementById("loadingImgTarifa").style.display = "none"; if(ajax.status == 200){ //alert(ajax.responseText); document.getElementById("tarifa").innerHTML = ajax.responseText; document.getElementById("btn"+valor+"Tarifa").style.background='#FFFFCC'; document.getElementById("btn"+valor+"Tarifa").style.color='#000'; } else{ alert("Ocorreu um erro de comunicação."); } } } catch (err){ // alert("Seu navegador não possui suporte ou recursos para javascript estão desabilitados!"); } } //monta a query string dados = "tipo="+valor; //alert(dados); //faz requizicao e envio pelo metodo post ou get ajax.open('POST','ScriptsPHP/AjaxTarifario.php',true); ajax.setRequestHeader('Content-type','application/x-www-form-urlencoded'); ajax.send(dados); } } //----------------------------------------------------------------------------------------------- //FUNCAO TROCA TITULO function trocaTitle(arg){ switch(arg){ case "main": var saida = "Página Inicial"; break; case "faleconosco": var saida = "FALE CONOSCO"; break; case "apousada": var saida = "A POUSADA"; break; case "eventos": var saida = "EVENTOS"; break; case "local": var saida = "LOCALIZAÇÃO"; break; case "reservas": var saida = "RESERVAS"; break; } document.title = saida; }