function redirect() { window.open(SearchForm.select1.options[SearchForm.select1.selectedIndex].value) } function buildDates() { if (document.SearchForm.NoNights.value == "") { alert("Please specify the length of your stay."); SearchForm.NoNights.focus() return false; } else if(isNaN(document.SearchForm.NoNights.value)) { alert("Please specify the length of your stay in numerics"); SearchForm.NoNights.focus() return false; } buildFromDate(); //return (buildFromDate() && buildToDate()); //alert("FromDate: " + document.SearchForm.FromDate.value); //alert("ToDate: " + document.SearchForm.ToDate.value); //return false; } function buildFromDate() { if (document.SearchForm.timestamp.value == "" || validateDate(document.SearchForm.timestamp.value) == false) { return false; } else { document.SearchForm.FromDate.value = document.SearchForm.timestamp.value; buildToDate(); //return true; } } function buildToDate() { if (document.SearchForm.NoNights.value == "") { alert("Please specify the length of your stay."); SearchForm.NoNights.focus() return false; } else { var checkInDate = new Date(document.SearchForm.timestamp.value); var checkOutDate = new Date( checkInDate.getTime() + (document.SearchForm.NoNights.value * 86400000)); document.SearchForm.ToDate.value = (checkOutDate.getMonth() + 1) + "/" + checkOutDate.getDate() + "/" + checkOutDate.getFullYear(); //document.SearchForm.action = "http://www.roomrate.com/SearchRedirect.aspx?affiliate=washington&booktype=7&ContactId=&DestId=0&CityCode=DCA&City=Washington&CustFlag=N&ExactMatch=0&OrdBy=0&Miles=5&lat=38.8922&lon=-77.0198&src=99&PrefChain=0&AvoidChain=0&Seniors=0&Assoc=0&roomcount=1&groupres=&roomtype=0&minrating=0&hotel=&chain=0&fromdate=&todate=&Location=38.8922%3B-77.0198&NoNights=2&Adults=1&Children=0&Go.x=14&Go.y=6"; //return true; } } function buildLocation() { var temp = new Array(); temp = document.SearchForm.Location.value.split(";"); document.SearchForm.lat.value = temp[0]; document.SearchForm.lon.value = temp[1]; } function validateNumKey(e) { var key; var keychar; var reg; if(window.event) { // for IE, e.keyCode or window.event.keyCode can be used key = e.keyCode; } else if(e.which) { // netscape key = e.which; } else { // no event, so pass through return true; } // We allow digits and a backspace. keychar = String.fromCharCode(key); reg = /\d/; return (reg.test(keychar) || (key == 8)); } function validateDate(val) { var validDate = /^(((0|)[1-9])|(1[0-2]))\/(((0|)[1-9])|([1-2][0-9])|(3[0-1]))\/\d{4}$/; if (val.length > 0) { if (!validDate.test(val)) { alert("Check-in date must be a valid date in the format of \"MM/DD/YYYY\"."); return false; } } return true; } function redirect() { window.open(SearchForm1.select1.options[SearchForm1.select1.selectedIndex].value) }