<!--
function AbrirPopup(url,titulo,parametros) {
	window.open(url,titulo,parametros);
}
function clearDefault(el) {
  if (el.defaultValue==el.value) el.value = ""
}
function getStyle(el,styleProp) {
	var x = document.getElementById(el);
	if (x.currentStyle)
		var y = x.currentStyle[styleProp];
	else if (window.getComputedStyle)
		var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
	return y;
}
function aumentarFonte() {
	var increment = 1;
	var el = "Body";
	var styleProp = "font-size";
	if (navigator.appName == "Microsoft Internet Explorer" && styleProp == "font-size") {
		styleProp = "fontSize";
	}
	var result = getStyle(el,styleProp);
	var sizeOfBaseFont = result.substring(0,result.length-2);
	sizeOfBaseFont = (parseInt(sizeOfBaseFont) + parseInt(increment));
	document.getElementById(el).style.fontSize = sizeOfBaseFont+"px";
}
function diminuirFonte() {
	var increment = 1;
	var el = "Body";
	var styleProp = "font-size";
	if (navigator.appName == "Microsoft Internet Explorer" && styleProp == "font-size") {
		styleProp = "fontSize";
	}
	var result = getStyle(el,styleProp);
	var sizeOfBaseFont = result.substring(0,result.length-2);
	sizeOfBaseFont = (parseInt(sizeOfBaseFont) - parseInt(increment));
	document.getElementById(el).style.fontSize = sizeOfBaseFont+"px";
}
function tamanhoPadrao() {
	var el = "Body";
	document.getElementById(el).style.fontSize = "10px";
}
function CapaVerGaleria() {
	document.getElementById("idCategoria").value = 0;
	document.getElementById("acaoNavGalerias").value = "exibir";
	document.getElementById("FormularioDeNavegacaoGalerias").submit();
}
function CategoriaVerGaleria() {
	document.getElementById("idCategoria").value = 0;
	document.getElementById("acaoNavGalerias").value = "exibir_galeria";
	document.getElementById("FormularioDeNavegacaoGalerias").submit();
}
function ExibicaoVerGaleria() {
	document.getElementById("idCategoria").value = 0;
	document.getElementById("acaoNavGalerias").value = "exibir_galeria";
	document.getElementById("FormularioDeNavegacaoGalerias").submit();
}
function CapaVerCategoria() {
	if (document.getElementById("idCategoria").value != "0") {
		document.getElementById("acaoNavGalerias").value = "exibir_categoria";
		document.getElementById("FormularioDeNavegacaoGalerias").submit();
	} else {
		window.alert("Por favor selecione uma categoria.");
	}
}
function CategoriaVerCategoria() {
	if (document.getElementById("idCategoria").value != "0") {
	document.getElementById("acaoNavGalerias").value = "exibir";
	document.getElementById("FormularioDeNavegacaoGalerias").submit();
	} else {
		window.alert("Por favor selecione uma categoria.");
	}
}

function ExibicaoVerCategoria() {
	if (document.getElementById("idCategoria").value != "0") {
	document.getElementById("acaoNavGalerias").value = "exibir_categoria";
	document.getElementById("FormularioDeNavegacaoGalerias").submit();
	} else {
		window.alert("Por favor selecione uma categoria.");
	}
}
function ComentarFoto() {
	var emailValido = document.getElementById("Email").value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
	if (emailValido) {
		var alerta = 0;
		if (document.getElementById("Nome").value=="") { alerta=1 } else {''}
		if (document.getElementById("Comentario").value=="") { alerta=1 } else {''}
		if (alerta==1) {
			window.alert("Please complete all fields.");
		} else {
			document.getElementById("FormularioDeComentarioFoto").submit();
		}
	} else {
		window.alert("Please provide an email address valid.");
	}
}
function VerResultadoEnquete(idWebSite) {
	window.open('/oktiva.net/'+idWebSite+'/pagOrigem/pagEnquete/acao/mostrarResultado/iframe/','','location=no,scrollbars=no,menubar=no,resizable=no,status=no,toolbar=no,width=240,height=280','');
}
function Votar() {
	window.open('','pagResultadoEnquete','location=no,scrollbars=no,menubar=no,resizable=no,status=no,toolbar=no,width=240,height=280','');
	document.getElementById("FormularioEnquete").submit();
}

function pedido(acao) {
	if (acao == "exibir") {
		document.getElementById("pagOrigemFormularioDePedido").value = "pag_ver_pedido";
	} else {
		document.getElementById("pagOrigemFormularioDePedido").value = "pag_ver_foto_galeria";
	}
	document.getElementById("acaoFormularioDePedido").value = acao;
	document.getElementById("FormularioDePedido").submit();
}

