var weekend=[0,6];var weekendColor="#e0e0e0";var fontface="Verdana";var fontsize=2;var gNow=new Date();var ggWinCal;isNav=(navigator.appName.indexOf("Netscape")!=-1)?true:false;isIE=(navigator.appName.indexOf("Microsoft")!=-1)?true:false;Calendar.Months=["January","February","March","April","May","June","July","August","September","October","November","December"];Calendar.DOMonth=[31,28,31,30,31,30,31,31,30,31,30,31];Calendar.lDOMonth=[31,29,31,30,31,30,31,31,30,31,30,31];function Calendar(d,e,a,c,b){if((a==null)&&(c==null)){return}if(e==null){this.gWinCal=ggWinCal}else{this.gWinCal=e}if(a==null){this.gMonthName=null;this.gMonth=null;this.gYearly=true}else{this.gMonthName=Calendar.get_month(a);this.gMonth=new Number(a);this.gYearly=false}this.gYear=c;this.gFormat=b;this.gBGColor="white";this.gFGColor="black";this.gTextColor="black";this.gHeaderColor="black";this.gReturnItem=d}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(a){return Calendar.Months[a]}function Calendar_get_daysofmonth(b,a){if((a%4)==0){if((a%100)==0&&(a%400)!=0){return Calendar.DOMonth[b]}return Calendar.lDOMonth[b]}else{return Calendar.DOMonth[b]}}function Calendar_calc_month_year(b,a,d){var c=new Array();if(d==-1){if(b==0){c[0]=11;c[1]=parseInt(a)-1}else{c[0]=parseInt(b)-1;c[1]=parseInt(a)}}else{if(d==1){if(b==11){c[0]=0;c[1]=parseInt(a)+1}else{c[0]=parseInt(b)+1;c[1]=parseInt(a)}}}return c}function Calendar_print(){ggWinCal.print()}function Calendar_calc_month_year(b,a,d){var c=new Array();if(d==-1){if(b==0){c[0]=11;c[1]=parseInt(a)-1}else{c[0]=parseInt(b)-1;c[1]=parseInt(a)}}else{if(d==1){if(b==11){c[0]=0;c[1]=parseInt(a)+1}else{c[0]=parseInt(b)+1;c[1]=parseInt(a)}}}return c}new Calendar();Calendar.prototype.getMonthlyCalendarCode=function(){var b="";var c="";var a="";b=b+'<TABLE BORDER=1 BGCOLOR="'+this.gBGColor+'">';c=this.cal_header();a=this.cal_data();b=b+c+a;b=b+"</TABLE>";return b};Calendar.prototype.show=function(){var g="";this.gWinCal.document.open();this.wwrite("<html>");this.wwrite("<head><title>Date Picker: APECS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</title>");this.wwrite("</head>");this.wwrite("<script language='javascript'>");this.wwrite("function ufTriggerChangeEvent(asOrigDate, asNewDate)");this.wwrite("{");this.wwrite("	if (asOrigDate != asNewDate)");this.wwrite("	{");if(navigator.appName!="Netscape"){this.wwrite("		window.opener."+p_item+".fireEvent('onchange');")}else{this.wwrite("       var evt = opener.document.createEvent('HTMLEvents'); ");this.wwrite("       evt.initEvent('change',true,true);  ");this.wwrite("       window.opener."+p_item+".dispatchEvent( evt );  ")}this.wwrite("	}");this.wwrite("}");this.wwrite("<\/script>");this.wwrite('<body onBlur=self.focus() link="'+this.gLinkColor+'" vlink="'+this.gLinkColor+'" alink="'+this.gLinkColor+'" text="'+this.gTextColor+'">');this.wwriteA("<FONT FACE='"+fontface+"' SIZE=2><B>");this.wwriteA(this.gMonthName+" "+this.gYear);this.wwriteA("</B><BR>");var e=Calendar.calc_month_year(this.gMonth,this.gYear,-1);var f=e[0];var c=e[1];var b=Calendar.calc_month_year(this.gMonth,this.gYear,1);var d=b[0];var a=b[1];this.wwrite("<TABLE WIDTH='100%' BORDER=1 CELLSPACING=0 CELLPADDING=0 BGCOLOR='#e0e0e0'><TR><TD ALIGN=center>");this.wwrite("[<A HREF=\"javascript:window.opener.Build('"+this.gReturnItem+"', '"+this.gMonth+"', '"+(parseInt(this.gYear)-1)+"', '"+this.gFormat+"');\"><<</A>]</TD><TD ALIGN=center>");this.wwrite("[<A HREF=\"javascript:window.opener.Build('"+this.gReturnItem+"', '"+f+"', '"+c+"', '"+this.gFormat+"');\"><</A>]</TD><TD ALIGN=center>");this.wwrite('[<A HREF="javascript:window.print();">Print</A>]</TD><TD ALIGN=center>');this.wwrite("[<A HREF=\"javascript:window.opener.Build('"+this.gReturnItem+"', '"+d+"', '"+a+"', '"+this.gFormat+"');\">></A>]</TD><TD ALIGN=center>");this.wwrite("[<A HREF=\"javascript:window.opener.Build('"+this.gReturnItem+"', '"+this.gMonth+"', '"+(parseInt(this.gYear)+1)+"', '"+this.gFormat+"');\">>></A>]</TD></TR></TABLE><BR>");g=this.getMonthlyCalendarCode();this.wwrite(g);this.wwrite("</font></body></html>");this.gWinCal.document.close()};Calendar.prototype.showY=function(){var d="";var f;var q,h,n,l;var g=285;var b=200;var c=10;var p;if(isIE){p=75}else{if(isNav){p=25}}this.gWinCal.document.open();this.wwrite("<html>");this.wwrite("<head><title>East Coast: CMS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</title>");this.wwrite("<style type='text/css'>\n<!--");for(f=0;f<12;f++){h=f%3;if(f>=0&&f<=2){q=0}if(f>=3&&f<=5){q=1}if(f>=6&&f<=8){q=2}if(f>=9&&f<=11){q=3}n=parseInt(g*h)+c;l=parseInt(b*q)+p;this.wwrite(".lclass"+f+" {position:absolute;top:"+l+";left:"+n+";}")}this.wwrite("-->\n</style>");this.wwrite("</head>");this.wwrite('<body onBlur=self.focus()link="'+this.gLinkColor+'" vlink="'+this.gLinkColor+'" alink="'+this.gLinkColor+'" text="'+this.gTextColor+'">');this.wwrite("<FONT FACE='"+fontface+"' SIZE=2><B>");this.wwrite("Year : "+this.gYear);this.wwrite("</B><BR>");var o=parseInt(this.gYear)-1;var a=parseInt(this.gYear)+1;this.wwrite("<TABLE WIDTH='100%' BORDER=1 CELLSPACING=0 CELLPADDING=0 BGCOLOR='#e0e0e0'><TR><TD ALIGN=center>");this.wwrite("[<A HREF=\"javascript:window.opener.Build('"+this.gReturnItem+"', null, '"+o+"', '"+this.gFormat+"');\" alt='Prev Year'><<</A>]</TD><TD ALIGN=center>");this.wwrite('[<A HREF="javascript:window.print();">Print</A>]</TD><TD ALIGN=center>');this.wwrite("[<A HREF=\"javascript:window.opener.Build('"+this.gReturnItem+"', null, '"+a+"', '"+this.gFormat+"');\">>></A>]</TD></TR></TABLE><BR>");var e;for(f=11;f>=0;f--){if(isIE){this.wwrite('<DIV ID="layer'+f+'" CLASS="lclass'+f+'">')}else{if(isNav){this.wwrite('<LAYER ID="layer'+f+'" CLASS="lclass'+f+'">')}}this.gMonth=f;this.gMonthName=Calendar.get_month(this.gMonth);d=this.getMonthlyCalendarCode();this.wwrite(this.gMonthName+"/"+this.gYear+"<BR>");this.wwrite(d);if(isIE){this.wwrite("</DIV>")}else{if(isNav){this.wwrite("</LAYER>")}}}this.wwrite("</font><BR></body></html>");this.gWinCal.document.close()};Calendar.prototype.wwrite=function(a){this.gWinCal.document.writeln(a)};Calendar.prototype.wwriteA=function(a){this.gWinCal.document.write(a)};Calendar.prototype.cal_header=function(){var a="";a=a+"<TR>";a=a+"<TD WIDTH='14%'><FONT SIZE='2' FACE='"+fontface+"' COLOR='"+this.gHeaderColor+"'><B>Sun</B></FONT></TD>";a=a+"<TD WIDTH='14%'><FONT SIZE='2' FACE='"+fontface+"' COLOR='"+this.gHeaderColor+"'><B>Mon</B></FONT></TD>";a=a+"<TD WIDTH='14%'><FONT SIZE='2' FACE='"+fontface+"' COLOR='"+this.gHeaderColor+"'><B>Tue</B></FONT></TD>";a=a+"<TD WIDTH='14%'><FONT SIZE='2' FACE='"+fontface+"' COLOR='"+this.gHeaderColor+"'><B>Wed</B></FONT></TD>";a=a+"<TD WIDTH='14%'><FONT SIZE='2' FACE='"+fontface+"' COLOR='"+this.gHeaderColor+"'><B>Thu</B></FONT></TD>";a=a+"<TD WIDTH='14%'><FONT SIZE='2' FACE='"+fontface+"' COLOR='"+this.gHeaderColor+"'><B>Fri</B></FONT></TD>";a=a+"<TD WIDTH='16%'><FONT SIZE='2' FACE='"+fontface+"' COLOR='"+this.gHeaderColor+"'><B>Sat</B></FONT></TD>";a=a+"</TR>";return a};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="";vCode=vCode+"<TR>";for(i=0;i<vFirstDay;i++){vCode=vCode+"<TD WIDTH='14%'"+this.write_weekend_string(i)+"><FONT SIZE='2' FACE='"+fontface+"'> </FONT></TD>"}for(j=vFirstDay;j<7;j++){var lsOrigDate=eval(p_item+".value");vCode=vCode+"<TD WIDTH='14%'"+this.write_weekend_string(j)+"><FONT SIZE='2' FACE='"+fontface+"'><A HREF='#' onClick=\"ufTriggerChangeEvent('"+lsOrigDate+"', '"+this.format_data(vDay)+"'); self.opener.document."+this.gReturnItem+".value='"+this.format_data(vDay)+"';window.close();\">"+this.format_day(vDay)+"</A></FONT></TD>";vDay=vDay+1}vCode=vCode+"</TR>";for(k=2;k<7;k++){vCode=vCode+"<TR>";for(j=0;j<7;j++){var lsOrigDate=eval(p_item+".value");vCode=vCode+"<TD WIDTH='14%'"+this.write_weekend_string(j)+"><FONT SIZE='2' FACE='"+fontface+"'><A HREF='#' onClick=\"ufTriggerChangeEvent('"+lsOrigDate+"', '"+this.format_data(vDay)+"'); self.opener.document."+this.gReturnItem+".value='"+this.format_data(vDay)+"';window.close();\">"+this.format_day(vDay)+"</A></FONT></TD>";vDay=vDay+1;if(vDay>vLastDay){vOnLastDay=1;break}}if(j==6){vCode=vCode+"</TR>"}if(vOnLastDay==1){break}}for(m=1;m<(7-j);m++){if(this.gYearly){vCode=vCode+"<TD WIDTH='14%'"+this.write_weekend_string(j+m)+"><FONT SIZE='2' FACE='"+fontface+"' COLOR='gray'> </FONT></TD>"}else{vCode=vCode+"<TD WIDTH='14%'"+this.write_weekend_string(j+m)+"><FONT SIZE='2' FACE='"+fontface+"' COLOR='gray'>"+m+"</FONT></TD>"}}return vCode};Calendar.prototype.format_day=function(a){var d=gNow.getDate();var c=gNow.getMonth();var b=gNow.getFullYear();if(a==d&&this.gMonth==c&&this.gYear==b){return('<FONT COLOR="#FF8C00"><B>'+a+"</B></FONT>")}else{return(a)}};Calendar.prototype.write_weekend_string=function(a){var b;for(b=0;b<weekend.length;b++){if(a==weekend[b]){return(' BGCOLOR="'+weekendColor+'"')}}return""};Calendar.prototype.format_data=function(c){var g;var f=1+this.gMonth;f=(f.toString().length<2)?"0"+f:f;var h=Calendar.get_month(this.gMonth).substr(0,3).toUpperCase();var b=Calendar.get_month(this.gMonth).toUpperCase();var d=new String(this.gYear);var e=new String(this.gYear.substr(2,2));var a=(c.toString().length<2)?"0"+c:c;switch(this.gFormat){case"MM/DD/YYYY":g=f+"/"+a+"/"+d;break;case"MM/DD/YY":g=f+"/"+a+"/"+e;break;case"MM-DD-YYYY":g=f+"-"+a+"-"+d;break;case"MM-DD-YY":g=f+"-"+a+"-"+e;break;case"DD/MON/YYYY":g=a+"/"+h+"/"+d;break;case"DD/MON/YY":g=a+"/"+h+"/"+e;break;case"DD-MON-YYYY":g=a+"-"+h+"-"+d;break;case"DD-MON-YY":g=a+"-"+h+"-"+e;break;case"DD/MONTH/YYYY":g=a+"/"+b+"/"+d;break;case"DD/MONTH/YY":g=a+"/"+b+"/"+e;break;case"DD-MONTH-YYYY":g=a+"-"+b+"-"+d;break;case"DD-MONTH-YY":g=a+"-"+b+"-"+e;break;case"DD/MM/YYYY":g=a+"/"+f+"/"+d;break;case"DD/MM/YY":g=a+"/"+f+"/"+e;break;case"DD-MM-YYYY":g=a+"-"+f+"-"+d;break;case"DD-MM-YY":g=a+"-"+f+"-"+e;break;default:g=f+"/"+a+"/"+d}return g};function Build(d,a,c,b){var e=ggWinCal;gCal=new Calendar(d,e,a,c,b);gCal.gBGColor="white";gCal.gLinkColor="black";gCal.gTextColor="black";gCal.gHeaderColor="navy";if(gCal.gYearly){gCal.showY()}else{gCal.show()}}function show_calendar(){p_item=arguments[0];if(arguments[1]==null){p_month=new String(gNow.getMonth())}else{p_month=arguments[1]}if(arguments[2]==""||arguments[2]==null){p_year=new String(gNow.getFullYear().toString())}else{p_year=arguments[2]}if(arguments[3]==null){p_format="MM/DD/YYYY"}else{p_format=arguments[3]}vWinCal=window.open("","Calendar","width=250,height=250,status=no,resizable=no,top=200,left=200");vWinCal.opener=self;ggWinCal=vWinCal;Build(p_item,p_month,p_year,p_format)}function show_yearly_calendar(d,c,b){if(c==null||c==""){c=new String(gNow.getFullYear().toString())}if(b==null||b==""){b="MM/DD/YYYY"}var a=window.open("","Calendar","scrollbars=yes");a.opener=self;ggWinCal=a;Build(d,null,c,b)};