function checkDates(form) { inday = form.inday[form.inday.selectedIndex].value; inmonth = form.inmonth[form.inmonth.selectedIndex].value; inyear = form.inyear[form.inyear.selectedIndex].value; outday = form.outday[form.outday.selectedIndex].value; outmonth = form.outmonth[form.outmonth.selectedIndex].value; outyear = form.outyear[form.outyear.selectedIndex].value; d1 = new Date(inyear,inmonth-1,inday); d2 = new Date(inyear,inmonth-1,1); d3 = new Date(outyear,outmonth-1,outday); d4 = new Date(); d5 = new Date(d4.getFullYear(),d4.getMonth(),d4.getDate());
message = “”; window.status = outyear + “-” + outmonth + “-” + outday + ” = ” + d3; if (d1.getMonth() != d2.getMonth()) { message += “* Your check-in date is not valid.\n”; } if (d1.getTime() >= d3.getTime()) { message += “* Your check-out date must not be the same, or before your check-in date.\n”; } if (d1.getTime() < d5.getTime()) { message += "* Your check-in date may not be before today.\n"; } if (message.length > 0) { alert(“Please address the following errors:\n” + message); return false; } return true; } function doSO(f,tV,tF){for(i=0;i
{
f.inyear.selectedIndex =1;
f.outyear.selectedIndex =1;
}
else
{
f.inyear.selectedIndex =0;
f.outyear.selectedIndex =0;
}
thisdate = new Date(f.inyear[f.inyear.selectedIndex].value, f.inmonth[f.inmonth.selectedIndex].value-1, f.inday[f.inday.selectedIndex].value); msecs = (thisdate-0); twoday = new Date(msecs+(86400000*2)); im = thisdate.getMonth()+1; id = thisdate.getDate(); iy = thisdate.getFullYear(); om = twoday.getMonth()+1; od = twoday.getDate(); oy = twoday.getFullYear(); doSO(f,im,”inmonth”); doSO(f,id,”inday”); doSO(f,iy,”inyear”); doSO(f,om,”outmonth”); doSO(f,od,”outday”); doSO(f,oy,”outyear”); }
function initializeDates(f) { thisdate = new Date();
thisdate = new Date(thisdate.getFullYear(),thisdate.getMonth(),thisdate.getDate());
msecs = (thisdate-0);
oneday = new Date(msecs+86400000*1); twoday = new Date(msecs+(86400000*3));
im = oneday.getMonth()+1;
id = oneday.getDate();
iy = oneday.getFullYear();
var idatevalue = (im < 9 ? '0' : '') + (im) + "/" + (id < 10 ? '0' : '') + id + "/" + iy; om = twoday.getMonth()+1; od = twoday.getDate(); oy = twoday.getFullYear(); var odatevalue = (om < 9 ? '0' : '') + (om) + "/" + (od < 10 ? '0' : '') + od + "/" + oy; doSO(f,im,"inmonth"); doSO(f,id,"inday"); doSO(f,iy,"inyear"); doSO(f,om,"outmonth"); doSO(f,od,"outday"); doSO(f,oy,"outyear"); temponload(); } function lvdinit() { if (document.tv) { initializeDates(document.tv); } if (document.th) {initializeDates(document.th);} } temponload = (window.onload) ? window.onload : new Function; window.onload=lvdinit;