var flagHotel = false;
var changeStyle = false;

/** Calls the ajax_gethoteldata module that returns the hotel information */
function changeHotel(idHotel){
	_idHotel = idHotel;
	_idRoom = 0;

	if(changeStyle){
		showNewStyle(idHotel);
	}

	/*change the other hotels combo*/
	var combo = Page.FindControl('idHotel');
	var comboOther = Page.FindControl('idHotelOther');
	flagHotel = true;
	comboOther.options[combo.selectedIndex].selected = true;
	flagHotel = false;

	xmlhttpPost(
		"index.php",
		"module=ajax_gethoteldata&idHotel=" + _idHotel,
		"reloadHotelData"
	);

}

/** Receives the hotel data and updates the page with its information */
function reloadHotelData(res){

	eval("hotel = " + res);

	if (hotel.images && hotel.images[0]){
		//Page.FindControl("imgRoom").src = hotel.images[0].filePath;
		Page.FindControl("imagedescriptionbox").innerHTML = hotel.images[0].description;
		Page.FindControl("roomdescription").innerHTML = hotel.description;
        Page.FindControl("dataHotel").innerHTML = hotel.address+' - Tel:'+hotel.phoneNumber+'<br>'+hotel.website;
	}
	updateQuantities();
	usePreviousDates = true;
	//loadcalendars(_idHotel,_month,_year);		// to simulate click on find button	var selectedHotel = document.getElementById('selectedHotel');		if(selectedHotel != null){		createDates();				validateRange();		selectedHotel.parentNode.removeChild(selectedHotel);	}	
}

function changeOtherHotel(obj){
	if(!flagHotel){
		var combo = Page.FindControl('idHotel');
		combo.options[obj.selectedIndex].selected = true;
		changeHotel(obj.value);
	}
}function changeHotelStyle() {	_idHotel = Page.FindControl("idHotelBook").value;	Page.FindControl("roomsbox").innerHTML = roomsboxEmpty;	changeHotel(_idHotel);	/*if(changeStyle){		showNewStyle(_idHotel);	}*/}
