﻿function valorCombo(campo, valor){
	
	document.getElementById(campo).value = valor;
	
    //verifica se selecionou o destino, e sempre limpa o hidden de hotel
    if(campo=="hddNumDestinoBusca"){
        document.getElementById("hddNumHotelBusca").value = "";
    }
	//alert(document.getElementById(campo).value)

}

function buscaHoteis(){

    //document.getElementById("aspnetForm").submit();
    //alert('A');
    //alert(document.getElementById("hddNumDestinoBusca").value);
    document.aspnetForm.action="../hoteis/default.aspx?hddNumDestinoBusca="+ document.getElementById("hddNumDestinoBusca").value;
    document.aspnetForm.submit();
    //alert('B');
}

function buscaDestino(){

    //document.getElementById("aspnetForm").submit();
    //alert('A');
    var numHotel = document.getElementById("hddNumHotelBusca").value;
    //alert(numHotel)
    if(numHotel!=""){
        document.aspnetForm.action="../hoteis/destino.aspx?NumHotel="+ numHotel;
        document.aspnetForm.submit();
    }else{
        alert('Selecione um hotel!')
    }
    //alert('B');
}

function buscaEvento(){
        
    var numHotel = document.getElementById("hddNumHotelBusca").value;
    
    if(numHotel!=""){
        document.aspnetForm.action="../hoteis/eventos.aspx?NumHotel="+ numHotel;
        document.aspnetForm.submit();
    }else{
        alert('Selecione um hotel!')
    }
    
}

function cadastraNews(){

    var nome = document.getElementById("ctl00_main_content_txtNome").value;
    var email = document.getElementById("ctl00_main_content_txtEmail").value;
    
    if( email != "Digite seu e-mail" && nome !="Digite seu nome" && email != "" && nome !=""){
        document.aspnetForm.action="../fale_conosco/news.aspx?nome="+ nome + "&email="+ email ;
        document.aspnetForm.submit();
    }else{
        alert('Preencha os campos Nome e E-mail!')
    }
    
}


function buscaCM(){
    //alert('A');
    //alert(document.getElementById("busca_reserva_hddBook").value)
    var URL = document.getElementById("ctl00_main_content_reserva_hddBook").value;
	try
	{
		URL = URL + "?start-date="+ document.getElementById("ctl00_main_content_reserva_date1").value;
        URL = URL + "&end-date="+ document.getElementById("ctl00_main_content_reserva_date2").value;
	}
	catch(err)
	 {
        URL = URL + "?start-date="+ document.getElementById("ctl00_main_content_reserva_date1").value;
        URL = URL + "&end-date="+ document.getElementById("ctl00_main_content_reserva_date2").value;
	 }
	         
    URL = URL + "&adultos="+ document.getElementById("hddAdultos").value;
    URL = URL + "&criancas="+ document.getElementById("hddCriancas").value;
    URL = URL + "&CodHotel="+ document.getElementById("CodHotel").value;
    URL = URL + "&codCidade="+ document.getElementById("codCidade").value;
    //alert(URL);
    if (document.getElementById("codCidade").value == "")
    {
        alert("Escolha um destino!");
    }
    else
    {
    window.location = URL;
    }
}