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,C,B,A,E){if((B==null)&&(A==null)){return }if(C==null){this.gWinCal=ggWinCal}else{this.gWinCal=C}if(B==null){this.gMonthName=null;this.gMonth=null;this.gYearly=true}else{this.gMonthName=Calendar.get_month(B);this.gMonth=new Number(B);this.gYearly=false}this.gYear=A;this.gFormat=E;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(A,B){if((B%4)==0){if((B%100)==0&&(B%400)!=0){return Calendar.DOMonth[A]}return Calendar.lDOMonth[A]}else{return Calendar.DOMonth[A]}}function Calendar_calc_month_year(D,C,B){var A=new Array();if(B==-1){if(D==0){A[0]=11;A[1]=parseInt(C)-1}else{A[0]=parseInt(D)-1;A[1]=parseInt(C)}}else{if(B==1){if(D==11){A[0]=0;A[1]=parseInt(C)+1}else{A[0]=parseInt(D)+1;A[1]=parseInt(C)}}}return A}function Calendar_print(){ggWinCal.print()}function Calendar_calc_month_year(A,D,C){var B=new Array();if(C==-1){if(A==0){B[0]=11;B[1]=parseInt(D)-1}else{B[0]=parseInt(A)-1;B[1]=parseInt(D)}}else{if(C==1){if(A==11){B[0]=0;B[1]=parseInt(D)+1}else{B[0]=parseInt(A)+1;B[1]=parseInt(D)}}}return B}new Calendar();Calendar.prototype.getMonthlyCalendarCode=function(){var B="";var A="";var C="";B=B+'<TABLE BORDER=1 BGCOLOR="'+this.gBGColor+'">';A=this.cal_header();C=this.cal_data();B=B+A+C;B=B+"</TABLE>";return B};Calendar.prototype.show=function(){var D="";this.gWinCal.document.open();this.wwrite("<html>");this.wwrite("<head><title>Calendar</title>");this.wwrite("</head>");this.wwrite('<body link="'+this.gLinkColor+'" vlink="'+this.gLinkColor+'" alink="'+this.gLinkColor+'" text="'+this.gTextColor+'">');this.wwriteA("<B>");this.wwriteA(this.gMonthName+" "+this.gYear);this.wwriteA("</B><BR>");var C=Calendar.calc_month_year(this.gMonth,this.gYear,-1);var A=C[0];var G=C[1];var F=Calendar.calc_month_year(this.gMonth,this.gYear,1);var E=F[0];var B=F[1];this.wwrite("<TABLE 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+"');\">&lt;&lt;Year</A>]</TD><TD ALIGN=center>");this.wwrite("[<A HREF=\"javascript:window.opener.Build('"+this.gReturnItem+"', '"+A+"', '"+G+"', '"+this.gFormat+"');\">&lt;Mon</A>]</TD><TD ALIGN=center>");this.wwrite("[<A HREF=\"javascript:window.opener.Build('"+this.gReturnItem+"', '"+E+"', '"+B+"', '"+this.gFormat+"');\">Mon></A>]</TD><TD ALIGN=center>");this.wwrite("[<A HREF=\"javascript:window.opener.Build('"+this.gReturnItem+"', '"+this.gMonth+"', '"+(parseInt(this.gYear)+1)+"', '"+this.gFormat+"');\">Year>></A>]</TD></TR></TABLE><BR>");D=this.getMonthlyCalendarCode();this.wwrite(D);this.wwrite("</body></html>");this.gWinCal.document.close()};Calendar.prototype.showY=function(){var A="";var C;var I,E,G,F;var D=285;var L=200;var M=10;var H;if(isIE){H=75}else{if(isNav){H=25}}this.gWinCal.document.open();this.wwrite("<html>");this.wwrite("<head><title>Calendar</title>");this.wwrite("<style type='text/css'>\n<!--");for(C=0;C<12;C++){E=C%3;if(C>=0&&C<=2){I=0}if(C>=3&&C<=5){I=1}if(C>=6&&C<=8){I=2}if(C>=9&&C<=11){I=3}G=parseInt(D*E)+M;F=parseInt(L*I)+H;this.wwrite(".lclass"+C+" {position:absolute;top:"+F+";left:"+G+";}")}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+"'><B>");this.wwrite("Year : "+this.gYear);this.wwrite("</B><BR>");var K=parseInt(this.gYear)-1;var J=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, '"+K+"', '"+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, '"+J+"', '"+this.gFormat+"');\">>></A>]</TD></TR></TABLE><BR>");var B;for(C=11;C>=0;C--){if(isIE){this.wwrite('<DIV ID="layer'+C+'" CLASS="lclass'+C+'">')}else{if(isNav){this.wwrite('<LAYER ID="layer'+C+'" CLASS="lclass'+C+'">')}}this.gMonth=C;this.gMonthName=Calendar.get_month(this.gMonth);A=this.getMonthlyCalendarCode();this.wwrite(this.gMonthName+"/"+this.gYear+"<BR>");this.wwrite(A);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 B=new Date();B.setDate(1);B.setMonth(this.gMonth);B.setFullYear(this.gYear);var F=B.getDay();var E=1;var D=Calendar.get_daysofmonth(this.gMonth,this.gYear);var C=0;var A="";A=A+"<TR>";for(i=0;i<F;i++){A=A+"<TD WIDTH='14%'"+this.write_weekend_string(i)+"><FONT SIZE='2' FACE='"+fontface+"'>\ufffd</FONT></TD>"}for(j=F;j<7;j++){A=A+"<TD WIDTH='14%'"+this.write_weekend_string(j)+"><FONT SIZE='2' FACE='"+fontface+"'><A HREF='#' onClick=\"self.opener.document."+this.gReturnItem+".value='"+this.format_data(E)+"';window.close();\">"+this.format_day(E)+"</A></FONT></TD>";E=E+1}A=A+"</TR>";for(k=2;k<7;k++){A=A+"<TR>";for(j=0;j<7;j++){if(this.gReturnItem=="rez.checkin_date"&&document.rez.checkout_date.value==""){A=A+"<TD WIDTH='14%'"+this.write_weekend_string(j)+"><FONT SIZE='2' FACE='"+fontface+"'><A HREF='#' onClick=\"self.opener.document."+this.gReturnItem+".value='"+this.format_data(E)+"';self.opener.document.rez.checkout_date.value='"+this.format_data(E)+"';window.close();\">"+this.format_day(E)+"</A></FONT></TD>"}else{A=A+"<TD WIDTH='14%'"+this.write_weekend_string(j)+"><FONT SIZE='2' FACE='"+fontface+"'><A HREF='#' onClick=\"self.opener.document."+this.gReturnItem+".value='"+this.format_data(E)+"';window.close();\">"+this.format_day(E)+"</A></FONT></TD>"}E=E+1;if(E>D){C=1;break}}if(j==6){A=A+"</TR>"}if(C==1){break}}for(m=1;m<(7-j);m++){if(this.gYearly){A=A+"<TD WIDTH='14%'"+this.write_weekend_string(j+m)+"><FONT SIZE='2' FACE='"+fontface+"' COLOR='gray'>\ufffd</FONT></TD>"}else{A=A+"<TD WIDTH='14%'"+this.write_weekend_string(j+m)+"><FONT SIZE='2' FACE='"+fontface+"' COLOR='gray'>"+m+"</FONT></TD>"}}return A};Calendar.prototype.format_day=function(C){var A=gNow.getDate();var B=gNow.getMonth();var D=gNow.getFullYear();if(C==A&&this.gMonth==B&&this.gYear==D){return('<FONT COLOR="RED"><B>'+C+"</B></FONT>")}else{return(C)}};Calendar.prototype.write_weekend_string=function(B){var A;for(A=0;A<weekend.length;A++){if(B==weekend[A]){return(' BGCOLOR="'+weekendColor+'"')}}return""};Calendar.prototype.format_data=function(C){var B;var A=1+this.gMonth;A=(A.toString().length<2)?"0"+A:A;var H=Calendar.get_month(this.gMonth).substr(0,3).toUpperCase();var F=Calendar.get_month(this.gMonth).toUpperCase();var E=new String(this.gYear);var G=new String(this.gYear.substr(2,2));var D=(C.toString().length<2)?"0"+C:C;switch(this.gFormat){case"MM/DD/YYYY":B=A+"/"+D+"/"+E;break;case"MM/DD/YY":B=A+"/"+D+"/"+G;break;case"MM-DD-YYYY":B=A+"-"+D+"-"+E;break;case"MM-DD-YY":B=A+"-"+D+"-"+G;break;case"DD/MON/YYYY":B=D+"/"+H+"/"+E;break;case"DD/MON/YY":B=D+"/"+H+"/"+G;break;case"DD-MON-YYYY":B=D+"-"+H+"-"+E;break;case"DD-MON-YY":B=D+"-"+H+"-"+G;break;case"DD/MONTH/YYYY":B=D+"/"+F+"/"+E;break;case"DD/MONTH/YY":B=D+"/"+F+"/"+G;break;case"DD-MONTH-YYYY":B=D+"-"+F+"-"+E;break;case"DD-MONTH-YY":B=D+"-"+F+"-"+G;break;case"DD/MM/YYYY":B=D+"/"+A+"/"+E;break;case"DD/MM/YY":B=D+"/"+A+"/"+G;break;case"DD-MM-YYYY":B=D+"-"+A+"-"+E;break;case"DD-MM-YY":B=D+"-"+A+"-"+G;break;default:B=A+"/"+D+"/"+E}return B};function Build(D,C,B,E){var A=ggWinCal;gCal=new Calendar(D,A,C,B,E);gCal.gBGColor="white";gCal.gLinkColor="black";gCal.gTextColor="black";gCal.gHeaderColor="darkgreen";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=320,height=280,status=no,resizable=yes,top=200,left=200");vWinCal.opener=self;ggWinCal=vWinCal;Build(p_item,p_month,p_year,p_format)}function show_yearly_calendar(C,B,A){if(B==null||B==""){B=new String(gNow.getFullYear().toString())}if(A==null||A==""){A="MM/DD/YYYY"}var D=window.open("","Calendar","scrollbars=yes");D.opener=self;ggWinCal=D;Build(C,null,B,A)}