function alterar_pedido(acao,idItem) {
	if (acao == 'remover_item') {
		document.getElementById("idItemFormularioDePedido").value = idItem;
	}
	document.getElementById("acaoFormularioDePedido").value = acao;
	if (document.getElementById("acaoFormularioDePedido").value == 'enviar_pedido') {
		$alerta = 0;
		if (document.getElementById("Nome").value=="") { $alerta = 1; }
		if (document.getElementById("Email").value=="") { $alerta = 1; }
		if (document.getElementById("Telefone").value=="") { $alerta = 1; }
		if ($alerta == 1) {
			window.alert("The fields \"Name\", \"Email\" e \"Phone\" must be completed.");
		} else {
			document.getElementById("FormularioDePedido").submit(); 
		}
	} else {
		document.getElementById("FormularioDePedido").submit(); 
	}
}

var ajax;
function ajaxInit () {
	var xmlhttp ;
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (ee) {
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			xmlhttp = false;
		}
	}
	}
	return xmlhttp ;
}
function carregar_imagem () {
        //Instancia o objeto xmlhttp
        ajax = ajaxInit();
        if (ajax) {
                window.document.getElementById("ContainerCaptcha").innerHTML = "Loading the image of verification...";
                var url = "http://"+location.hostname+"/sispub/cgi-bin/retornar_imagem_captcha.fcgi?rand="+Math.random()*1000;
                ajax.open("GET", url, true);
                ajax.onreadystatechange = exibir_imagem;
                ajax.send(null);
        } else {
                alert("Unable to create the XMLHTTP object")
        }
}

function exibir_imagem () {
        if (ajax.readyState == 4) {
                if (ajax.status == 200) {
                        var xmldocument = ajax.responseXML;
                        if (xmldocument) {
                                var src_captcha = xmldocument.getElementsByTagName('src_captcha')[0].firstChild.data;
                                var md5sum = xmldocument.getElementsByTagName('md5sum')[0].firstChild.data;
                                if (src_captcha) {
                                        //Alterando o campo hidden "md5sum"
                                        window.document.getElementById("md5sum").value = md5sum;
                                        var html = "<img src=\"http://"+location.hostname+"/"+src_captcha+"\" alt=\"Check image\" id=\"ImagemCaptcha\" /><input id=\"CaptchaCode\" name=\"captcha_code\" value=\"XXXX\" onfocus=\"clearDefault(this)\" type=\"text\" />";
                                        window.document.getElementById("ContainerCaptcha").innerHTML = html;
                                } else {
                                         window.document.getElementById("ContainerCaptcha").innerHTML = "Unable to load image of verification";
                                }
                        }
                } else {
                         window.document.getElementById("ContainerCaptcha").innerHTML = "Unable to load image of verification";
                }
        }
}

