function getToday() { var d = new Date(); var mn = new String(d.getMonth()+1); var dt = new String(d.getDate()); mn = (mn.length==1 ? '0' + mn : mn); dt = (dt.length==1 ? '0' + dt : dt); return (mn + "/" + dt + "/" + d.getYear()); } function isValidDate(dateStr) { var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/; // requires 4 digit year var matchArray = dateStr.match(datePat); // is the format ok? if (matchArray == null) { //alert(dateStr + " Date is not in a valid format.") return false; } month = matchArray[1]; // parse date into variables day = matchArray[3]; year = matchArray[4]; if (month < 1 || month > 12) { // check month range //alert("Month must be between 1 and 12."); return false; } if (day < 1 || day > 31) { //alert("Day must be between 1 and 31."); return false; } if ((month==4 || month==6 || month==9 || month==11) && day==31) { //alert("Month "+month+" doesn't have 31 days!") return false; } if (month == 2) { // check for february 29th var isleap = isLeapYear(year); if (day>29 || (day==29 && !isleap)) { //alert("February " + year + " doesn't have " + day + " days!"); return false; } } return true; } aDaysInMonth = new Array('31', '28', '31', '30', '31', '30', '31', '31', '30', '31', '30', '31'); function isLeapYear (Year) { return (((Year % 4)==0) && ((Year % 100)!=0) || ((Year % 400)==0)) } function addDays(datBaseDate, intNumDaysAhead) { datBaseDate = new Date(datBaseDate); datReturnDate = new Date(); intNumDaysAhead = parseInt(intNumDaysAhead); intYear = datBaseDate.getFullYear(); intMonth = datBaseDate.getMonth(); intDay = datBaseDate.getDate(); if (intMonth == 1) // if Feb, check for leap year aDaysInMonth[1] = isLeapYear(intYear) ? 29 : 28; intDaysInMonth = aDaysInMonth[intMonth]; intDay += intNumDaysAhead; if (intDay > intDaysInMonth) { if (intMonth == 11) { intMonth = 0; intYear++; } else { intMonth++; } intDay -= intDaysInMonth; } // set the appropriate values and return the new date datReturnDate.setFullYear(intYear); datReturnDate.setMonth(intMonth); datReturnDate.setDate(intDay); return (datReturnDate); } function myCalendar(popUpObject,targetField,defaultField,minDate, maxDate){ var d=document.forms[0]; if((defaultField.value=="")||(!checkdate(defaultField.value))) ShowCalendar(popUpObject,targetField,d.timToday_Date,minDate,maxDate); else ShowCalendar(popUpObject,targetField,defaultField,minDate,maxDate); } var g_MINY=1601; var g_MAXY=4500; var g_month=0; var g_day=0; var g_year=0; var g_yLow=1990; function GetInputDate(t,f){ var l=t.length; if(0==l) return false; var cSp='\0'; var sSp1=""; var sSp2=""; for(var i=0;ig_MAXY||m<1||m>12) return false; if(d<1||d>GetMonthCount(m,y)) return false; g_month=m; g_day=d; g_year=y; return true; } function DefYr(m,d){ var dt=new Date(); var yCur=(dt.getYear()<1000)?1900+dt.getYear():dt.getYear(); if(m-1='0'&&c<='9'); } function GetMonthCount(m,y){ var c=rgMC[m-1]; if((2==m)&&IsLeapYear(y)) c++; return c; } function IsLeapYear(y){ if(0==y%4&&((y%100!=0)||(y%400==0))) return true; else return false; } var rgMC=new Array(12); rgMC[0]=31; rgMC[1]=28; rgMC[2]=31; rgMC[3]=30; rgMC[4]=31; rgMC[5]=30; rgMC[6]=31; rgMC[7]=31; rgMC[8]=30; rgMC[9]=31; rgMC[10]=30; rgMC[11]=31; var g_eC=null; var g_eCV=""; var g_dFmt="mmddyy"; var g_fnCB=null; function ShowCalendar(eP,eD,eDP,dmin,dmax,fnCB){ //start here var dF=document.all.CalFrame; var wF=window.frames.CalFrame; if(null==wF.g_fCalLoaded||false==wF.g_fCalLoaded){ alert("Unable to load popup calendar.\r\nPlease reload the page."); return; } dtMin=new Date(); dtMin.setDate(dtMin.getDate()+dmin); dtMax=new Date(); dtMax.setDate(dtMax.getDate()+dmax); wF.SetMinMax(new Date(dtMin),new Date(dtMax)); g_fnCB=fnCB; if(eD==g_eC&&"block"==dF.style.display){ if(g_eCV!=eD.value&&GetInputDate(eD.value,g_dFmt)){ wF.SetInputDate(g_day,g_month,g_year); wF.SetDate(g_day,g_month,g_year); g_eCV=eD.value; } else dF.style.display="none"; }else{ if(GetInputDate(eD.value,g_dFmt)){ wF.SetInputDate(g_day,g_month,g_year); wF.SetDate(g_day,g_month,g_year); } else if(null!=eDP&&GetInputDate(eDP.value,g_dFmt)){ wF.SetInputDate(g_day,g_month,g_year); wF.SetDate(g_day,g_month,g_year); } else{ var dt=new Date(dtMin); wF.SetInputDate(-1,-1,-1); wF.SetDate(dt.getDate(),dt.getMonth()+1,dt.getFullYear()); } var eL=0; var eT=0; var p=eP; while(p&&p.tagName!="BODY"){ eT+=p.offsetTop; eL+=p.offsetLeft; p=p.offsetParent; } var eH=eP.offsetHeight; var dH=dF.style.pixelHeight; var sT=document.body.scrollTop;dF.style.left=eL; if(eT-dH>=sT&&eT+eH+dH>document.body.clientHeight+sT) dF.style.top=eT-dH; else dF.style.top=eT+eH; if("none"==dF.style.display) dF.style.display="block"; g_eC=eD;g_eCV=eD.value; } } function SetDate(d,m,y){ var ds="/"; g_eC.focus(); if(g_dFmt=="mmddyy") g_eC.value=m+ds+d+ds+y; else g_eC.value=d+ds+m+ds+y; g_eCV=g_eC.value; if(null!=g_fnCB&&""!=g_fnCB) eval(g_fnCB); } function GetDowStart(){ return 0; } function GetDOW2(d,m,y){ var dt=new Date(y,m-1,d); return(dt.getDay()+(7-GetDowStart()))%7; } function LoadMonths(n){ var dt=new Date(); var m=dt.getMonth()+1; var y=dt.getFullYear(); var rg=new Array(n); for(i=0;i-1 && this.dom)?1:0; this.ie4=(document.all && !this.dom)?1:0; this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0; this.ns4=(document.layers && !this.dom)?1:0; this.bVer=(this.ie5 || this.ie4 || this.ns4 || this.ns5); return this; } bVer=new chkBrowser(); ns4 = (document.layers)? true:false; ie4 = (document.all)? true:false; function AttB(f){ if(bVer.ie4)f.style.display='block'; } function AttN(f){ if(bVer.ie4)f.style.display='none'; } function show(idLayer,idParent){ cLayer=bVer.dom?document.getElementById(idLayer).style:bVer.ie4?document.all[idLayer].style:bVer.ns4?idParent?document[idParent].document[idLayer]:document[idLayer]:0; cLayer.display='block'; divLinksForm=(ns4)?document.divLinks.document.divLinks:document.divLinks; var d=document.forms[0]; if (idLayer=='pac'){ d.srch[3].status='true'; } else if (idLayer=='car'){ AttB(d.CKind); AttB(d.Ctime1); AttB(d.Ctime2); d.srch[2].status='true'; } else if (idLayer=='hot') { AttB(d.Hcadt); AttB(d.Hckid); d.srch[1].status='true'; } else if (idLayer=='flt') { AttB(d.FcAdu); d.srch[0].status='true'; } else if (idLayer=='hotopts') { d.srch[1].status='true'; } else if (idLayer=='caropts') { d.srch[2].status='true'; } else if (idLayer=='pacopts') { d.srch[3].status='true'; } else { d.srch[0].status='true'; } } function hide(idLayer,idParent){ cLayer=bVer.dom?document.getElementById(idLayer).style:bVer.ie4?document.all[idLayer].style:bVer.ns4?idParent?document[idParent].document[idLayer]:document[idLayer]:0; var d=document.forms[0]; if(idLayer!='flt') AttN(d.FcAdu); AttN(d.Hcadt); AttN(d.Hckid); AttN(d.CKind); AttN(d.Ctime1); AttN(d.Ctime2); cLayer.display='none' } function checkdate(inTime){ var err=0 var psj=0; if ((inTime.length > 10)||(inTime.length < 6))err=1 month=inTime.substring(0, inTime.indexOf("/"))// month slash1=inTime.substring(inTime.indexOf("/"),inTime.indexOf("/")+1)// '/' day=inTime.substring(inTime.indexOf("/")+1,inTime.lastIndexOf("/"))// day slash2=inTime.substring(inTime.lastIndexOf("/"), inTime.lastIndexOf("/")+1)// '/' tempYear=inTime.substring(inTime.lastIndexOf("/")+1)// year if((tempYear.length>4)||(tempYear.length<2))err=1 if(tempYear.length==4) year=tempYear.substring(2); else year=tempYear; if (month<1 || month>12) err = 1 if (month.length>2) err=1 if (slash1 != '/') err = 1 if (day<1 || day>31) err = 1 if (day.length>2) err=1 if (slash2 != '/') err = 1 if (year<0 || year>99) err = 1 if (month==4 || month==6 || month==9 || month==11){ if (month==31) err=1 } if (month==2){ // feb var g=parseInt(year/4) if (isNaN(g)) { err=1 } if (day>29) err=1 if (day==29 && ((year/4)!=parseInt(year/4))) err=1 } if (err==1){ return false; } else{ return true; } } //New pop-up calendar - Ron Jarvis 1st edition - May 2001 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* /* Revision History: 5/17/2001 - REJ - Specifed pop-up window height/width as variables. Added code to prevent pop-up window from being displayed outside screen. If the coordinates exceed the screen width/height the event coordinates are adjusted appropriately to display the calendar within the screen boundaries. 5/18/2001 - REJ - Added specific path (computed) to config. db for display of gifs. Since domino references views as part of base ref, the icons are not displayed properly without this information. */ var weekend = [0,6]; var gNow = new Date(); var ggWinCal; isNav = (navigator.appName.indexOf("Netscape") != -1) ? true : false; isIE = (navigator.appName.indexOf("Microsoft") != -1) ? true : false; var gCurMM = new String(gNow.getMonth()); var gCurYYYY = new String(gNow.getFullYear().toString()); var gCfgPathFile= '/c_dir/chempdb.nsf' Calendar.Months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; // Non-Leap year Month days.. Calendar.DOMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; // Leap year Month days.. Calendar.lDOMonth = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; function Calendar(p_item, p_WinCal, p_month, p_year, p_format) { 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; } this.gYear = p_year; this.gFormat = p_format; this.gReturnItem = p_item; } Calendar.get_month = Calendar_get_month; Calendar.get_daysofmonth = Calendar_get_daysofmonth; Calendar.calc_month_year = Calendar_calc_month_year; Calendar.print = Calendar_print; function Calendar_get_month(monthNo) { return Calendar.Months[monthNo]; } 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]; } else 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) - 1; } else { ret_arr[0] = parseInt(p_Month) - 1; ret_arr[1] = parseInt(p_Year); } } 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) + 1; } else { ret_arr[0] = parseInt(p_Month) + 1; ret_arr[1] = parseInt(p_Year); } } return ret_arr; } function Calendar_print() { ggWinCal.print(); } 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) - 1; } else { ret_arr[0] = parseInt(p_Month) - 1; ret_arr[1] = parseInt(p_Year); } } 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) + 1; } else { ret_arr[0] = parseInt(p_Month) + 1; ret_arr[1] = parseInt(p_Year); } } return ret_arr; } // 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.show = function() { var vCode = ""; this.gWinCal.document.open(); // Setup the page... this.wwrite(''); this.wwrite("Calendar"); this.wwrite(''); this.wwrite(""); this.wwrite(''); this.wwriteA('
'); // 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]; //Use the first row to add hotspot to jump to current date. this.wwrite(''); this.wwrite(''); this.wwrite(''); this.wwrite(''); //Hotspot for back 1 month this.wwrite(''); //Write the Month name this.wwriteA(''); //Hotspot for forward 1 month this.wwrite(''); //Hotspot for back 1 year this.wwrite(''); //Hotspot - Jump to today this.wwrite(''); //Hotspot - forward 1 year this.wwrite('
   
<\/A>' + this.gMonthName + " " + this.gYear + '<\/A>
<\/A>Jump to Today<\/A><\/A>
'); // Get the complete calendar code for the month.. vCode = this.getMonthlyCalendarCode(); this.wwrite(vCode); this.wwrite("
"); this.gWinCal.document.close(); } 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 (isNav) vym = 25; this.gWinCal.document.open(); this.wwrite(""); this.wwrite("Calendar"); this.wwrite(""); this.wwrite(""); this.wwrite(''); this.wwrite("Year : " + this.gYear); this.wwrite('
'); // Show navigation buttons var prevYYYY = parseInt(this.gYear) - 1; var nextYYYY = parseInt(this.gYear) + 1; this.wwrite(''); this.wwrite(''); this.wwrite('
<<<\/A>"); this.wwrite('Print>><\/A>

"); // Get the complete calendar code for each month.. var j; for (i=11; i>=0; i--) { if (isIE) this.wwrite("
"); else if (isNav) this.wwrite(""); this.gMonth = i; this.gMonthName = Calendar.get_month(this.gMonth); vCode = this.getMonthlyCalendarCode(); this.wwrite(this.gMonthName + "/" + this.gYear + "
"); this.wwrite(vCode); if (isIE) this.wwrite("
"); else if (isNav) this.wwrite(""); } this.wwrite("
"); this.gWinCal.document.close(); } Calendar.prototype.wwrite = function(wtext) { this.gWinCal.document.writeln(wtext); } Calendar.prototype.wwriteA = function(wtext) { this.gWinCal.document.write(wtext); } Calendar.prototype.cal_header = function() { var vCode = ""; vCode = vCode + ""; vCode = vCode + 'Sun'; vCode = vCode + 'Mon'; vCode = vCode + 'Tue'; vCode = vCode + 'Wed'; vCode = vCode + 'Thu'; vCode = vCode + 'Fri'; vCode = vCode + 'Sat'; vCode = vCode + ''; return vCode; } Calendar.prototype.cal_data = function() { var vDate = new Date(); vDate.setDate(1); vDate.setMonth(this.gMonth); vDate.setFullYear(this.gYear); var vFirstDay=vDate.getDay(); var vDay=1; var vLastDay=Calendar.get_daysofmonth(this.gMonth, this.gYear); var vOnLastDay=0; var vCode = ""; /* Get day for the 1st of the requested month/year.. Place as many blank cells before the 1st day of the month as necessary. */ vCode = vCode + ''; for (i=0; i'; } // Write rest of the 1st week for (j=vFirstDay; j<7; j++) { vCode = vCode + ' " + this.format_day(vDay) + "" + ""; vDay=vDay + 1; } vCode = vCode + ''; // Write the rest of the weeks for (k=2; k<7; k++) { vCode = vCode + ''; for (j=0; j<7; j++) { vCode = vCode + ' " + this.format_day(vDay) + "" + ""; vDay=vDay + 1; if (vDay > vLastDay) { vOnLastDay = 1; break; } } if (j == 6) vCode = vCode + ''; if (vOnLastDay == 1) break; } // Fill up the rest of last week with proper blanks, so that we get proper square blocks for (m=1; m<(7-j); m++) { if (this.gYearly) vCode = vCode + ''; else vCode = vCode + '' + m + ''; } return vCode; } Calendar.prototype.format_day = function(vday) { var vNowDay = gNow.getDate(); var vNowMonth = gNow.getMonth(); var vNowYear = gNow.getFullYear(); if (vday == vNowDay && this.gMonth == vNowMonth && this.gYear == vNowYear) return ("" + vday + ""); else return (vday); } Calendar.prototype.write_weekend_string = function(vday) { var i; // Return special formatting for the weekend day. // Need to work on this to get it to work with the CSS. for (i=0; i screen.width) { p_left = p_left - calWidth; } } if (arguments[5] == "" || arguments[5] == null) p_top = 200; else { p_top = arguments[5]; if (p_top + calHeight > screen.height) { p_top = p_top - calHeight; } } var winParms = "width=" + calWidth + ",height=" + calHeight + ",status=no,resizable=no,top=" + p_top + ",left=" + p_left; vWinCal = window.open("", "Calendar", winParms); vWinCal.opener = self; vWinCal.focus(); ggWinCal = vWinCal; Build(p_item, p_month, p_year, p_format); } /* Yearly Calendar Code Starts here */ function show_yearly_calendar(p_item, p_year, p_format, p_top, p_left) { // Load the defaults.. if (p_year == null || p_year == "") p_year = new String(gNow.getFullYear().toString()); if (p_format == null || p_format == "") p_format = "MM/DD/YYYY"; var vWinCal = window.open("", "Calendar", "scrollbars=yes"); vWinCal.opener = self; ggWinCal = vWinCal; Build(p_item, null, p_year, p_format); } //End New Pop-up Calendar *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*