msPerDay = 24 * 60 * 60 * 1000; // Number of milliseconds per day //Open calendar popup window function openCalendar(field,datestr){ calendar_window = window.open("/popup.calendar.asp?fieldName=" + field + "&date=" + datestr, "calendar", "width=350,height=300, top=90, left=40, resizable=yes,scrollbars=no,toolbar=yes"); calendar_window.focus(); } function onArrivalChange(){ arrdate = new Date(document.quickbook.arrival.value) if (arrdate.getFullYear()<2000){ arrdate = new Date(Math.round(arrdate.getMonth()+1) + '/' + arrdate.getDate() + '/' + Math.round(arrdate.getFullYear()+100)) document.quickbook.arrival.value = Math.round(arrdate.getMonth()+1) + '/' + arrdate.getDate() + '/' + arrdate.getFullYear() } newdepdate = new Date(arrdate.getTime() + (msPerDay * document.quickbook.triplength.value)) document.quickbook.departure.value = Math.round(newdepdate.getMonth()+1) + '/' + newdepdate.getDate() + '/' + newdepdate.getFullYear() } function onDepartureChange(){ setTripLength() } function setTripLength(){ arrdate = new Date(document.quickbook.arrival.value) depdate = new Date(document.quickbook.departure.value) if (arrdate.getFullYear()<2000){ arrdate = new Date(Math.round(arrdate.getMonth()+1) + '/' + arrdate.getDate() + '/' + Math.round(arrdate.getFullYear()+100)) document.quickbook.arrival.value = Math.round(arrdate.getMonth()+1) + '/' + arrdate.getDate() + '/' + arrdate.getFullYear() } if (depdate.getFullYear()<2000){ depdate = new Date(Math.round(depdate.getMonth()+1) + '/' + depdate.getDate() + '/' + Math.round(depdate.getFullYear()+100)) document.quickbook.departure.value = Math.round(depdate.getMonth()+1) + '/' + depdate.getDate() + '/' + depdate.getFullYear() } if ((Math.round(depdate.getTime()/ msPerDay) - Math.round(arrdate.getTime()/ msPerDay)) > 0 ){ document.quickbook.triplength.value = Math.round(depdate.getTime()/ msPerDay) - Math.round(arrdate.getTime()/ msPerDay) } } function submitform(){ if (checkvcuidates()) { //document.quickbook.submit(); var arrival = document.quickbook.arrival.value; var departure = document.quickbook.departure.value; var adults = document.quickbook.adults[document.quickbook.adults.selectedIndex].value; var children = document.quickbook.children[document.quickbook.children.selectedIndex].value; var childages = ''; for (i = 0; i < document.quickbook.childages.length; i++) { if (document.quickbook.childages[i].value != '') { childages += document.quickbook.childages[i].value + ','; } } var advancedsearch = document.quickbook.advancesearch.value; vcui_window = window.open("/vcui.asp?submittal=true&arrival="+ arrival +"&departure="+ departure +"&adults="+ adults +"&children="+ children +"&childages="+ childages +"&advancedsearch="+ advancedsearch, "vcui", "width=800,height=600, top=0, left=0, resizable=yes,scrollbars=yes,toolbar=yes"); vcui_window.focus(); return false } else{ return false } } function checkvcuidates(){ msg = "" arrival = document.quickbook.arrival.value departure = document.quickbook.departure.value arrivalarray = arrival.split("/") departurearray = departure.split("/") if (arrival.length == 0 || arrivalarray.length != 3){ msg = msg + "You must enter a valid Arrival Date. (mm/dd/yyyy)\n" } else if (arrivalarray.length == 3){ start = arrivalarray[2].length -2 arrivalarray[2] = arrivalarray[2].substr(start) if (arrivalarray[2].length < 2) { msg = msg + "You must enter a valid Arrival Date. (mm/dd/yyyy)\n" } else { arrivalarray[2] = "20" + arrivalarray[2] if (!ValidDay(arrivalarray[0],arrivalarray[1],arrivalarray[2])) { msg = msg + "You must enter a valid Arrival Date. (mm/dd/yyyy)\n" } } } if (departure.length == 0 || departurearray.length != 3){ msg = msg + "You must enter a valid Departure Date. (mm/dd/yyyy)\n" } else if (departurearray.length == 3){ start = departurearray[2].length -2 departurearray[2] = departurearray[2].substr(start) if (departurearray[2].length < 2) { msg = msg + "You must enter a valid Departure Date. (mm/dd/yyyy)\n" } else { departurearray[2] = "20" + departurearray[2] if (!ValidDay(departurearray[0],departurearray[1],departurearray[2])) { msg = msg + "You must enter a valid Departure Date. (mm/dd/yyyy)\n" } } } if (msg.length > 0){ alert(msg); return false; } document.quickbook.arrival.value = arrivalarray[0]+"/"+arrivalarray[1]+"/"+arrivalarray[2] document.quickbook.departure.value = departurearray[0]+"/"+departurearray[1]+"/"+departurearray[2] var beginDate = new Date(arrivalarray.join("/")); // Begin Date var endDate = new Date(departurearray.join("/")); // End Date var todayDate = new Date('5/10/2008'); // End Date msPerDay = 24 * 60 * 60 * 1000; // Number of milliseconds per day //alert(" begin:" + beginDate + "\n end:" + endDate + "\n today:" + todayDate) if ((Math.round(endDate.getTime()/ msPerDay) - Math.round(beginDate.getTime()/ msPerDay))>28) { msg = msg + "Your stay cannot exceed 28 nights.\n" } if (Math.round(beginDate.getTime()/ msPerDay) < Math.round(todayDate.getTime()/ msPerDay)){ msg = msg + "You entered "+ arrival +". You must enter an arrival date that is at least 5/10/08 or later.\n" } if (Math.round(endDate.getTime()/ msPerDay) <= Math.round(beginDate.getTime()/ msPerDay)){ msg = msg + "You must enter a departure date that is at least one day beyond your arrival date.\n" } if (msg.length > 0){ alert(msg); return false; } if (!checkGuestCapacity(1, 19)){ return false; } if (checkchildrenage() == false) { return false; } return true; } function checkchildrenage(){ var msg; var i; var numberofchildren var agecount = 0; var strChildren = 'children' var strAges = 'ages' var strAges2 = 'ages' var strOnly = 'only ' if (document.quickbook.children.options != null) { numberofchildren = Math.round(document.quickbook.children.options[document.quickbook.children.selectedIndex].value); for (i = 0; i < numberofchildren; i++) { if (document.quickbook.childages[i].value != '') { agecount = agecount + 1 } } for (i = numberofchildren; i < document.quickbook.childages.length; i++) { document.quickbook.childages[i].value = ''; document.quickbook.childfname[i].value = ''; document.quickbook.childlname[i].value = ''; } if (numberofchildren > agecount) { if (numberofchildren==1){strChildren = 'child'; strAges2 = 'age'} if (agecount==1){strAges = 'age'} if (agecount==0){strOnly = ''} msg = 'You have selected ['+ numberofchildren +'] '+ strChildren +' but you '+ strOnly +'have ['+ agecount +'] '+ strAges +' entered.\n\n'; msg = msg + 'You must input the ages in the "Children\'s Ages" popup window.\n\n' msg = msg + 'If you did not see the popup window, you may be running\n'; msg = msg + '"popup blocker" software. You may need to disable it in order\n'; msg = msg + 'to input the '+ strChildren +'\'s '+ strAges2 +'.'; alert (msg); return false; } else { return true; } } else { return true; } } function childrenmodifyages(max){ var numberofchildren = Math.round(document.quickbook.children.options[document.quickbook.children.selectedIndex].value); if (numberofchildren > 0) { childrenchange(max) } else { alert('There must be at least one child in order to modify children\'s ages.') } } function childrenchange(max){ var i; var numberofchildren = Math.round(document.quickbook.children.options[document.quickbook.children.selectedIndex].value); var url = "/childages.popup.asp?num=" + numberofchildren + "&max=" + max if (numberofchildren > 0) { modifyagesbutton(true); for (i = 0; i < document.quickbook.childages.length; i++) { url = url + "&age="+ document.quickbook.childages[i].value } childchangewindow = window.open(url, "childchangewindow", "width=400,height=420, top=90, left=40, resizable=yes,scrollbars=no,toolbar=no"); childchangewindow.focus(); } else { modifyagesbutton(false); for (i = 0; i < document.quickbook.childages.length; i++) { document.quickbook.childages[i].value = ''; document.quickbook.childfname[i].value = ''; document.quickbook.childlname[i].value = ''; } } } function modifyagesbutton(show){ var modifyagesbuttonstr modifyagesbuttonstr = '' if (show) { document.getElementById("childmodage").innerHTML = modifyagesbuttonstr } else { document.getElementById("childmodage").innerHTML.innerHTML = "" } } function checkGuestCapacity(minimumpersons, maximumpersons){ var i; var numberofadults = Math.round(document.quickbook.adults.options[document.quickbook.adults.selectedIndex].value); var numberofchildren = Math.round(document.quickbook.children.options[document.quickbook.children.selectedIndex].value); if ( (numberofadults+numberofchildren)maximumpersons ) { alert("There is a maximum limit of "+ maximumpersons +" guests.\nYou have "+ (numberofadults+numberofchildren) +" guests."); return false; } return true; } //determine if day is valid for month function ValidDay(intMonth,intday,intYear) { intMonth = Math.round(intMonth) intday = Math.round(intday) intYear = Math.round(intYear) if (isNaN(intMonth) || isNaN(intday) || isNaN(intYear)) { // month, day or year is not a number return false; } if (intMonth < 1 || intMonth >12 || intday < 1 || intday >31) { // month or day is out of range return false; } if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) { return false; } if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) { return false; } if (intMonth == 2) { if (intday < 1) { return false; } if (LeapYear(intYear) == true) { if (intday > 29) { return false; } } else { if (intday > 28) { return false; } } } return true; } //determine if year is leapyear function LeapYear(intYear) { if (intYear % 100 == 0) { if (intYear % 400 == 0) { return true; } } else { if ((intYear % 4) == 0) { return true; } } return false; } //Check to make sure there is at least one adult selected function checkAdults(){ if (quickbook.adults.options[quickbook.adults.selectedIndex].value == 0 ){ alert("You must have at least one adult selected."); return false; } return true; } function buildUnitType(sectionValue, displayName, siteID) { this.sectionValue = sectionValue this.displayName = displayName this.siteID = siteID } //Build the unitType selection list based on the siteID selected function buildUnitTypeSel(intSiteID) { var I var J document.forms["quickbook"].unitType.length = 1 if (parseInt(intSiteID) > 0) { for (I = 0; I < arrUnitTypes.length; I++) { if (arrUnitTypes[I].siteID == intSiteID) { J = document.forms["quickbook"].unitType.length //document.forms["quickbook"].unitType.length = J + 1 //document.forms["quickbook"].unitType.options[J].value = arrUnitTypes[I].sectionValue //document.forms["quickbook"].unitType.options[J].text = arrUnitTypes[I].displayName addOption = new Option(arrUnitTypes[I].displayName,arrUnitTypes[I].sectionValue) document.forms["quickbook"].unitType.options[J] = addOption } } var bName = navigator.appName; var bVer = parseFloat(navigator.appVersion); if (bName=="Netscape" && bVer<5) { history.go(0); } } } var arrUnitTypes = new Array(59) //vail unit types arrUnitTypes[0] = new buildUnitType('88##Hotel Accommodations', 'Hotel', '1') arrUnitTypes[1] = new buildUnitType('309##Studio Condominium', 'Studio Condo', '1') arrUnitTypes[2] = new buildUnitType('89##1 Bedroom Condominium', '1 BDR Condo', '1') arrUnitTypes[3] = new buildUnitType('90##2 Bedroom Condominium', '2 BDR Condo', '1') arrUnitTypes[4] = new buildUnitType('91##3 Bedroom Condominium', '3 BDR Condo', '1') arrUnitTypes[5] = new buildUnitType('92##4 Bedroom Condominium', '4 BDR Condo', '1') arrUnitTypes[6] = new buildUnitType('323##Bed and breakfast', 'Bed & Breakfast', '1') arrUnitTypes[7] = new buildUnitType('135##Private Home', 'Private Home', '1') //beavercreek unit types arrUnitTypes[8] = new buildUnitType('88##Hotel Accommodations', 'Hotel', '2') arrUnitTypes[9] = new buildUnitType('309##Studio Condominium', 'Studio Condo', '2') arrUnitTypes[10] = new buildUnitType('89##1 Bedroom Condominium', '1 BDR Condo', '2') arrUnitTypes[11] = new buildUnitType('90##2 Bedroom Condominium', '2 BDR Condo', '2') arrUnitTypes[12] = new buildUnitType('91##3 Bedroom Condominium', '3 BDR Condo', '2') arrUnitTypes[13] = new buildUnitType('92##4 Bedroom Condominium', '4 BDR Condo', '2') arrUnitTypes[14] = new buildUnitType('135##Private Home', 'Private Home', '2') //keystone unit types arrUnitTypes[15] = new buildUnitType('88##Hotel Accommodations', 'Hotel', '3') arrUnitTypes[16] = new buildUnitType('309##Studio Condominium', 'Studio Condo', '3') arrUnitTypes[17] = new buildUnitType('89##1 Bedroom Condominium', '1 BDR Condo', '3') arrUnitTypes[18] = new buildUnitType('90##2 Bedroom Condominium', '2 BDR Condo', '3') arrUnitTypes[19] = new buildUnitType('91##3 Bedroom Condominium', '3 BDR Condo', '3') arrUnitTypes[20] = new buildUnitType('92##4 Bedroom Condominium', '4 BDR Condo', '3') arrUnitTypes[21] = new buildUnitType('323##Bed and breakfast', 'Bed & Breakfast', '3') //breckenridge unit types arrUnitTypes[22] = new buildUnitType('88##Hotel Accommodations', 'Hotel', '4') arrUnitTypes[23] = new buildUnitType('309##Studio Condominium', 'Studio Condo', '4') arrUnitTypes[24] = new buildUnitType('89##1 Bedroom Condominium', '1 BDR Condo', '4') arrUnitTypes[25] = new buildUnitType('90##2 Bedroom Condominium', '2 BDR Condo', '4') arrUnitTypes[26] = new buildUnitType('91##3 Bedroom Condominium', '3 BDR Condo', '4') arrUnitTypes[27] = new buildUnitType('92##4 Bedroom Condominium', '4 BDR Condo', '4') arrUnitTypes[28] = new buildUnitType('133##5 Bedroom Condominium', '5 BDR Condo', '4') arrUnitTypes[29] = new buildUnitType('134##6 Bedroom Condominium', '6 BDR Condo', '4') arrUnitTypes[30] = new buildUnitType('323##Bed and breakfast', 'Bed & Breakfast', '4') arrUnitTypes[31] = new buildUnitType('135##Private Home', 'Private Home', '4') //RMB (Keystone) unit types arrUnitTypes[32] = new buildUnitType('88##Hotel Accommodations', 'Hotel', '5') arrUnitTypes[33] = new buildUnitType('309##Studio Condominium', 'Studio Condo', '5') arrUnitTypes[34] = new buildUnitType('89##1 Bedroom Condominium', '1 BDR Condo', '5') arrUnitTypes[35] = new buildUnitType('90##2 Bedroom Condominium', '2 BDR Condo', '5') arrUnitTypes[36] = new buildUnitType('91##3 Bedroom Condominium', '3 BDR Condo', '5') arrUnitTypes[37] = new buildUnitType('92##4 Bedroom Condominium', '4 BDR Condo', '5') arrUnitTypes[38] = new buildUnitType('323##Bed and breakfast', 'Bed & Breakfast', '5') //VBCRP unit types arrUnitTypes[39] = new buildUnitType('88##Hotel Accommodations', 'Hotel', '6') arrUnitTypes[40] = new buildUnitType('309##Studio Condominium', 'Studio Condo', '6') arrUnitTypes[41] = new buildUnitType('89##1 Bedroom Condominium', '1 BDR Condo', '6') arrUnitTypes[42] = new buildUnitType('90##2 Bedroom Condominium', '2 BDR Condo', '6') arrUnitTypes[43] = new buildUnitType('91##3 Bedroom Condominium', '3 BDR Condo', '6') arrUnitTypes[44] = new buildUnitType('92##4 Bedroom Condominium', '4 BDR Condo', '6') arrUnitTypes[45] = new buildUnitType('135##Private Home', 'Private Home', '6') //blh unit types arrUnitTypes[46] = new buildUnitType('346##Condominiums', 'Condominiums', '7') arrUnitTypes[47] = new buildUnitType('88##Hotel Lodges', 'Hotel Lodges', '7') arrUnitTypes[48] = new buildUnitType('379##Townhomes', 'Townhomes', '7') //VLH unit types arrUnitTypes[49] = new buildUnitType('88##Hotel Accommodations', 'Hotel', '8') arrUnitTypes[50] = new buildUnitType('89##1 Bedroom Condominium', '1 BDR Condo', '8') arrUnitTypes[51] = new buildUnitType('90##2 Bedroom Condominium', '2 BDR Condo', '8') arrUnitTypes[52] = new buildUnitType('91##3 Bedroom Condominium', '3 BDR Condo', '8') //Heavenly unit types arrUnitTypes[53] = new buildUnitType('428##Motel', 'Motel', '9') arrUnitTypes[54] = new buildUnitType('88##Hotel Accommodations', 'Hotel', '9') arrUnitTypes[55] = new buildUnitType('429##Suite Hotel', 'Suite Hotel', '9') arrUnitTypes[56] = new buildUnitType('309##Studio Condominium', 'Studio Condo', '9') arrUnitTypes[57] = new buildUnitType('89##1 Bedroom Condominium', '1 BDR Condo', '9') arrUnitTypes[58] = new buildUnitType('90##2 Bedroom Condominium', '2 BDR Condo', '9') arrUnitTypes[59] = new buildUnitType('91##3 Bedroom Condominium', '3 BDR Condo', '9')