function checkAvailability() { var iYear = 2008; var iMonth = 9; var iDay = 5; var todaydate = pad4(2008) + pad2(9) + pad2(5); var checkindate; var checkoutdate; var week50date; checkindate = pad4(document.frmMain.Yearcheckindate.options[document.frmMain.Yearcheckindate.selectedIndex].value) + pad2(document.frmMain.Monthcheckindate.options[document.frmMain.Monthcheckindate.selectedIndex].value) + pad2(document.frmMain.Daycheckindate.options[document.frmMain.Daycheckindate.selectedIndex].value); checkoutdate = pad4(document.frmMain.Yearcheckoutdate.options[document.frmMain.Yearcheckoutdate.selectedIndex].value) + pad2(document.frmMain.Monthcheckoutdate.options[document.frmMain.Monthcheckoutdate.selectedIndex].value) + pad2(document.frmMain.Daycheckoutdate.options[document.frmMain.Daycheckoutdate.selectedIndex].value); week50date = pad4(2009) + pad2(8) + pad2(21); if (checkindate < todaydate) { alert("Check In date cannot be a past date"); return void(0); } if (checkoutdate <= todaydate) { alert("Check Out date cannot be today's date"); return void(0); } if (checkindate >= checkoutdate) { alert("Check In date must be before Check Out date"); return void(0); } if (checkoutdate > week50date) { alert("Availability for arrival dates more than 50 weeks in the future is not available at this time."); return void(0); } if ((document.frmMain.state.selectedIndex <= 0) || (document.frmMain.MetroID.selectedIndex <= 0)) { alert("You must select a State/Province and metro area."); return void(0); } //Check the numAdults and numKids < 5 var chkNumAdults = document.frmMain.numadults.options[document.frmMain.numadults.selectedIndex].value - 0; var chkNumKids = document.frmMain.numkids.options[document.frmMain.numkids.selectedIndex].value - 0; if ((chkNumAdults + chkNumKids) >= 5) { alert('Maximum occupancy per room is 4 people. Please reduce your numbers.'); return void(0); } //Check the company code is valid alphanumeric characters var sCompCode = ''; if (isAlphaNumeric('companycode')) { if(document.frmMain.companycode.value.length > 0){ sCompCode = document.frmMain.companycode.value; } else { sCompCode = ''; } } else { alert('The company code is invalid. Please try again.'); document.frmMain.companycode.value = ''; document.frmMain.companycode.focus(); return void(0); } //Check the promo code for valid alphanumeric characters var sPromo = ''; if (isAlphaNumeric('promocode')) { if(document.frmMain.promocode.value.length > 0){ sPromo = document.frmMain.promocode.value; } else { sPromo = ''; } } else { alert('The promotional code is invalid. Please try again.'); document.frmMain.promocode.value = ''; document.frmMain.promocode.focus(); return void(0); } var url = "http://www.ExtendedStayAmerica.com/session2.asp"+ "?page=" + escape("http://www.ExtendedStayAmerica.com/") + "&hotelid=" + escape(document.frmMain.location.options[document.frmMain.location.selectedIndex].value) + "&state=" + escape(document.frmMain.state.options[document.frmMain.state.selectedIndex].value) + "&metroID=" + escape(document.frmMain.MetroID.options[document.frmMain.MetroID.selectedIndex].value) + "&iata=" + escape("") + "&corpinfo=" + escape(sCompCode) + "&numadults=" + document.frmMain.numadults.options[document.frmMain.numadults.selectedIndex].value + "" + "&numkids=" + document.frmMain.numkids.options[document.frmMain.numkids.selectedIndex].value + "" + "&numrooms=" + document.frmMain.rooms.options[document.frmMain.rooms.selectedIndex].value + "" + "&inmonth=" + document.frmMain.Monthcheckindate.options[document.frmMain.Monthcheckindate.selectedIndex].value + "" + "&inday=" + document.frmMain.Daycheckindate.options[document.frmMain.Daycheckindate.selectedIndex].value + "" + "&inyear=" + document.frmMain.Yearcheckindate.options[document.frmMain.Yearcheckindate.selectedIndex].value + "" + "&outmonth=" + document.frmMain.Monthcheckoutdate.options[document.frmMain.Monthcheckoutdate.selectedIndex].value + "" + "&outday=" + document.frmMain.Daycheckoutdate.options[document.frmMain.Daycheckoutdate.selectedIndex].value + "" + "&outyear=" + document.frmMain.Yearcheckoutdate.options[document.frmMain.Yearcheckoutdate.selectedIndex].value + "" + "&rateid=" + escape(document.frmMain.rates.options[document.frmMain.rates.selectedIndex].value) + "&directbill=" + escape("") + "&promoCode=" + escape(sPromo); if (sCompCode.length > 0) { url = url + "&companycode=" + escape(sCompCode); } if (document.frmMain.location.selectedIndex <= 0) { url = url + "&destpage=make"; } else { url = url + "&destpage=lodging"; } parent.location.href = url + '&WTReferrer=http%3A%2F%2Fwww%2Eextendedstayamerica%2Ecom%2Fincludes%2Fcontent%2DreservationFormjs%2Easp%3F'; return void(0); }