//Mostrar ou esconder a combo de classificação de hotel, se o 
function mostrarClassificacao(classi) {

	var oClassi = document.getElementById('linhaClassificacao');
//alert((classi == 'comfort'));
	if (classi == 'comfort') {
		oClassi.style.display = (navigator.appVersion.indexOf("MSIE")!=-1)?'block':'table-row';
	} else {
		oClassi.style.display = 'none';
	}
}

function mostraCancelamento(){
if (document.getElementById("Cancelamento").style.display=="none")
	
		document.getElementById("Cancelamento").style.display="block";
else
document.getElementById("Cancelamento").style.display="none";


}

function mostraQuadro(){
if (document.getElementById("Quadro").style.display=="none")
	
		document.getElementById("Quadro").style.display="block";
else
document.getElementById("Quadro").style.display="none";

}

function getLocalidades(valor, msg){
	
	document.getElementById("painelPesquisa").innerHTML='<p align=center><br><br>' + msg + '...<br><br><img src=imagens/aguarde.gif><br><br></p>';
	document.getElementById("pesquisa").src=  valor;
}

function getPacoteDestino(msg)
{
    var osel =document.formPesquisa.Pais;
	osel.options[0]=new Option(msg,"",true);
	document.getElementById("pesquisa").src=  "getPacoteDestinos.asp?mes=" + document.getElementById("mes").value + "&idTipoPacote=" + document.getElementById("idtipoPacote").value ;
}

//Lista as famílias de pacotes para o tipo de pacote seleccionado
function getPacoteFamilia(msg)
{
    var osel = document.formPesquisa.idTipoPacoteFamilia;
	osel.options[0] = new Option(msg,"",true);
	document.getElementById("pesquisa").src = "getPacoteFamilias.asp?idTipoPacote=" + document.getElementById("idtipoPacote").value;
}

//Lista as famílias de pacotes para o tipo de pacote seleccionado.
//Se for a família 3 (TENTAÇÕES) navega para pacotes_tentacoes.asp?idTipoPacote=3
function getPacoteFamilia2(msg)
{
	if (document.formPesquisa.idtipoPacote.options[document.formPesquisa.idtipoPacote.selectedIndex].value=="3") {
		window.location.href = "pacotes_tentacoes.asp?idTipoPacote=3";
		return;
	};

    var osel = document.formPesquisa.idTipoPacoteFamilia;
	osel.options[0] = new Option(msg,"",true);
	document.getElementById("pesquisa").src = "getPacoteFamilias.asp?idTipoPacote=" + document.getElementById("idtipoPacote").value;
}

function getDestinos(msg){
    var osel =document.formPesquisa.destino
	osel.options[0]=new Option(msg,"",true);


	//document.getElementById("tddestino").innerHTML='<select name="destino" id="destino"  class="FontScrol"><option value=" ">Aguarde um momento...</option></select>';
	document.getElementById("pesquisa").src=  "getDestinos.asp?destinationCode=" + document.getElementById("Pais").value + "&tipoHotel=" + document.getElementById("TipoHotel").value;
	
}
function getZonas(msg){
var osel =document.formPesquisa.zona
	osel.options[0]=new Option(msg,"",true);
		

	//document.getElementById("tdzona").innerHTML='<select name="zona" id="zona"  class="FontScrol"><option value=" ">Aguarde um momento...</option></select>';
	
document.getElementById("pesquisa").src= "getZonas.asp?destinationCode=" + document.getElementById("destino").value;



}
function clickcombodestination(elem){
	document.getElementById("regiao").value = elem.options[elem.selectedIndex].text;
	return true;
}



function getavailability(){
	var flag;
	var aux="\n";

	flag=false;

	var frm = document.formPesquisa;

if (frm.Pais.value=="") {
   flag=true;
   aux=aux+"Pais\n";
 }

if (frm.destino.value=="") {
   flag=true;
   aux=aux+"Destino\n";
 }

if( !isDate(frm.datainicio) ) {
   flag=true;
   aux=aux+"Data Entrada\n";
 }

if( !isDate(frm.datafim) ) {
   flag=true;
   aux=aux+"Data Saida\n";
 }

if (flag==true) {
	alert("Por favor verique o(s) campo(s)\n" + aux);
	return false;
} else {
	pesq();
	return true;
};

}	
	
	


function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

<!--
function isInteger(sInteger) 
{
    var inputStr = sInteger.toString(); // in case not a string already
    var oneChar;
    for (var i = 0; i < inputStr.length; i++) 
    {
        oneChar = inputStr.charAt(i);
        if (oneChar < "0" || oneChar > "9") 
            return false;
    } 
    return true;
}




function isDate(field) 
{
    var sDate = field.value;

    var Slash1Pos = sDate.indexOf("-",0);

    var Slash2Pos = sDate.indexOf("-",Slash1Pos + 1);

    var yyyy = sDate.substring(0,4);
    var mm = sDate.substring(Slash1Pos + 1,Slash2Pos);
    var dd = sDate.substring(Slash2Pos + 1,sDate.length);


    // Validate date
    if(!isInteger(mm) || !isInteger(dd) || !isInteger(yyyy)) return false;

    if (yyyy.length != 4) return false;
    if (mm < 1 || mm > 12) return false;
    if (dd < 1 || dd > 31) return false;
    if (mm == 2) 
    {
        if (dd > 29) return false;
        if (dd == 29) 
        {
        	if (yyyy % 100 == 0 && yyyy % 400 != 0) return false;
            	if (yyyy % 4 != 0) return false;
        }
    } 
    else 
    if ((mm == 4 || mm == 6 || mm == 9 || mm == 11) && dd>30) 
    {
        return false;
    }

    return true;
}


