var weekend=[0,6];var weekendColor="#F7F7F7";var fontface="arial";var fontsize=1;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 width='250' border='0' cellspacing='0' cellpadding='0'>";B=B+"<tr>";B=B+"<td bgcolor='#CCCCCC' height='20'>";B=B+"<table border=0 cellspacing='1' width='250' cellpadding='2'>";C=this.cal_header();A=this.cal_data();B=B+C+A;B=B+"</TABLE>";B=B+"</td>";B=B+"</tr>";B=B+"</table>";return B};Calendar.prototype.show=function(){var G="";this.gWinCal.document.open();this.wwrite("<html>");this.wwrite("<head><title>Calendar</title>");this.wwrite("</head>");this.wwrite("<body topmargin='4' marginheight='0'link=\""+this.gLinkColor+'" vlink="'+this.gLinkColor+'" alink="'+this.gLinkColor+'" text="'+this.gTextColor+'">');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 cellSpacing=1 cellPadding=0 border=0 width=67% align='center'><TR bgcolor='#ffffff' align='center'><TD>");this.wwrite("<A STYLE=text-decoration:none HREF=\"javascript:window.opener.Build('"+this.gReturnItem+"', '"+this.gMonth+"', '"+(parseInt(this.gYear)-1)+"', '"+this.gFormat+"');\"><img src='http://hotels.rediff.com/images/arrow_cal00.gif' width='12' height='7' border='0' alt='Previous Year'></A></TD><TD>");this.wwrite("<A STYLE=text-decoration:none HREF=\"javascript:window.opener.Build('"+this.gReturnItem+"', '"+F+"', '"+C+"', '"+this.gFormat+"');\"><img src='http://hotels.rediff.com/images/arrow_cal0.gif' width='12' height='7' border='0' alt='Previous Month'></A></TD><TD>");this.wwrite("<font size=2 face=arial><b>");this.wwrite(this.gMonthName+" "+this.gYear);this.wwrite("</b></font>");this.wwrite("</TD><TD>");this.wwrite("<A STYLE=text-decoration:none HREF=\"javascript:window.opener.Build('"+this.gReturnItem+"', '"+D+"', '"+A+"', '"+this.gFormat+"');\"><img src='http://hotels.rediff.com/images/arrow_cal1.gif' width='12' height='7' border='0' alt='Next Month'></A></TD><TD>");this.wwrite("<A STYLE=text-decoration:none HREF=\"javascript:window.opener.Build('"+this.gReturnItem+"', '"+this.gMonth+"', '"+(parseInt(this.gYear)+1)+"', '"+this.gFormat+"');\"><img src='http://hotels.rediff.com/images/arrow_cal11.gif' width='12' height='7' border='0' alt='Next Year'></A></TD></TR><tr><td><img src='http://hotels.rediff.com/uim/faresearch/lightdot.gif' width='1' height='7'</td></tr></TABLE>");G=this.getMonthlyCalendarCode();this.wwrite(G);this.wwrite("</font></body></html>");this.gWinCal.document.close()};Calendar.prototype.showY=function(){var D="";var F;var M,H,J,I;var G=285;var B=180;var C=10;var L;if(isIE){L=75}else{if(isNav){L=25}}this.gWinCal.document.open();this.wwrite("<html>");this.wwrite("<head><title>Calendar</title>");this.wwrite("<style type='text/css'>\n<!--");for(F=0;F<12;F++){H=F%3;if(F>=0&&F<=2){M=0}if(F>=3&&F<=5){M=1}if(F>=6&&F<=8){M=2}if(F>=9&&F<=11){M=3}J=parseInt(G*H)+C;I=parseInt(B*M)+L;this.wwrite(".lclass"+F+" {position:absolute;top:"+I+";left:"+J+";}")}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=1><B>");this.wwrite("Year : "+this.gYear);this.wwrite("</B><BR>");var K=parseInt(this.gYear)-1;var A=parseInt(this.gYear)+1;this.wwrite("<TABLE WIDTH='100%' BORDER=0 CELLSPACING=0 CELLPADDING=0><TR align='center'><TD ALIGN=center>");this.wwrite("[<A STYLE=text-decoration:none HREF=\"javascript:window.opener.Build('"+this.gReturnItem+"', null, '"+K+"', '"+this.gFormat+"');\" alt='Prev Year'><<</A>]</TD><TD ALIGN=center>");this.wwrite("[<A STYLE=text-decoration:none 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 align='center' width='20' bgcolor='#DDDDDD' height='20'><font size='1' face='arial'><B>Sun</B></FONT></TD>";A=A+"<td align='center' width='20' bgcolor='#DDDDDD' height='20'><font size='1' face='arial'><B>Mon</B></FONT></TD>";A=A+"<td align='center' width='20' bgcolor='#DDDDDD' height='20'><font size='1' face='arial'><B>Tue</B></FONT></TD>";A=A+"<td align='center' width='20' bgcolor='#DDDDDD' height='20'><font size='1' face='arial'><B>Wed</B></FONT></TD>";A=A+"<td align='center' width='20' bgcolor='#DDDDDD' height='20'><font size='1' face='arial'><B>Thu</B></FONT></TD>";A=A+"<td align='center' width='20' bgcolor='#DDDDDD' height='20'><font size='1' face='arial'><B>Fri</B></FONT></TD>";A=A+"<td align='center' width='20' bgcolor='#DDDDDD' height='20'><font size='1' face='arial'><B>Sat</B></FONT></TD>";A=A+"</TR>";return A};Calendar.prototype.cal_data=function(){var U=new Date();var F="";var E="";var K="";var V="";U.setDate(1);U.setMonth(this.gMonth);var Q=this.gMonth;var M=Q+1;var A=Calendar.Months[Q];var I=this.gYear;U.setFullYear(this.gYear);var C=new Date(this.gYear,0,1);var H=new Date(this.gYear,this.gMonth,gNow.getDate());K=H.getTime()-C.getTime();V=parseInt(K/(1000*60*60*24))+1;var R=new Date(this.gYear,this.gMonth,1);K=R.getTime()-C.getTime();E=parseInt(K/(1000*60*60*24))+1;F=parseInt((E+12-C.getDay())/7);var S=U.getDay();var O=1;var P=Calendar.get_daysofmonth(this.gMonth,this.gYear);var J=0;var D="";var L=parseInt(Q/3)+1;var G=parseInt(Q/6)+1;var T=gNow.getDate();var B=A.substring(0,3);var N=I.toString();var N=N.substring(2);D=D+"<TR align='center'>";for(i=0;i<S;i++){D=D+"<TD WIDTH='20' BGCOLOR='white' height='20'><FONT SIZE='1' FACE='"+fontface+"'> </FONT></TD>"}for(j=S;j<7;j++){D=D+"<TD WIDTH='20' BGCOLOR='white' height='20'><FONT SIZE='1' FACE='"+fontface+"'><A STYLE=text-decoration:none HREF='#' onClick=\"self.opener.document."+this.gReturnItem+".value='"+this.format_data(O)+"';window.close();\">"+this.format_day(O)+"</A></FONT></TD>";O=O+1}for(k=2;k<7;k++){D=D+"<TR align='center'>";for(j=0;j<7;j++){D=D+"<TD WIDTH='20' BGCOLOR='white' height='20'><FONT SIZE='1' FACE='"+fontface+"'><A STYLE=text-decoration:none HREF='#' onClick=\"self.opener.document."+this.gReturnItem+".value='"+this.format_data(O)+"';window.close();\">"+this.format_day(O)+"</A></FONT></TD>";O=O+1;if(O>P){J=1;break}}F++;if(O<=P){}if(j==7){D=D+"</TR>"}if(J==1){break}}for(Q=1;Q<(7-j);Q++){if(this.gYearly){D=D+"<TD WIDTH='20' BGCOLOR='white' height='20'><FONT SIZE='1' FACE='"+fontface+"' > </FONT></TD>"}else{D=D+"<TD WIDTH='20' BGCOLOR='white' height='20'><FONT SIZE='1' FACE='"+fontface+"' ></FONT></TD>"}}D=D+"</tr>";return D};Calendar.prototype.format_day=function(A){var D=gNow.getDate()+7;var C=gNow.getMonth();var B=gNow.getFullYear();if(A==D){return('<FONT COLOR="RED"><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);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=A+"/"+F+"/"+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="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="DD-MON-YYYY"}else{p_format=arguments[3]}vWinCal=window.open("","Calendar","width=275,height=210,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="DD-MON-YYYY"}var A=window.open("","Calendar","scrollbars=yes");A.opener=self;ggWinCal=A;Build(D,null,C,B)};