// IE5.0 fix for Array.push method if (!Array.prototype.push) { Array.prototype.push = function() { for (var i=0; i if ((p_month == null) && (p_year == null)) return; if (p_WinCal == null) this.gWinCal = ggWinCal; else this.gWinCal = p_WinCal; if (p_month == null) { this.gMonthName = null; this.gMonth = null; this.gYearly = true; } else { this.gMonthName = Calendar.get_month(p_month); this.gMonth = new Number(p_month); this.gYearly = false; } if (p_type == null) this.gType = "POPUP"; // Default is popup else this.gType = p_type; if (this.gType == "INLINE") { this.WHO = ""; this.INLINE = "Calendar"; // Inline Calendar Layer name this.codeINLINE = ""; // Calendar code will be constructed in this var } else this.WHO = "window.opener."; this.gYear = p_year; this.gFormat = p_format; this.gBGColor = "white"; this.gFGColor = "black"; this.gTextColor = "black"; this.gHeaderColor = "black"; this.gReturnItem = p_item; this.gTitle = "Intercerve.com Calendar"; // this.gRefreshOnClose = false; this.gParentFormName = ""; } Calendar.get_month = Calendar_get_month; Calendar.get_daysofmonth = Calendar_get_daysofmonth; Calendar.get_dow = Calendar_get_dow; Calendar.calc_month_year = Calendar_calc_month_year; Calendar.print = Calendar_print; Calendar.CreateCalendarLayer = Calendar_CreateCalendarLayer; Calendar.Close = Calendar_Close; Calendar.Lwwrite = Calendar_Lwwrite; Calendar.MoveTo = Calendar_MoveTo; Calendar.isWeekend = Calendar_isWeekend; Calendar.processDateData = Calendar_processDateData; Calendar.readDate = Calendar_readDate; function Calendar_get_month(monthNo, pLanguage) { if (!pLanguage || pLanguage=="E") return Calendar.EMonths[monthNo]; else return Calendar.Months[monthNo]; } function Calendar_get_dow(dayNo) { return Calendar.DOW[dayNo]; } function Calendar_get_daysofmonth(monthNo, p_year) { /* Check for leap year .. 1.Years evenly divisible by four are normally leap years, except for... 2.Years also evenly divisible by 100 are not leap years, except for... 3.Years also evenly divisible by 400 are leap years. */ if ((p_year % 4) == 0) { if ((p_year % 100) == 0 && (p_year % 400) != 0) return Calendar.DOMonth[monthNo]; return Calendar.lDOMonth[monthNo]; } return Calendar.DOMonth[monthNo]; } function Calendar_calc_month_year(p_Month, p_Year, incr) { /* Will return an 1-D array with 1st element being the calculated month and second being the calculated year after applying the month increment/decrement as specified by 'incr' parameter. 'incr' will normally have 1/-1 to navigate thru the months. */ var ret_arr = new Array(); if (incr == -1) { // B A C K W A R D if (p_Month == 0) { ret_arr[0] = 11; ret_arr[1] = parseInt(p_Year, 10) - 1; } else { ret_arr[0] = parseInt(p_Month, 10) - 1; ret_arr[1] = parseInt(p_Year, 10); } } else if (incr == 1) { // F O R W A R D if (p_Month == 11) { ret_arr[0] = 0; ret_arr[1] = parseInt(p_Year, 10) + 1; } else { ret_arr[0] = parseInt(p_Month, 10) + 1; ret_arr[1] = parseInt(p_Year, 10); } } return ret_arr; } function Calendar_print() { ggWinCal.print(); } function Calendar_isWeekend(pday) { var i; for (i=0; i 5) return dateAdd(td, m[4], m[3]); else if (m[1].toUpperCase() == "TODAY") return td; } else { // Read the date in its format return Calendar.readDate(vInputData, pFormat); } } function Calendar_readDate(indt, infmt) { var re = ""; var whoarr = new Array(); whoarr.push("Dummy"); // The split function has problems in IE. // It does not include the separators // specified by the regular expression in the return array. Damn..! // var mach = infmt.split(new RegExp("(DD|MM|MONTH|MON|YYYY|YY|DOW)", "g")); var mach = IESplit(new RegExp("(DD|MM|MONTH|MON|YYYY|YY|DOW)"), infmt); for (i=0; i 50) ? (ytpart + 1900) : (ytpart + 2000)); break; case "YYYY": ypart = parseInt(ma[i], 10); break; } } } if (!(dpart||mpart||ypart)) return null; else return(new Date(mpart+"/"+dpart+"/"+ypart)); } function Calendar_Close(pType, pINLINE) { if (pType == "POPUP") { ggWinCal.close(); } if (pType == "INLINE") Calendar.Lwwrite(Calendar.gInitText, pINLINE) ggWinCal = null; } // This is for compatibility with Navigator 3, we have to create and discard one object before the prototype object exists. new Calendar(); Calendar.prototype.getMonthlyCalendarCode = function() { var vCode = ""; var vHeader_Code = ""; var vData_Code = ""; // Begin Table Drawing code here.. vCode = vCode + ""; vHeader_Code = this.cal_header(); vData_Code = this.cal_data(); vCode = vCode + vHeader_Code + vData_Code; vCode = vCode + "
"; return vCode; } Calendar.prototype.onclickfn = function() { // This should return the code string for the onclickfn in the calendar document. // This is the reference to the return object // window.opener.document. / window.document. ... .value var whois = this.WHO + ((this.gType == "POPUP") ? "document." + v_NSHierarchy : "window.document." + v_NSHierarchy) + this.gReturnItem + ".value"; // apchar will turn out to be either " = " or " += ''" or " += ';'" var apchar = (this.returnMode == "Replace") ? " = " : " += "; var retCode = "apchar = ''" + ((this.returnMode == "Replace") ? ";" : " + ") + "((" + whois + " == '') ? '' : '" + this.appendChar + "');\n" + whois + apchar + "apchar + pday;\n"; return retCode; } Calendar.prototype.showSmartNavBar = function() { var selcalendar = "
"; selcalendar += ""; selcalendar += "\n"; selcalendar += "" + "" + "^" + "
" + "" + "v" + "
"; this.wwrite(selcalendar); } Calendar.prototype.show = function() { var vCode = ""; if (this.gType == "POPUP") this.gWinCal.document.open(); // Setup the page... this.wwrite(""); this.wwrite("Calendar"); if (this.gType == "POPUP") this.wwrite(""); this.wwrite(""); this.wwrite(""); this.wwrite(""); this.wwrite(""); // For Smart navigation if (v_SmartNav == "Yes") this.wwrite("
"); this.wwrite("
" + "" + ""); this.wwrite(""); // Code to let users fix the calendar or let it move this.wwriteA("
" + "" + this.gTitle + "" + "" + "" + "" + "X
"); this.wwriteA(this.gMonthName + " " + this.gYear); this.wwriteA("" + // "Fix" + // "" + "
"); if (v_SmartNav == "Yes") this.showSmartNavBar(); // Show navigation buttons var prevMMYYYY = Calendar.calc_month_year(this.gMonth, this.gYear, -1); var prevMM = prevMMYYYY[0]; var prevYYYY = prevMMYYYY[1]; var nextMMYYYY = Calendar.calc_month_year(this.gMonth, this.gYear, 1); var nextMM = nextMMYYYY[0]; var nextYYYY = nextMMYYYY[1]; if (v_Nav == "Yes") { this.wwrite("
"); this.wwrite("[<<<\/A>]"); this.wwrite("[<<\/A>]"); // this.wwrite("[" + // "Print]"); this.wwrite("[Today<\/A>]"); this.wwrite("[><\/A>]"); this.wwrite("[>><\/A>]
"); } // Get the complete calendar code for the month.. vCode = this.getMonthlyCalendarCode(); this.wwrite(vCode); this.wwrite("
"); // For Smart navigation if (v_SmartNav == "Yes") this.wwrite("
"); this.wwrite(""); if (this.gType == "POPUP") this.gWinCal.document.close(); if (this.gType == "INLINE") Calendar.Lwwrite(this.codeINLINE, this.INLINE); } Calendar.prototype.showY = function() { var vCode = ""; var i; var vr, vc, vx, vy; // Row, Column, X-coord, Y-coord var vxf = 285; // X-Factor var vyf = 200; // Y-Factor var vxm = 10; // X-margin var vym; // Y-margin if (isIE) vym = 75; else if (isDOM) vym = 25; else if (isNav) vym = 25; this.gWinCal.document.open(); this.wwrite(""); this.wwrite("Calendar"); this.wwrite(""); this.wwrite(""); this.wwrite(""); if (this.gType == "POPUP") this.wwrite("