<!--
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("Por favor preencha todos os campos.");
		} else {
			document.getElementById("FormularioDeComentarioFoto").submit();
		}
	} else {
		window.alert("Por favor forneça um endereço de e-mail válido.");
	}
}
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("Os campos \"Nome\", \"Email\" e \"Telefone\" devem ser preenchidos.");
		} 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 = "Carregando a imagem de verifica&#231;&#227;o...";
                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("N&#227;o foi possivel criar o objeto xmlhttp")
        }
}

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=\"Imagem de verifica&#231;&#227;o\" 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 = "Não foi possível carregar a imagem de verifica&#231;&#227;o";
                                }
                        }
                } else {
                         window.document.getElementById("ContainerCaptcha").innerHTML = "Não foi possível carregar a imagem de verifica&#231;&#227;o";
                }
        }
}

function validar_form_contato(formulario) {
	var msg = "";
	if (formulario.add_Nome.value=="") {
		msg += "Por favor preencha o campo 'Nome'.\n"
	}
	if (formulario.add_Email.value=="") {
		msg += "Por favor preencha o campo '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 += "O Email '"+formulario.add_Email.value+"' não é válido.\n";
		}
	}
	if (formulario.mensagem.value=="") {
		msg += "Por favor preencha o campo 'Mensagem'.\n"
	}
	if (msg) {
		alert(msg);
		return false;
	} else {
		return true
	}
}

function validar_form_comentario(formulario) {
	var msg = "";
	if (formulario.nome.value=="") {
		msg += "Por favor preencha o campo 'Nome'.\n"
	}	
	if (formulario.email.value=="") {
		msg += "Por favor preencha o campo '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 += "O Email '"+formulario.email.value+"' não é válido.\n";
		}
	}
	if (formulario.comentario.value=="") {
		msg += "Por favor preencha o campo 'Mensagem'.\n"
	}
	if (formulario.captcha_code.value=="") {
		msg += "Por favor preencha a sequência de caracteres indicados pela figura abaixo.\n"
	}

	if (msg) {
		alert(msg);
		return false;
	} else {
		return true
	}
}

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 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("PaginaVisivel", "div", No);
	if (pagina_anterior.length>0) {
		pagina_anterior[0].className = "Pagina";
	}	
	//Retirando a indicacao da pagina anterior
	pagina_anterior = getElementsByClassName("PaginaAtual", "a", No);
	if (pagina_anterior.length>0) {
		pagina_anterior[0].className = "";
	}
	
	window.document.getElementById(Pagina).className = "PaginaVisivel";
	window.document.getElementById(LinkPagina).className = "PaginaAtual";
}


function enviar_form_reserva () {
	var msg = "";
	
	var nome = document.FormularioReservar.add_Nome.value;
	var email = document.FormularioReservar.add_Email.value;
	var telefone = document.FormularioReservar.add_Telefone.value;
	if (!nome) {msg += "Por favor preencha o campo 'Nome'\n";}
	if (!email) {
		msg += "Por favor preencha o campo 'Email'\n";
	} else {
		var er = RegExp(/^[A-Za-z0-9_\-\.]+@[A-Za-z0-9_\-\.]{2,}\.[A-Za-z0-9]{2,}(\.[A-Za-z0-9])?/);
   		if(er.test(email) == false){
          msg += "O email '"+email+"' está inválido\n";
      	}
    }
	
	if (!telefone) {msg += "Por favor preencha o campo 'Telefone'\n";}
	
	if (!msg) {
		var html_email = "<p>Foi solicitado a reserva do seguinte pacote: <a href=\"" +
		document.FormularioReservar.linkpacote.value+"\" title=\"Ir para o pacote: " + 
		document.FormularioReservar.add_NomePacote.value+"\" >" + document.FormularioReservar.add_NomePacote.value +
		"</a></p>";
		html_email += "<p>Dados do cliente:</p>";
		html_email += "<strong>Nome: </strong>"+nome+"<br />";
		html_email += "<strong>Email: </strong>"+email+"<br />";;
		html_email += "<strong>Telefone: </strong>"+telefone+"<br />";;
		document.FormularioReservar.html_do_email.value = html_email;
		return true;
	} else {
		alert(msg);
		return false;
	}
	 
}

function validar_form_reserva(formulario) {
	var msg = "";
	var i
	for (i=0;i<formulario.voo.length;i++){
		if (formulario.voo[i].checked) break;
	}
    	var tipo_voo = formulario.voo[i].value;
	if (tipo_voo == "Ida" && formulario.dataIda.value=="") {
		msg += "Por favor preencha o campo 'Data da Ida'.\n"
	} else if (tipo_voo == "IdaeVolta" && (formulario.dataIda.value=="" || formulario.dataVolta.value=="")) {
		msg += "Por favor preencha os campos 'Data da Ida' e 'Data da Volta'.\n"
	}

	if (msg) {
		alert(msg);
		return false;
	} else {
		return true
	}
}