﻿$(document).ready(function() {
	

    //CALENDARIOS

	var dataInicial = $('#date1').attr('value');
	dataInicial = new Date(dataInicial);
	$('#date1').dpSetStartDate(dataInicial.asString());
	
    $('.ip_date').datePicker();
    $('#ctl00_date1').bind(
		'dpClosed',
		function(e, selectedDates) {
		    	var d = selectedDates[0];
		   		if (d) {
		        d = new Date(d);
				d = d.addDays(1);
		        $('#ctl00_date2').dpSetStartDate(d.asString());
				$('#ctl00_date2').attr('value', d.asString());
		    }
		});	
3	
	$('#date2').datePicker();
 
	
	
});   

function buscaCM(){
    var URL = "http://reservas.masterhoteis.com.br/busca.aspx";    
   
    URL = URL + "?start-date="+ document.getElementById("ctl00_date1").value;
    URL = URL + "&end-date="+ document.getElementById("ctl00_date2").value;

    URL = URL + "&adultos="+ document.getElementById("hddAdultos").value;
    URL = URL + "&criancas="+ document.getElementById("hddCriancas").value;
    URL = URL + "&codCidade="+ document.getElementById("hddHotel").value;

    if(document.getElementById("hddHotel").value=="")
    {        
        alert("Selecione a cidade.")
    } 
    else
    {
        //window.open(URL);
        //alert(URL);
        window.location = URL;
    }
    //alert('Prezado cliente,\n\nEstamos em manutenção para melhor atendê-lo.\nPara efetuar sua reserva, entre em contato\ndiretamente com o hotel desejado.\n\nObrigado.\n\nBourbon Hotéis & Resorts');
}

function valorCombo(campo, valor){	
	document.getElementById(campo).value = valor;	
}