function getAvailAvioes(){
	var flag;
	var aux="\n";
	flag=false;
	var frm;
	if (document.formPesquisaAvioes) {
		frm = document.formPesquisaAvioes;
	} else {
		frm = document.formPesquisaAviaoHotel;
	};

	if (frm.startAirport.value=="") {
	   flag=true;
	   aux=aux+"Origem\n";
	 }
	if (frm.endAirport.value=="") {
	   flag=true;
	   aux=aux+"Destino\n";
	 }
	if( !isDate(frm.startDate) ) {
	   flag=true;
	   aux=aux+"Data Partida\n";
	 }
	if( !isDate(frm.startDateRet) && frm.roundTrip.checked) {
	   flag=true;
	   aux=aux+"Data Regresso\n";
	}
	if(frm.passAdults.value == '0' && frm.passChildren.value == '0' && frm.passInfants.value == '0'){
		flag=true;
		aux=aux + "Total de 0 (zero) passageiros\n";
	};
	if (flag==true) {
		alert("Por favor verique o(s) campo(s)\n" + aux);
		return false;
	} else {
		//frm.submit();
		pesqAvioes();
		return true;
	}
}


//
//Funções para mudar o estado do som nas páginas, quando se muda no menu
//
//Função nova. Atribui o valor do som à Cookie
function setSom(valor) {
	createCookie("previlegetours_som",valor,30);
}
//Função antiga
function setSom_OLD(valor) {
	//actualizar formulário de pesquisa, se existir
	var oSom = document.getElementById("som");
	if (oSom != null) oSom.value = valor; 

	//Actualizar som nos filmes flash
	if (navigator.appName.indexOf("Microsoft") != -1) {
		var oFlash = document.getElementsByTagName("object");
		for (i=0; i<oFlash.length; i++) {
			if (oFlash[i].id != "") thisMovie(oFlash[i].id).asSetSom(valor);
		};
	} else {
		var oFlash = document.getElementsByTagName("embed");
		for (i=0; i<oFlash.length; i++) {
			if (oFlash[i].id != "") thisMovie(oFlash[i].id).asSetSom(valor);
		};
	};
};

function thisMovie(movieName) {
	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	return (isIE) ? window[movieName] : document[movieName];
};


//
//Funções para manipular Cookies no Javascript. Utilizadas no NOVO controlo do som
//
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}


//
//funcões para detalhe de Pacotes
//
function getnoites(idpacote, msg) {
	var datapartida =document.getElementById("dataPartida").value;
	document.getElementById("tdnoites").innerHTML='<select name="noites" id="noites"  class="FontScrol"  style="width: 85px;"><option value="">' + msg + '...</option></select>';
	document.getElementById("pesquisa").src="getnoites.asp?datapartida=" + datapartida + "&idpacote=" + idpacote ;
}
function getRegime(idpacote, msg) {
	var datapartida = document.getElementById("dataPartida").value;
	var noites = document.getElementById("noites").value;
	document.getElementById("tdregime").innerHTML='<select name="noites" id="noites"  class="FontScrol"  style="width: 85px;"><option value="">' + msg + '...</option></select>';
	document.getElementById("pesquisa").src="getRegime.asp?datapartida=" + datapartida + "&idpacote=" + idpacote + "&noites=" + noites;
}
function getTipoQuarto(idpacote, msg) {
	var datapartida = document.getElementById("dataPartida").value;
	var noites = document.getElementById("noites").value;
	var idRegime = document.getElementById("regime").value;
	document.getElementById("tdtipoquarto").innerHTML='<select name="tipoQuarto" id="tipoQuarto" class="FontScrol" style="width: 95px;"><option value="">' + msg + '...</option></select>';
	document.getElementById("pesquisa").src="getTipoQuarto.asp?datapartida=" + datapartida + "&idpacote=" + idpacote + "&noites=" + noites + "&idRegime=" + idRegime;
}


function getPacotePreco() {
	var flag;
	var aux="\n";
	flag=false;
	var frm = document.frmpesquisaPacotepreco;

	if (frm.dataPartida.value=="0") {
	   flag=true;
	   aux=aux+"Data Partida\n";
	}

	if (frm.noites.value=="") {
	   flag=true;
	   aux=aux+"Noites\n";
	}

	if (frm.regime.value=="") {
	   flag=true;
	   aux=aux+"Regime\n";
	}

	if (frm.tipoQuarto.value=="") {
	   flag=true;
	   aux=aux+"Tipo Quarto\n";
	}

	if (flag==true) {
	   alert("Por favor verique o(s) campo(s)\n" + aux);
	  return false;
	}

	frm.submit();
}


//
//Função para actualizar o nº total de pessoas da pesquisa (pesquisas de hotel)
//
function actualizarTotPessoas(){
	var pessoas = document.formPesquisa.pessoas;
	var arrPessoas = pessoas.options[pessoas.selectedIndex].value.split("_");
	var ad = arrPessoas[0];// = document.formPesquisa.adultos;
	var cr = arrPessoas[1];// = document.formPesquisa.criancas;
	var qu = document.formPesquisa.quartos.options[document.formPesquisa.quartos.selectedIndex].value;
	var qtdAd = 0; var qtdCr = 0; var qtdQu = 0;

//alert(ad.options(ad.selectedIndex).value);
//alert(new Number(ad.options(ad.selectdeIndex).value));

	if (! isNaN(ad)) qtdAd = new Number(ad);
	if (! isNaN(cr)) qtdCr = new Number(cr);
	if (! isNaN(qu)) qtdQu = new Number(qu);

	document.getElementById("spanResumoPesq").innerHTML = (qtdAd * qtdQu) + " " + campoAdultos + " " + campoE + " " + (qtdQu * qtdCr) + " " + campoCriancas + ", " + txtEm + " " + qtdQu + " " + campoQuartos;
}

-->
