function initStrCal () { isSecure = 0; monthName = new Array(12); monthName[1] = "January"; monthName[2] = "February"; monthName[3] = "March"; monthName[4] = "April"; monthName[5] = "May"; monthName[6] = "June"; monthName[7] = "Juli"; monthName[8] = "August"; monthName[9] = "September"; monthName[10] = "October"; monthName[11] = "November"; monthName[12] = "December"; dayName = new Array(7); dayName[1] = "So"; dayName[2] = "Mo"; dayName[3] = "Lu"; dayName[4] = "Me"; dayName[5] = "Th"; dayName[6] = "Fr"; dayName[7] = "Sa"; } // Calendar global declarations and initialization function init () { initStrCal(); msPerDay = 24*60*60*1000; today = new Date(); currDay = today.getDate(); currMonth = today.getMonth(); currYear = today.getYear(); if (currYear < 1000) currYear += 1900; today = new Date(currYear, currMonth, currDay); nextYear = new Date(currYear, currMonth, currDay); nextYear.setTime (nextYear.getTime() + 365*msPerDay); // Get the date that is selected on the pull down menus if any. var d; var m; var y; eval("d=document.forms['" + formName + "']." + dayFld + ".selectedIndex"); eval("m=document.forms['" + formName + "']." + monthFld + ".selectedIndex"); eval("y=document.forms['" + formName + "']." + yearFld + ".selectedIndex"); if (d == 0 && m == 0 && y == 0) displayMonth = currMonth; else { if (d == 0) d = 1; // set defaults if (m == 0) m = 1; if (y == 0) y = currYear; else y = currYear + y - 1; // translate year index */ var tempDate = new Date (y, m - 1, d); if (tempDate.getTime() < today.getTime()) { tempDate.setTime(today.getTime()); } else if (tempDate.getTime() >= nextYear.getTime()) { tempDate.setTime(nextYear.getTime() - msPerDay); } displayMonth = tempDate.getMonth(); var displayYear = tempDate.getYear(); if (displayYear < 1000) displayYear += 1900; tempDate = new Date(displayYear, displayMonth + 1, 1); if (tempDate.getTime() >= nextYear.getTime()) { displayMonth -= 1; } if (displayYear > currYear) displayMonth += 12; } calendarWinOpen = false; calendarWindow = null; } // Calendar main entry point function popUpCalendar (dayFldName, monthFldName, yearFldName, formFldName) { dayFld = dayFldName; monthFld = monthFldName; yearFld = yearFldName; formName = formFldName; init(); var windowOptions = "toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,copyhistory=yes,width=525,height=320"; calendarWindow = this.open("","calendarWindow",windowOptions); calendarWindow.callingForm = this; calendarWinOpen = true; redrawCalendar(); } // repaint the calendar function redrawCalendar() { calendarWindow.callingForm = this; calendarWindow.document.open(); calendarWindow.document.write("Calender"); var firstOfMonth = new Date(currYear, displayMonth, 1); drawCalendar(firstOfMonth); calendarWindow.document.write(htmlBuffer); calendarWindow.document.close(); calendarWindow.callingForm = this; calendarWindow.focus(); } // fill the calling forms date and month function fillDate(returnDay, returnMonth, returnYear) { var d = returnDay; var m = returnMonth; var y = returnYear; eval("document.forms['" + formName + "']." + dayFld + ".selectedIndex=" + d); eval("document.forms['" + formName + "']." + monthFld + ".selectedIndex=" + m); eval("document.forms['" + formName + "']." + yearFld + ".selectedIndex=" + y); calendarWindow.close(); calendarWinOpen = false; } // set the month function changeMonth (increment) { var nextMonth = displayMonth; if (increment == 1) nextMonth++ ; else nextMonth-- ; if ((nextMonth - currMonth >= 13) || (nextMonth < currMonth)) { nextMonth = currMonth; } displayMonth = nextMonth; redrawCalendar(); } // generate the calendar document function drawCalendar (theDate) { var y = theDate.getYear(); if (y < 1000) y += 1900; var monthNum = theDate.getMonth(); var nextDate = new Date(y, monthNum + 1, 1); htmlBuffer = ""; htmlBuffer += ""; htmlBuffer += "

Please select the date of your checkin in the Hotel Anker:

"; htmlBuffer += ""; htmlBuffer += "
"; drawOneMonth(theDate); htmlBuffer += ""; drawOneMonth(nextDate); htmlBuffer += "
"; // Get the last day of the month before the first month we drew. var tempDate = new Date (y, monthNum, 1); tempDate.setTime(tempDate.getTime() - msPerDay); if (tempDate.getTime() >= today.getTime()) { htmlBuffer += ""; } htmlBuffer += ""; // Get the first day of the month after the last month we drew. tempDate = new Date (y, monthNum + 2, 1); if (tempDate.getTime() < nextYear.getTime()) { htmlBuffer += ""; } htmlBuffer += "
"; htmlBuffer += "

"; htmlBuffer += "cancel

"; } function drawOneMonth(theDate) { var d; var monthNum = theDate.getMonth(); htmlBuffer += ""; htmlBuffer += ""; htmlBuffer += ""; for (d = 1; d <= 7; d++) { htmlBuffer += ""; } htmlBuffer += ""; drawBody(theDate); htmlBuffer += "
"; htmlBuffer += monthName[monthNum+1]; var dispYear = theDate.getYear(); if (dispYear < 1000) dispYear += 1900; htmlBuffer += " " + dispYear; htmlBuffer += "
" + dayName[d] + "
"; } // generate the calendar body function drawBody (theDate) { var w; var d; var y = theDate.getYear(); if (y < 1000) y += 1900; var myDate = new Date (y, theDate.getMonth(), 1); var monthNum = myDate.getMonth(); firstSunday (myDate); for (w=0; w<6; w++) { htmlBuffer += ""; for (d=0; d<7; d++) { htmlBuffer += ""; if (myDate.getMonth() != monthNum) { // this square on the calendar is not part of the month } else { var date = myDate.getDate(); var date_str; if (date < 10) date_str = "0" + date; else date_str = "" + date; htmlBuffer += " "; if (myDate.getTime() >= today.getTime() && myDate.getTime() < nextYear.getTime()) { // create a link y = (myDate.getYear() - today.getYear()) + 1; var m = myDate.getMonth() + 1; htmlBuffer += "