var months = new Array('January','February','March','April', 'May','June','July','August','September', 'October','November','December'); function doCalcNumNight(obj){ var oForm =document.resvForm; var strInDay = oForm.inday.value; var strInMonth = getMonthDigit(oForm.inmonth.value); var strInYear = oForm.inyear.value; var strOutDay = oForm.outday.value; var strOutMonth = getMonthDigit(oForm.outmonth.value); var strOutYear = oForm.outyear.value; if ( (!isDate(strInYear,strInMonth,strInDay)) || (!isDate(strOutYear,strOutMonth,strOutDay)) ){ oForm.nights.value=0; return false; }else if( !isDateLessThan(new Date(strInYear,strInMonth-1,strInDay),new Date(strOutYear,strOutMonth-1,strOutDay))) { oForm.nights.value=0; return false; }else{ oForm.nights.value =daysElapsed(new Date(strOutYear,strOutMonth-1,strOutDay),new Date(strInYear,strInMonth-1,strInDay)); return true; } } function doCalcOutDate(forceNumNight){ var oForm =document.resvForm; if(!oForm.nights){ //if undefined; return false; } var strText = oForm.nights.value; var strInDay = oForm.inday.value; var strInMonth = getMonthDigit(oForm.inmonth.value); var strInYear = oForm.inyear.value; if (!!forceNumNight){ oForm.nights.value =forceNumNight; } if ( !isNumeric(oForm.nights) ){ alert("The Number of Nights field must be a number. \nPlease re-enter."); //oForm.nights.value=3; oForm.nights.select(); oForm.nights.focus(); return false; }else if (!isDate(strInYear,strInMonth,strInDay)) { alert("Invalid Check in Date"); return false; }else{ var oDate = new Date(addDays(new Date(strInYear,strInMonth-1,strInDay),oForm.nights.value)); oForm.outday.value = oDate.getDate(); oForm.outmonth.value = months[oDate.getMonth()].substring(0,3); oForm.outyear.value = oDate.getYear(); return true; } } function onlyNumber(){ strKey = window.event.keyCode alert(strKey); if (strKey < 48 || strKey > 57) {window.event.keyCode = null;} } function test(e){ var charCode = (navigator.appName=="Netscape") ? e.which : e.keyCode; //alert(charCode); if (charCode==13){ //doSubmit(); //return false; //}else{ //return true; } } function isNumeric(obj){ for (var i=0; i 45) ){ alert("Number of Nights must be between 1 and 45. Maximum Number of Nights allowed is 45.\nFor stays of longer than 45 days, please contact our Customer Service Agents."); //oForm.nights.focus(); return false; }else if(parseInt(oForm.NoRm.value) > parseInt(oForm.noAdult.value)){ alert('You must have at least one adult per room. Please change your number of rooms or adults accordingly.'); oForm.NoRm.focus(); return false; }else if((parseInt(oForm.noAdult.value) + parseInt(oForm.noChild.value)) > 20){ alert('Maximum of 20 people is allowed. Please amend the number of adults or children for this booking.'); oForm.noAdult.focus(); return false; }else if(parseInt(oForm.NoExtra.value) > parseInt(oForm.NoRm.value)){ alert("The number of Extra Beds required cannot be greater than the number of rooms requested."); oForm.NoExtra.focus(); return false; } }