function validar_form_contato(formulario) {
	var msg = "";
	if (formulario.add_Nome.value=="") {
		msg += "Please fill out the field 'Name'.\n"
	}
	if (formulario.add_Email.value=="") {
		msg += "Please fill out the field 'Email'.\n"
	} else {
		var reEmail = /^[\w-]+(\.[\w-]+)*@(([\w-]{2,63}\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;
		if (!reEmail.test(formulario.add_Email.value)) {
			msg += "The email '"+formulario.add_Email.value+"' is not valid.\n";
		}
	}
	if (formulario.mensagem.value=="") {
		msg += "Please fill out the field 'Message'.\n"
	}
	if (msg) {
		alert(msg);
		return false;
	} else {
		return true
	}
}

function validar_form_comentario(formulario) {
	var msg = "";
	if (formulario.nome.value=="") {
		msg += "Please complete the field 'Name'.\n"
	}	
	if (formulario.email.value=="") {
		msg += "Please complete the field 'Email'.\n"
	} else {
		var reEmail = /^[\w-]+(\.[\w-]+)*@(([\w-]{2,63}\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;
		if (!reEmail.test(formulario.email.value)) {
			msg += "The email '"+formulario.email.value+"' is not valid.\n";
		}
	}
	if (formulario.comentario.value=="") {
		msg += "Please complete the field 'Message'.\n"
	}
	if (formulario.captcha_code.value=="") {
		msg += "Please complete the sequence of characters shown in Figure below.\n"
	}

	if (msg) {
		alert(msg);
		return false;
	} else {
		return true
	}
}


function mostrar_pagina (pagina, container){
	var LinkPagina, Pagina, No;
	No = window.document.getElementById(container);
	Pagina = "Pagina"+pagina;
	LinkPagina = "LinkPagina"+pagina;	
	//Ocultando a pagina anterior
	var pagina_anterior = getElementsByClassName("visivel", "ul", No);
	if (pagina_anterior.length>0) {
		pagina_anterior[0].className = "pagina";
	}	
	//Retirando a indicacao da pagina anterior
	pagina_anterior = getElementsByClassName("pagina_atual", "span", No);
	if (pagina_anterior.length>0) {
		pagina_anterior[0].className = "";
	}
	
	window.document.getElementById(Pagina).className = "pagina visivel";
	window.document.getElementById(LinkPagina).className = "pagina_atual";
}

function getElementsByClassName(strClass){
  var ret = new Array();
  var tag = arguments[1] || "*";
  var node = arguments[2] || document;
  var base = node.getElementsByTagName(tag);
  var tBase = base.length;
  for(var i = 0; i < tBase; i++)
  {
    var aClass = base[i].className.split(" ");
    var taClass = aClass.length;
    for(var j = 0; j < taClass; j++)
    {
      if(aClass[j] == strClass)
      {
        ret[ret.length] = base[i];
        break;
      }
    }
  }
  return ret;
}

function barra(objeto){
	if (objeto.value.length == 2 || objeto.value.length == 5 ){
		objeto.value = objeto.value+"/";
	}
}

function validar_form_reserva() {
	var msg = "";
	var formulario = document.FormularioReservar;
	var nome = formulario.add_Nome.value;
	var cidade = formulario.add_Cidade.value;
	var estado = formulario.add_Estado.value;
	var pais = formulario.add_Pais.value;
	var email = formulario.add_Email.value;
	var telefone = formulario.add_Telefone.value;
	var periodo = formulario.add_Periodo.value;
	var n_adultos = formulario.add_Adultos.value;
	var n_criancas = formulario.add_Criancas.value;
	var mensagem = formulario.mensagem.value;
	var nome_pedido = formulario.nome_pedido.value;
	var link_pedido = formulario.link_pedido.value;

	if (!nome) {
		msg += "Please complete the field  'Name'.\n"
	}
	if (!cidade) {
		msg += "Please complete the field  'City'.\n"
	}
	if (!pais) {
		msg += "Please complete the field  'Country'.\n"
	}
	if (!telefone) {
		msg += "Please complete the field  'Phone'.\n"
	}
	if (!email) {
		msg += "Please complete the field  'Email'.\n"
	} else {
		var reEmail = /^[\w-]+(\.[\w-]+)*@(([\w-]{2,63}\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;
		if (!reEmail.test(email)) {
			msg += "The email '"+email+"' is not valid.\n";
		}
	}
	if (!periodo) {
		msg += "Please complete the 'Period'.\n"
	} else {
		var reDate = /^((0[1-9]|[12]\d)\/(0[1-9]|1[0-2])|30\/(0[13-9]|1[0-2])|31\/(0[13578]|1[02]))\/\d{4}$/;
		if (!reDate.test(periodo)) {
			msg += "The Period '"+periodo+"' is not valid.\n";
		}
	}
	if (!n_adultos) {
		msg += "Please complete the field 'How many Adults'.\n"
	}
	if (!n_criancas) {
		msg += "Please complete the field 'Children'.\n"
	}
	
	if (!msg) {
		var html_email = "<h3>Solicitação de Reserva</h3>";
		html_email +="<h2>Dados do Pedido</h2>";
		html_email += "<strong>Pacote: </strong><a href=\""+link_pedido+"\" title=\"Ver pacote\">"+nome_pedido+"</a><br />";
		html_email += "<strong>Outras informações: </strong>"+mensagem+"<br /><br />";
		html_email +="<h2>Dados do cliente</h2>";
		html_email += "<strong>Nome: </strong>"+nome+"<br />";
		html_email += "<strong>Cidade: </strong>"+cidade+"<br />";
		html_email += "<strong>Estado: </strong>"+estado+"<br />";
		html_email += "<strong>País: </strong>"+pais+"<br />";
		html_email += "<strong>Telefone: </strong>"+telefone+"<br />";
		html_email += "<strong>Email: </strong>"+email+"<br />";
		html_email += "<strong>Período: </strong>"+periodo+"<br />";
		html_email += "<strong>Número de adultos: </strong>"+n_adultos+"<br />";
		html_email += "<strong>Número de crianças: </strong>"+n_criancas+"<br />";
		document.FormularioReservar.html_do_email.value = html_email;
		return true;
	} else {
		alert(msg);
		return false;
	}
}

jQuery.noConflict();
jQuery(function() {
	jQuery('#FormularioReservar').submit(function(e) {
		e.preventDefault();
 		if (validar_form_reserva()) {
			jQuery('#FormularioReservar').nyroModalManual();
		}
		return false;
	});
});

-->
