var errorMSG=new Array();errorMSG.InvalidDate="There aren't that many days in the month! We've changed\nyour selection to the last day of your chosen month.";function easyDate(){easyDate.prototype.formatDate=function(B){var D=B.getDate();var E=monthArray[B.getMonth()+1];var C=B.getFullYear();var A=D+" "+E+" "+C;return A};easyDate.prototype.constructDate=function(B,E,C){var G=this.getYear(B);var A=this.getMonth(B);var D=this.getDay(E);var F;if(C){F=new Date(G,(A-1),D)}else{F=new Date(G,A,D)}return F};easyDate.prototype.getYear=function(A){return A.val().substring(2,6)};easyDate.prototype.getMonth=function(A){return A.val().substring(0,2)};easyDate.prototype.getDay=function(A){return A.val()}}function selectOption(B,A){var C;if(B==null){return }B.val(A)}if(document.all){if(document.all("ArriveCal")!=null){document.all("ArriveCal").style.display="inline"}}else{if(document.getElementById("ArriveCal")!=null){document.getElementById("ArriveCal").style.display="inline"}}var timeout=500;var timeoutId;document.write('<div id="calContainer"');if(timeout){document.write(' onmouseout="calendarTimer();" onmouseover="if (timeoutId) clearTimeout(timeoutId);"')}document.write(' style="display: none;"></div>');var gED=new easyDate();var gCal=new Calendar();function calendarTimer(){timeoutId=setTimeout("gCal.closeMe();",timeout)}function isDateValid(oDay,oMonYear,nlcheckID){var bReturn;bReturn=true;with(gED){var objDate=constructDate(oMonYear,oDay,true);if((getMonth(oMonYear))<objDate.getMonth()+1){alert(errorMSG.InvalidDate);oDay.val(getDay(oDay)-objDate.getDate());bReturn=false}}return bReturn}function Calendar(){this._iMonth;this._iDay;this._endMonth;this._calContainer=document.getElementById?document.getElementById("calContainer"):document.all.calContainer;this.objDay=$("#Search_Day");this.objMonthYear=$("#Search_MonYear");this._currentMonth=0;Calendar.prototype.showCalendar=function(B,D,F){try{this.objDay=$(D);this.objMonthYear=$(F);this._iDay=gED.getDay(this.objDay);this._iMonth=gED.getMonth(this.objMonthYear);if(this._iDay=="00"||this._iMonth=="00"){this._iDay=serverday;this._currentMonth=0}else{this._currentMonth=this.getCurrentMonth(this.objMonthYear)}var C=this.buildCalendar(this._currentMonth);var A=(document.all)?document.all(B):document.getElementById(B);$(this._calContainer).html(C).css("left","750px").css("top","450px").css("z-index","999").css("display","");$("#selectObscurer").css("left","22px").css("top","130px").height($(this._calContainer).height()).width($(this._calContainer).width()).css("display","")}catch(E){this.closeMe()}};Calendar.prototype.buildCalendar=function(O){var K=this.getMonth(validMonthArray[O]);var P=this.getYear(validMonthArray[O]);var G=new Date(P,K-1,1);var L=G.getMonth()+1;var H=this.getDaysInMonth(L,P);var N=this.getFullYear(G);G.setDate(1);var B=1;var A=(((G.getDay())+(7-B))%7);var J='<table class="calTable" cellspacing="0" cellpadding="0"><tr><td height="20" width="15" class="calHeader">';if(O>0){J+='<a href="javascript:gCal.movePrevious()"><<</a>'}J+='</td><td colspan="5" width="100" class="calHeader">'+shortMonthArray[G.getMonth()+1]+" "+N+'</td><td class="calHeader" width="20">';if(O<validMonthArray.length-1){J+='<a href="javascript:gCal.moveNext()">>></a>'}J+="</td></tr>";for(var F=0;F<7;F++){J+='<td height="20" width="20">'+shortDayArray[(F+B)%7]+"</td>"}J+="</tr>";for(var E=0;E<6;E++){J+="<tr>";for(F=1;F<8;F++){var I=(E*7)+F;var Q=I-A;var M=(I>A)&&(Q<=H);var D=(L==servermonth&&Q<serverday);var C=(M)?Q:"";J+='<td height="20">';J+=(M&&!D)?'<a href="javascript:gCal.selectDay('+C+",'"+validMonthArray[O]+"')\">":"";J+=C;J+=(M&&!D)?"</a>":"";J+="</td>"}J+="</tr>"}J+='<tr><td height="20" class="calHeader">&nbsp;</td>';J+='<td colspan="5" class="calHeader"><a href="javascript:gCal.closeMe()">'+sClose+"</a></td>";J+='<td class="calHeader">&nbsp;</td></tr></table>';return J};Calendar.prototype.getDaysInMonth=function(D,A){if(D==2){var C=(D<=2)?A:A*1+1;var B=new Date(Date.UTC(C,1,29));return(B.getMonth()==1)?29:28}else{return(D==4||D==6||D==9||D==11)?30:31}};Calendar.prototype.getElementX=function(B){var A=B.offsetLeft;var C=B.offsetParent;while(C){A+=C.offsetLeft;C=C.offsetParent}return A};Calendar.prototype.getElementY=function(A){var C=A.offsetTop;var B=A.offsetParent;while(B){C+=B.offsetTop;B=B.offsetParent}return C};Calendar.prototype.closeMe=function(){this._calContainer.style.left="";this._calContainer.style.top="";this._calContainer.style.display="none";$("#selectObscurer").css("display","none")};Calendar.prototype.movePrevious=function(){if(this._currentMonth>0){this._currentMonth--}else{this._currentMonth=0}var A=this.buildCalendar(this._currentMonth);this._calContainer.innerHTML=A};Calendar.prototype.moveNext=function(){if(this._currentMonth<validMonthArray.length-1){this._currentMonth++}else{this._currentMonth=validMonthArray.length-1}var A=this.buildCalendar(this._currentMonth);this._calContainer.innerHTML=A};Calendar.prototype.selectDay=function(B,A){if(B*1<10){B="0"+B}selectOption(this.objDay,B);selectOption(this.objMonthYear,A);this.closeMe()};Calendar.prototype.getCurrentMonth=function(B){for(var A=0;A<validMonthArray.length;A++){if(validMonthArray[A]==B.val()){return A;break}}};Calendar.prototype.getMonth=function(A){return A.substring(0,2)};Calendar.prototype.getYear=function(A){return A.substring(2,6)};Calendar.prototype.getFullYear=function(A){fullyear=A.getYear();return(fullyear<1000)?fullyear+=1900:fullyear}};