var weekend=[0,6],weekendColor="#f1f1f1",fontface="tahoma",fontsize=1,gNow=new Date,ggWinCal;isNav=navigator.appName.indexOf("Netscape")!=-1?true:false;isIE=navigator.appName.indexOf("Microsoft")!=-1?true:false;var p_language="EN",monthText="Month",yearText="Year",format="MM/DD/YYYY";Calendar.Months=["January","February","March","April","May","June","July","August","September","October","November","December"];Calendar.Days=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];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(e,b,a,c,d){if(a==null&&c==null)return;if(b==null)this.gWinCal=ggWinCal;else this.gWinCal=b;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=d;this.gBGColor="white";this.gFGColor="black";this.gTextColor="black";this.gHeaderColor="black";this.gReturnItem=e}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(a,b){return b%4==0?b%100==0&&b%400!=0?Calendar.DOMonth[a]:Calendar.lDOMonth[a]:Calendar.DOMonth[a]}function Calendar_calc_month_year(b,c,d){var a=[];if(d==-1)if(b==0){a[0]=11;a[1]=parseInt(c)-1}else{a[0]=parseInt(b)-1;a[1]=parseInt(c)}else if(d==1)if(b==11){a[0]=0;a[1]=parseInt(c)+1}else{a[0]=parseInt(b)+1;a[1]=parseInt(c)}return a}function Calendar_print(){ggWinCal.print()}function Calendar_calc_month_year(b,c,d){var a=[];if(d==-1)if(b==0){a[0]=11;a[1]=parseInt(c)-1}else{a[0]=parseInt(b)-1;a[1]=parseInt(c)}else if(d==1)if(b==11){a[0]=0;a[1]=parseInt(c)+1}else{a[0]=parseInt(b)+1;a[1]=parseInt(c)}return a}new Calendar;Calendar.prototype.getMonthlyCalendarCode=function(){var a="",b="",c="";a=a+"<TABLE width='100%' BORDER=0 cellspacing='0' cellpadding='2'>";b=this.cal_header();c=this.cal_data();a=a+b+c;a=a+"</TABLE>";return a};Calendar.prototype.show=function(){var c="";this.gWinCal.document.open();this.wwrite("<html>");this.wwrite("<head><title>Calendar</title>");this.wwrite("</head>");this.wwrite("<body bgcolor='#BBBBBB' link=\""+this.gLinkColor+'" vlink="'+this.gLinkColor+'" alink="'+this.gLinkColor+'" text="'+this.gTextColor+'">');this.wwrite("<style type='text/css'>");this.wwrite("a:link {text-decoration: underline; color: #000000; font-size: 11px;}");this.wwrite("a:visited {text-decoration: underline; color: #000000; font-size: 11px;}");this.wwrite("a:hover {text-decoration: none; color: #000000; font-size: 11px;}");this.wwrite("</style>");this.wwrite("<table width='100%' cellspacing='0' cellpadding='1' border='0'><tr><td style='background-color: #3784bb; padding-left: 4px;'>");this.wwriteA("<span style='font-family: tahoma; font-weight: bold; font-size: 11px; color: white; text-transform: uppercase;'>");this.wwriteA(this.gMonthName+" "+this.gYear);this.wwriteA("</span>");this.wwrite("</td><tr></table>");var b=Calendar.calc_month_year(this.gMonth,this.gYear,-1),g=b[0],e=b[1],a=Calendar.calc_month_year(this.gMonth,this.gYear,1),f=a[0],d=a[1];this.wwrite("<TABLE WIDTH='100%' CELLSPACING=0 CELLPADDING=0 style='padding-bottom: 2px;' BGCOLOR='#ffffff'><TR><TD ALIGN=left style='font-size: 10px; font-family: tahoma;'>");this.wwrite("&nbsp;<A style='font-size: 10px;' HREF=\"javascript:window.opener.Build('"+this.gReturnItem+"', '"+this.gMonth+"', '"+(parseInt(this.gYear)-1)+"', '"+this.gFormat+"');\"><</A>&nbsp;"+yearText+"</TD><TD ALIGN=right style='font-size: 10px; font-family: tahoma;'>");this.wwrite("<A style='font-size: 10px;' HREF=\"javascript:window.opener.Build('"+this.gReturnItem+"', '"+g+"', '"+e+"', '"+this.gFormat+"');\"><<</A></TD><td width='35' style='text-align: center; font-size: 10px; font-family: tahoma;'>"+monthText+"</td><TD ALIGN=center style='font-size: 10px; font-family: tahoma;'>");this.wwrite("</TD><TD ALIGN=left style='font-size: 10px; font-family: tahoma;'>");this.wwrite("<A style='font-size: 10px;' HREF=\"javascript:window.opener.Build('"+this.gReturnItem+"', '"+f+"', '"+d+"', '"+this.gFormat+"');\">>></A></TD><TD ALIGN=right style='font-size: 10px; font-family: tahoma;'>");this.wwrite(yearText+"&nbsp;<A style='font-size: 10px;' HREF=\"javascript:window.opener.Build('"+this.gReturnItem+"', '"+this.gMonth+"', '"+(parseInt(this.gYear)+1)+"', '"+this.gFormat+"');\">></A>&nbsp;</TD></TR></TABLE><BR>");c=this.getMonthlyCalendarCode();this.wwrite(c);this.wwrite("</font></body></html>");this.gWinCal.document.close()};Calendar.prototype.showY=function(){var d="",a,b,e,f,g,j=285,l=200,k=10,c;if(isIE)c=75;else if(isNav)c=25;this.gWinCal.document.open();this.wwrite("<html>");this.wwrite("<head><title>Calendar</title>");this.wwrite("<style type='text/css'>\n<!--");for(a=0;a<12;a++){e=a%3;if(a>=0&&a<=2)b=0;if(a>=3&&a<=5)b=1;if(a>=6&&a<=8)b=2;if(a>=9&&a<=11)b=3;f=parseInt(j*e)+k;g=parseInt(l*b)+c;this.wwrite(".lclass"+a+" {position:absolute;top:"+g+";left:"+f+";}")}this.wwrite("-->\n</style>");this.wwrite("</head>");this.wwrite('<body link="'+this.gLinkColor+'" vlink="'+this.gLinkColor+'" alink="'+this.gLinkColor+'" text="'+this.gTextColor+'">');this.wwrite("<FONT FACE='"+fontface+"' SIZE=2><B>");this.wwrite(yearText+" : "+this.gYear);this.wwrite("</B><BR>");var i=parseInt(this.gYear)-1,h=parseInt(this.gYear)+1;this.wwrite("<TABLE WIDTH='100%' BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR='#e0e0e0'><TR><TD ALIGN=center>");this.wwrite("[<A HREF=\"javascript:window.opener.Build('"+this.gReturnItem+"', null, '"+i+"', '"+this.gFormat+"');\" alt='Prev "+yearText+"'><<</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, '"+h+"', '"+this.gFormat+"');\">>></A>]</TD></TR></TABLE><BR>");var m;for(a=11;a>=0;a--){if(isIE)this.wwrite('<DIV ID="layer'+a+'" CLASS="lclass'+a+'">');else isNav&&this.wwrite('<LAYER ID="layer'+a+'" CLASS="lclass'+a+'">');this.gMonth=a;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 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%' bgcolor="+this.gHeaderColor+" style='text-align: center;'><span style='color:"+this.gHeaderTextColor+"; font-size: 10px; font-weight: normal; font-family: tahoma;'>"+Calendar.Days[0]+"</span></TD>";a=a+"<TD WIDTH='14%' bgcolor="+this.gHeaderColor+" style='text-align: center;'><span style='color:"+this.gHeaderTextColor+"; font-size: 10px; font-weight: normal; font-family: tahoma;'>"+Calendar.Days[1]+"</span></TD>";a=a+"<TD WIDTH='14%' bgcolor="+this.gHeaderColor+" style='text-align: center;'><span style='color:"+this.gHeaderTextColor+"; font-size: 10px; font-weight: normal; font-family: tahoma;'>"+Calendar.Days[2]+"</span></TD>";a=a+"<TD WIDTH='14%' bgcolor="+this.gHeaderColor+" style='text-align: center;'><span style='color:"+this.gHeaderTextColor+"; font-size: 10px; font-weight: normal; font-family: tahoma;'>"+Calendar.Days[3]+"</span></TD>";a=a+"<TD WIDTH='14%' bgcolor="+this.gHeaderColor+" style='text-align: center;'><span style='color:"+this.gHeaderTextColor+"; font-size: 10px; font-weight: normal; font-family: tahoma;'>"+Calendar.Days[4]+"</span></TD>";a=a+"<TD WIDTH='14%' bgcolor="+this.gHeaderColor+" style='text-align: center;'><span style='color:"+this.gHeaderTextColor+"; font-size: 10px; font-weight: normal; font-family: tahoma;'>"+Calendar.Days[5]+"</span></TD>";a=a+"<TD WIDTH='16%' bgcolor="+this.gHeaderColor+" style='text-align: center;'><span style='color:"+this.gHeaderTextColor+"; font-size: 10px; font-weight: normal; font-family: tahoma;'>"+Calendar.Days[6]+"</span></TD>";a=a+"</TR>";return a};Calendar.prototype.cal_data=function(){var c=new Date;c.setDate(1);c.setMonth(this.gMonth);c.setFullYear(this.gYear);var e=c.getDay(),b=1,f=Calendar.get_daysofmonth(this.gMonth,this.gYear),d=0,a="";a=a+'<TR BGCOLOR="'+this.gBGColor+'">';for(i=0;i<e;i++)a=a+"<TD WIDTH='14%'"+this.write_weekend_string(i)+"><FONT SIZE='2' FACE='"+fontface+"'> </FONT></TD>";for(j=e;j<7;j++){a=a+"<TD WIDTH='14%'"+this.write_weekend_string(j)+" style=' text-align: center;'><FONT SIZE='2' FACE='"+fontface+"'><A HREF='#' onClick=\"self.opener.document.getElementById('"+this.gReturnItem+"').value='"+this.format_data(b)+"';window.close();\">"+this.format_day(b)+"</A></FONT></TD>";b=b+1}a=a+"</TR>";for(k=2;k<7;k++){a=a+'<TR BGCOLOR="'+this.gBGColor+'">';for(j=0;j<7;j++){a=a+"<TD WIDTH='14%'"+this.write_weekend_string(j)+" style=' text-align: center;'><FONT SIZE='2' FACE='"+fontface+"'><A HREF='#' onClick=\"self.opener.document.getElementById('"+this.gReturnItem+"').value='"+this.format_data(b)+"';window.close();\">"+this.format_day(b)+"</A></FONT></TD>";b=b+1;if(b>f){d=1;break}}if(j==6)a=a+"</TR>";if(d==1)break}for(m=1;m<7-j;m++)if(this.gYearly)a=a+"<TD WIDTH='14%' style='text-align: center;'"+this.write_weekend_string(j+m)+"><span style='font-size: 11px; color: gray; font-family:"+fontface+";'> </span></TD>";else a=a+"<TD WIDTH='14%' style='text-align: center;'"+this.write_weekend_string(j+m)+"><span style='font-size: 11px; color: gray; font-family:"+fontface+";'>"+m+"</span></TD>";return a};Calendar.prototype.format_day=function(a){var d=gNow.getDate(),b=gNow.getMonth(),c=gNow.getFullYear();return a==d&&this.gMonth==b&&this.gYear==c?"<table width='100%' align='center' cellpadding='1' cellspacing='0' border='0'><tr><td style='text-align: center; background color: 3784bb; color: white; font-family: tahoma; font-size: 11px;'><u>"+a+"</u></td></tr></table>":a};Calendar.prototype.write_weekend_string=function(b){for(var a=0;a<weekend.length;a++)if(b==weekend[a])return' BGCOLOR="'+weekendColor+'"';return""};Calendar.prototype.format_data=function(h){var a,c=1+this.gMonth;c=c.toString().length<2?"0"+c:c;var g=Calendar.get_month(this.gMonth).substr(0,3).toUpperCase(),f=Calendar.get_month(this.gMonth).toUpperCase(),d=new String(this.gYear),e=new String(this.gYear.substr(2,2)),b=h.toString().length<2?"0"+h:h;switch(this.gFormat){case"MM/DD/YYYY":a=c+"/"+b+"/"+d;break;case"MM/DD/YY":a=c+"/"+b+"/"+e;break;case"MM-DD-YYYY":a=c+"-"+b+"-"+d;break;case"MM-DD-YY":a=c+"-"+b+"-"+e;break;case"DD/MON/YYYY":a=b+"/"+g+"/"+d;break;case"DD/MON/YY":a=b+"/"+g+"/"+e;break;case"DD-MON-YYYY":a=b+"-"+g+"-"+d;break;case"DD-MON-YY":a=b+"-"+g+"-"+e;break;case"DD/MONTH/YYYY":a=b+"/"+f+"/"+d;break;case"DD/MONTH/YY":a=b+"/"+f+"/"+e;break;case"DD-MONTH-YYYY":a=b+"-"+f+"-"+d;break;case"DD-MONTH-YY":a=b+"-"+f+"-"+e;break;case"DD/MM/YYYY":a=b+"/"+c+"/"+d;break;case"DD/MM/YY":a=b+"/"+c+"/"+e;break;case"DD-MM-YYYY":a=b+"-"+c+"-"+d;break;case"DD-MM-YY":a=b+"-"+c+"-"+e;break;default:a=c+"/"+b+"/"+d}return a};function Build(d,c,e,a){var b=ggWinCal;gCal=new Calendar(d,b,c,e,a);gCal.gBGColor="white";gCal.gLinkColor="black";gCal.gTextColor="black";gCal.gHeaderTextColor="white";gCal.gHeaderColor="3784bb";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];p_language=arguments[4];if(p_language!=null){p_language=p_language.toUpperCase().substr(0,2);if(p_language=="FR"){p_format="DD/MM/YYYY";Calendar.Months=["janvier","f\u00e9vrier","mars","avril","mai","juin","juillet","ao\u00fbt","septembre","octobre","novembre","d\u00e9cembre"];Calendar.Days=["dim","lun","mar","mer","jeu","ven","sam"];monthText="mois";yearText="ann\u00e9e"}else p_format="MM/DD/YYYY"}if(p_format!=null&&(p_format=="DD/MM/YYYY"||p_format=="MM/DD/YYYY"))format=p_format;var e=document.getElementById(p_item);try{var a=e.value;if(format=="DD/MM/YYYY")a=ReverseElements1And2(a);var b=new Date(a)}catch(f){}if(isNaN(b))b=gNow;else{var d=a.length-a.lastIndexOf("/")-1;d<4&&b.getFullYear()<gNow.getFullYear()-98&&b.setFullYear(b.getFullYear()+100)}var c=window.open("","Calendar","width=250,height=225,status=no,resizable=no,top=200,left=200");c.opener=self;ggWinCal=c;Build(p_item,p_month,p_year,format)}function show_yearly_calendar(d,b,a){if(b==null||b=="")b=new String(gNow.getFullYear().toString());if(a==null||a=="")a="MM/DD/YYYY";var c=window.open("","Calendar","scrollbars=yes");c.opener=self;ggWinCal=c;Build(d,null,b,a)}function ReverseElements1And2(a){var g=0,d=-1,c=-1,e=-1,b=-1,f=-1;if(a==null||String(a).length<6)return;f=String(a).length-1;d=String(a).indexOf("/");c=d+1;e=String(a).indexOf("/",c);b=e+1;if(b>f||b<4)return;var h=String(a).substring(g,d+1),i=String(a).substring(c,e+1),j=String(a).substring(b);return i+h+j}
