var s={};s.day=new Array();s.day[0]="S";s.day[1]="M";s.day[2]="T";s.day[3]="W";s.day[4]="T";s.day[5]="F";s.day[6]="Sa";s.month=new Array();s.month[0]="Jan";s.month[1]="Feb";s.month[2]="Mar";s.month[3]="Apr";s.month[4]="May";s.month[5]="Jun";s.month[6]="Jul";s.month[7]="Aug";s.month[8]="Sep";s.month[9]="Oct";s.month[10]="Nov";s.month[11]="Dec";s.monthDays=new Array();s.monthDays[0]=31;s.monthDays[1]=28;s.monthDays[2]=31;s.monthDays[3]=30;s.monthDays[4]=31;s.monthDays[5]=30;s.monthDays[6]=31;s.monthDays[7]=31;s.monthDays[8]=30;s.monthDays[9]=31;s.monthDays[10]=30;s.monthDays[11]=31;s.currentMonthRange=new Array();for(i=0;i<42;i++){s.currentMonthRange[i]=0}s.refMonth="Jan";s.refYear="1980";s.refDate="1";s.refDay="Tue";s.currYear="";s.currMonth="";s.currDate=1;s.posFirstDate=0;s.posLastDate=0;s.daysInMonth=31;s.daysInLastMonth=31;s.offset=0;var fill="";function _init(B){fill="";fill+='<div class="prevmonth" onclick="_initi(-1)">&#171;</div>';fill+='<div class="calendarheader"><div class="calendarheadertext" id="calendarheadertext"></div></div>';fill+='<div class="nextmonth" onclick="_initi(1)">&#187;</div>';fill+='<div style="clear:both"></div>';fill+='<div class="daycontainer">';for(i=0;i<s.day.length;i++){fill+='<div class="days">'+s.day[i]+"</div>"}fill+='<div style="clear:both"></div>';fill+="</div>";fill+='<div class="main" id="main">';fill+="</div>";if(!document.getElementById("container")){var A=document.createElement("div");A.id="container";A.innerHTML=fill;document.body.appendChild(A)}else{var A=document.getElementById("container");A.innerHTML=fill}s.date=new Date();if(B==0){s.offset=0}if(B==-1){s.offset-=1}if(B==1){s.offset+=1}s.date.setMonth(s.date.getMonth()+s.offset);if(s.offset==0){_fM(parseInt(s.date.getDate()),parseInt(s.date.getMonth()),parseInt(s.date.getFullYear()))}else{_fM(parseInt(s.date.getDate()),parseInt(s.date.getMonth()),parseInt(s.date.getFullYear()))}}function _fM(B,A,C){_gM(A,C);_gDR(A,C);document.getElementById("main").innerHTML="";for(i=1;i<=36;i+=7){for(j=i;j<=i+6;j++){if(j<=42){k=s.currentMonthRange[j-1];if((j-1)%7==0&&(j<=s.posFirstDate||j>s.posLastDate+1)){document.getElementById("main").innerHTML+='<div class="dateboxsundayzeros">'+k+"</div>"}else{if((j-1)%7!=0&&(j<=s.posFirstDate||j>s.posLastDate+1)){document.getElementById("main").innerHTML+='<div class="dateboxzeros">'+k+"</div>"}else{if((j-1)%7==0&&k==B){document.getElementById("main").innerHTML+='<div class="dateboxsundaytoday">'+k+"</div>"}else{if((j-1)%7==0){document.getElementById("main").innerHTML+='<div class="dateboxsunday">'+k+"</div>"}else{if(k==B){document.getElementById("main").innerHTML+='<div class="dateboxtoday">'+k+"</div>"}else{if(k!=B){document.getElementById("main").innerHTML+='<div class="datebox">'+k+"</div>"}}}}}}}}document.getElementById("main").innerHTML+='<div style="clear:both"></div>'}}function _gM(A,B){document.getElementById("calendarheadertext").innerHTML=(s.month[A]+" "+B)}function _gDR(A,B){s.currYear=B;s.currMonth=s.month[parseInt(A)];s.daysInMonth=_gDM(A,B);offset=(_gFD()-6)%7;s.date=new Date();s.date.setMonth(parseInt(s.date.getMonth())+s.offset-1);s.daysInLastMonth=_gDM(s.date.getMonth(),s.date.getFullYear());for(i=offset,j=1;i<offset+s.daysInMonth;i++,j++){s.currentMonthRange[i]=(j)}s.posFirstDate=s.currentMonthRange.indexOf(1);s.posLastDate=s.currentMonthRange.indexOf(s.daysInMonth);for(i=s.posFirstDate-1,j=s.daysInLastMonth;i>=0;i--){s.currentMonthRange[i]=j;j--}for(i=s.posLastDate+1,j=1;i<=42;i++){s.currentMonthRange[i]=j;j++}}function _gDM(A,B){if(B%4==0&&A==1){return 29}else{return s.monthDays[A]}}function _gFD(){s.nod=0;for(i=s.refYear;i<s.currYear;i++){if(i%4==0){s.nod+=366}else{s.nod+=365}}for(i=s.month.indexOf("Jan");i<s.month.indexOf(s.currMonth);i++){if(i==1&&(s.currYear%4)==0){s.nod+=29}else{s.nod+=s.monthDays[i]}}s.nod+=parseInt(s.currDate);return(s.nod)}function _initi(A){s.posFirstDate=0;s.posLastDate=0;for(i=0;i<42;i++){s.currentMonthRange[i]=0}s.date=new Date();if(A==-1){s.offset-=1}if(A==1){s.offset+=1}s.date.setMonth(s.date.getMonth()+s.offset);_fM(parseInt(s.date.getDate()),parseInt(s.date.getMonth()),parseInt(s.date.getFullYear()))};
