function setDefaultDate() {
	var numDays = 2;	//number of days for the default stay

	var today = new Date();
	var day1 = (today.getUTCMonth() + 1) + "/" + today.getUTCDate() + "/" + today.getUTCFullYear();
	
	today.setDate(today.getDate() + numDays);
	
	var day2 = (today.getUTCMonth() + 1) + "/" + today.getUTCDate() + "/" + today.getUTCFullYear();
	
	var txt1 = document.getElementById("DateIn");
	var txt2 = document.getElementById("DateOut");
	
	txt1.value = day1;
	txt2.value = day2;
}
function toggle() {
	var list = document.getElementById("propertyList");
	if (list.style.display == "block")
		list.style.display = "none";
	else
		list.style.display = "block";
}
function doSelect(hotelID) {
	var propList = document.getElementById("property");
	propList.innerHTML = getHotelName(hotelID);
	
	var txtHotelID = document.form1.hotelID;
	txtHotelID.value = hotelID;

	toggle();
}
function getHotelName(hotelID) {
	if (hotelID == 5892) return "HOTEL MELA";
	if (hotelID == 8186) return "THE MAVE HOTEL";
	if (hotelID == 5891) return "WATER AND BEACH CLUB";
	if (hotelID == 5889) return "THE STRAND OCEAN DRIVE";
	if (hotelID == 5888) return "THE WAVE HOTEL";
	if (hotelID == 5890) return "HOTEL ST. AUGUSTINE";
	if (hotelID == 6116) return "IRON HORSE HOTEL";
	if (hotelID == 8167) return "THE MOONRISE HOTEL";
	if (hotelID == 4829) return "THE BETSY HOTEL";
if (hotelID == 8545) return "CASSA HOTEL AND RESIDENCES";
	
	return "";
}
function btnReservations() {
	var hotelID = document.form1.hotelID;
	var arrive = document.form1.DateIn;
	var depart = document.form1.DateOut;
	var adults = document.form1.adults;
	var children = document.form1.children;
	
	resForm(hotelID.value, arrive.value, depart.value, adults.value, children.value);
}
function resForm(id, arrive, depart, adults, children) {
			arrive = arrive.replace(/ /g,"");
			depart = depart.replace(/ /g,"");
			
			adults = parseInt(adults);
			children = parseInt(children);
			
			if (isNaN(adults)) adults = 0;
			if (isNaN(children)) children = 0;

			var date1 = new Date(arrive);
			var date2 = new Date(depart);

			arrive = (date1.getMonth() + 1) + "/" + date1.getDate() + "/" + date1.getFullYear();
			depart = (date2.getMonth() + 1) + "/" + date2.getDate() + "/" + date2.getFullYear();
		
			url = "https://be.genares.net/" +id + "?NextPage=room_list&PropertyID=" + id + "&Action=Book&GuestCountry=US&Currency=USD&NumberOfRooms=1&checkinDate=" + arrive + "&checkoutDate=" + depart + "&NumberOfAdults=" + adults + "&NumberOfChildren=" + children;
			if (id > 0)
				window.open(url, "reservations");
			else
				alert("Please select a hotel.");
}

function doRedirect(url) {
	window.open("rdr/" + url);	
	return false;
}
