var now = new Date(); var today = new Date(); now = new Date (now.getFullYear(),now.getMonth(),now.getDate(),0,0,0); var now_year = now.getFullYear(); var now_month = now.getMonth(); var now_date = now.getDate(); var tommorrow = new Date (now_year,now_month,now_date+1,0,0,0); var tommorrow_year = tommorrow.getFullYear(); var tommorrow_month = tommorrow.getMonth(); var tommorrow_date = tommorrow.getDate(); tommorrow_month += 1; now_month +=1; var next_year=now_year+1; function inc_fast_booking_checkform(theformname) { var inputday; var inputday2; var theform; eval("theform = document."+theformname+";"); inputday= new Date(theform.year.value,theform.mon.value - 1,theform.day.value); inputday2= new Date(theform.year2.value,theform.mon2.value - 1,theform.day2.value); if(inputday.getTime() >= inputday2.getTime()) { alert("退房日期 <= 入住日期"); return false; } if(inputday.getTime() < now.getTime()) { alert("入住日期 <= 今天"); return false; } if((theform.hotel_id.value=="")|| (theform.hotel_id.value==0)) { alert("選擇飯店"); return false; } theform.inputday.value=theform.year.value+"/"+theform.mon.value+"/"+theform.day.value; theform.inputday2.value=theform.year2.value+"/"+theform.mon2.value+"/"+theform.day2.value; theform.hotelid.value=theform.hotel_id.value; return true; } function inc_fast_booking_SetToday(theformname) { var theform; eval("theform = document."+theformname+";"); theform.year.length=2; theform.year2.length=2; theform.year.options[0].text = now_year; theform.year.options[0].value = now_year; theform.year.options[1].text = next_year; theform.year.options[1].value = next_year; theform.year2.options[0].text = now_year; theform.year2.options[0].value = now_year; theform.year2.options[1].text = next_year; theform.year2.options[1].value = next_year; theform.mon.length=12; theform.mon2.length=12; for(i=0;i<12;i++) { theform.mon.options[i].text = i+1; theform.mon.options[i].value = i+1; theform.mon2.options[i].text = i+1; theform.mon2.options[i].value = i+1; } theform.day.length=31; theform.day2.length=31; for(i=0;i<31;i++) { theform.day.options[i].text = i+1; theform.day.options[i].value = i+1; theform.day2.options[i].text = i+1; theform.day2.options[i].value = i+1; } if(theform.roomcount != null) { theform.roomcount.length=10; for(i=0; i < theform.roomcount.length; i++) { theform.roomcount.options[i].text = i+1; theform.roomcount.options[i].value = i+1; } } theform.year.value=now_year; theform.mon.value=now_month; theform.day.value=now_date; theform.year2.value=tommorrow_year; theform.mon2.value=tommorrow_month; theform.day2.value=tommorrow_date; } function inc_fast_booking_showcalendar(type,year,month,theformname,c1,c2,d1,d2) { var theform; eval("theform = document."+theformname+";"); if(year==0) { year=now_year; month=now_month; } var monstartday = new Date(year,month-1,1); var monendday = new Date(year,month,0); var thisid,monthstr,datetypestr,startday; if(type==1) { thisid=c1; datetypestr="入住日期"; } else { thisid=c2; datetypestr="退房日期"; } year=monstartday.getFullYear(); month=monstartday.getMonth()+1; startday=monstartday.getDay(); monthstr=""; monthstr+=""; monthstr+=""; monthstr+="
"; monthstr+=""+datetypestr+""; monthstr+=" 關 閉
上個月"; monthstr+=""+year+" / "+(month)+""; monthstr+="下個月
"; monthstr+=""; monthstr+=""; monthstr+=""; monthstr+=""; monthstr+=""; monthstr+=""; monthstr+=""; for(i=0;i"; else if((year>today.getFullYear())||(year==today.getFullYear() && month>today.getMonth()+1)||(year==today.getFullYear() && month==today.getMonth()+1 && (i+1) > today.getDate())) { monthstr+=""+(i+1)+""; } else { monthstr+=""+(i+1)+""; } if((startday+1)%7==0) monthstr+="
"; startday++; } monthstr+="
"; document.getElementById(c1).style.display='none'; //document.getElementById(c2).style.display='none'; document.getElementById(d1).style.display='none'; //document.getElementById(d2).style.display='none'; if(type==1) { document.getElementById(d1).style.display=''; } else { //document.getElementById(d2).style.display=''; } eval(thisid+".style.display=''"); eval(thisid+".innerHTML=''"); eval(thisid+".innerHTML=\""+monthstr+"\""); } function inc_fast_booking_showcalendar2(type,year,month,theformname,c1,c2,d1,d2) { var theform=document.getElementById(theformname); if(year==0) { year=now_year; month=now_month; } var monstartday = new Date(year,month-1,1); var monendday = new Date(year,month,0); var thisid,monthstr,datetypestr,startday; if(type==1) { thisid=c1; datetypestr="入住日期"; } else { thisid=c2; datetypestr="退房日期"; } year=monstartday.getFullYear(); month=monstartday.getMonth()+1; startday=monstartday.getDay(); monthstr=""; monthstr+=""; monthstr+=""; monthstr+="
"; monthstr+=""+datetypestr+""; monthstr+=" 關 閉
上個月"; monthstr+=""+year+" / "+(month)+""; monthstr+="下個月
"; monthstr+=""; monthstr+=""; monthstr+=""; monthstr+=""; monthstr+=""; monthstr+=""; monthstr+=""; for(i=0;i"; else if((year>today.getFullYear())||(year==today.getFullYear() && month>today.getMonth()+1)||(year==today.getFullYear() && month==today.getMonth()+1 && (i+1) > today.getDate())) { monthstr+=""+(i+1)+""; } else { monthstr+=""+(i+1)+""; } if((startday+1)%7==0) monthstr+="
"; startday++; } monthstr+="
"; document.getElementById(c1).style.display='none'; //document.getElementById(c2).style.display='none'; document.getElementById(d1).style.display='none'; //document.getElementById(d2).style.display='none'; if(type==1) { eval("document.getElementById('"+d1+"').style.display=''"); } else { //eval("document.getElementById('"+d2+"').style.display=''"); } eval(thisid+".style.display=''"); eval(thisid+".innerHTML=''"); eval(thisid+".innerHTML=\""+monthstr+"\""); } function inc_fast_booking_setorderdate(type,year,month,date,theformname,c1,c2,d1,d2) { var theform = document.getElementById(theformname); if(type==1) { theform.year.value=year; theform.mon.value=month; theform.day.value=date; //inc_fast_booking_showcalendar(2,year,month,theformname,c1,c2,d1,d2); document.getElementById(c1).style.display='none'; document.getElementById(d1).style.display='none'; } else { theform.year2.value=year; theform.mon2.value=month; theform.day2.value=date; eval(c2+".style.display='none';"); eval("document.getElementById('"+d2+"').style.display='none';"); } if(window.adjust) { adjust.set(); } } function inc_fast_booking_setorderdate2(type,year,month,date,theformname,c1,c2,d1,d2) { var theform = document.getElementById(theformname); var nights=parseInt(document.getElementById('fb_nights').value,10); //eval("theform = document."+theformname+";"); var day1=new Date(year,parseInt(month,10)-1,parseInt(date,10),23,0,0,0); var day2=new Date(year,parseInt(month,10)-1,parseInt(date,10)+nights,23,0,0,0); //var day2=new Date(theform.year2.value,parseInt(theform.mon2.value,10)-1,theform.day2.value); document.getElementById('fb_checkout').innerHTML=day2.getFullYear()+'-'+(day2.getMonth()+1)+'-'+day2.getDate(); if(type==1) { theform.year.value=year; theform.mon.value=month; theform.day.value=date; if(day1.getTime()>day2.getTime()){ day2=new Date(year,parseInt(month,10)-1,date+1); theform.year2.value=day2.getFullYear(); theform.mon2.value=day2.getMonth()+1; theform.day2.value=day2.getDate(); } eval(c1+".style.display='none';"); eval("document.getElementById('"+d1+"').style.display='none';"); } else { theform.year2.value=year; theform.mon2.value=month; theform.day2.value=date; eval(c2+".style.display='none';"); eval("document.getElementById('"+d2+"').style.display='none';"); } } function inc_fast_booking_closcalendar(type,c1,c2,d1,d2) { if(type==1) { eval("document.getElementById('"+c1+"').style.display='none'"); eval("document.getElementById('"+d1+"').style.display='none'"); } else { eval("document.getElementById('"+c2+"').style.display='none'"); eval("document.getElementById('"+d2+"').style.display='none'"); } }