
Date.prototype.getWeek=function(){var year=this.getFullYear();var newYear=new Date(year,0,1);var modDay=newYear.getDay();if(modDay==0)modDay=6;else modDay--;var daynum=((Date.UTC(year,this.getMonth(),this.getDate(),0,0,0)-Date.UTC(year,0,1,0,0,0))/1000/60/60/24)+1;if(modDay<4){var weeknum=Math.floor((daynum+modDay-1)/7)+1;}else{var weeknum=Math.floor((daynum+modDay-1)/7);if(weeknum==0){year--;var prevNewYear=new Date(year,0,1);var prevmodDay=prevNewYear.getDay();if(prevmodDay==0)prevmodDay=6;else prevmodDay--;if(prevmodDay<4)weeknum=53;else weeknum=52;}}
return+weeknum;}
var swazzPackage={now:null,sccm:null,sccy:null,ccm:null,ccy:null,updobj:null,left:null,top:null,mnn:null,mnl:null,calvalarr:null,valobjarr:null,delay:null,minDayDiff:null,printWeek:null,dy:null,mn:null,g_PopupIFrame:null,activeCal:null,init:function(){this.now=new Date;this.sccm=this.now.getMonth();this.sccy=this.now.getFullYear();this.ccm=this.now.getMonth();this.ccy=this.now.getFullYear();this.updobj=new Array(2);this.updobj[0]=new Array(2);this.updobj[1]=new Array(2);this.delay=window.delay?delay:3;this.minDayDiff=window.minDayDiff?minDayDiff:0;this.tripLength=window.tripLength?tripLength:7;this.printWeek=window.printWeek?printWeek:false;this.dy=window.dy?dy:new Array('M','T','W','T','F','S','S');this.mn=window.mn?mn:new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');this.mnn=new Array('31','28','31','30','31','30','31','31','30','31','30','31');this.mnl=new Array('31','29','31','30','31','30','31','31','30','31','30','31');this.calvalarr=new Array(42);this.calobjarr=new Array(42);this.weekobjarr=new Array(6);document.write('<table id="fcP" class="fc_container" style="display:none">');document.write('<tr><td class="fc_container_td">');document.write('<table class="fc"><tr>');if(this.printWeek)document.write('<td class="fc_element fc_week_title"  onclick="swazzPackage.csubm()">&nbsp;</td>');document.write('<td class="fc_element fc_title" onclick="swazzPackage.csubm()"><div class="fc_element fc_subm"></div></td><td id="mnsP" class="fc_element fc_title" colspan=5 align="center"></td><td class="fc_element fc_title" align="right" onclick="swazzPackage.caddm()"><div class="fc_element fc_addm"></div></td></tr><tr>');if(this.printWeek)document.write('<td class="fc_element fc_week_dayOfWeek">&nbsp;</td>');document.write('<td class="fc_element fc_dayOfWeek">'+this.dy[0]+'</td><td class="fc_element fc_dayOfWeek">'+this.dy[1]+'</td><td class="fc_element fc_dayOfWeek">'+this.dy[2]+'</td><td class="fc_element fc_dayOfWeek">'+this.dy[3]+'</td><td class="fc_element fc_dayOfWeek">'+this.dy[4]+'</td><td class="fc_element fc_dayOfWeek">'+this.dy[5]+'</td><td class="fc_element fc_dayOfWeek">'+this.dy[6]+'</td></tr>');for(var kk=1;kk<=6;kk++){document.write('<tr>');if(this.printWeek)document.write('<td id="wP'+kk+'" class="fc_element fc_weekNo">.</td>');for(var tt=1;tt<=7;tt++){num=7*(kk-1)-(-tt);document.write('<td id="vP'+num+'" class="fc_element">&nbsp;</td>');this.calobjarr[num]=this.getObj("vP"+num);}
document.write('</tr>');}
document.write('</table>');document.write('</td></tr>');document.write('</table>');var ptr=this;var chkClick=function(ev){ptr.checkClick(ev,ptr)};document.all?document.attachEvent('onclick',chkClick):document.addEventListener('click',chkClick,false);},prepcalendar:function(hd,cm,cy){var cd,sd,td,htd,dip,obj,marr;var calNo=this.activeCal;this.now=new Date();sd=this.now.getDate();td=new Date();td.setDate(1);td.setFullYear(cy);td.setMonth(cm);cd=(td.getDay()+6)%7;this.getObj('mnsP').innerHTML=this.mn[cm]+' '+cy;marr=((cy%4)==0)?this.mnl:this.mnn;if(this.printWeek){var weekNo=td.getWeek();for(var d=1;d<7;d++){if(this.weekobjarr[d]==null){this.weekobjarr[d]=document.getElementById("wP"+d);}
this.weekobjarr[d].innerHTML=weekNo+d-1;}}
for(var d=1;d<=42;d++){obj=this.calobjarr[d];if((d>=(cd-(-1)))&&(d<=cd-(-marr[cm]))){obj.innerHTML=(d-cd);this.calvalarr[d]=''+(d-cd)+'/'+(cm-(-1))+'/'+cy;}else{obj.innerHTML='&nbsp;';this.calvalarr[d]='';}
this.setCss(obj,this);}},setCss:function(obj,ptr){var ptr=this;var click0=function(ev){ptr.cs_click0(ev,ptr)};var click1=function(ev){ptr.cs_click1(ev,ptr)};var cs_over=function(ev){ptr.cs_over(ev,ptr)};var cs_out=function(ev){ptr.cs_out(ev,ptr)};var calNo=ptr.activeCal;var date1=ptr.getElementDate(0,ptr);var date2=ptr.getElementDate(1,ptr);var strDate=ptr.calvalarr[obj.id.substring(2,obj.id.length)];var arrDate=strDate.split('/');var date=new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate());date.setYear(arrDate[2]);date.setMonth((arrDate[1]-1));date.setDate(arrDate[0]);var datetemp=new Date((new Date).getFullYear(),(new Date).getMonth(),((new Date).getDate()+this.delay));datetemp.setYear((new Date).getFullYear());datetemp.setMonth((new Date).getMonth());datetemp.setDate(((new Date).getDate()+this.delay));if(calNo==0){obj.onclick=click0;}else{obj.onclick=click1;}
obj.onmouseover=cs_over;obj.onmouseout=cs_out;if(date<datetemp){obj.onclick=null;obj.onmouseover=null;obj.onmouseout=null;obj.className='fc_element fc_datePast';}else if(date.getDate()==date1.getDate()&&date.getMonth()==date1.getMonth()&&date.getFullYear==date1.getFullYear){obj.className='fc_element fc_date1';}else if(date.getDate()==date2.getDate()&&date.getMonth()==date2.getMonth()&&date.getFullYear==date2.getFullYear){obj.className='fc_element fc_date2';}else if(date<date1){obj.className='fc_element fc_dateBefore';}else if(date>date2){obj.className='fc_element fc_dateAfter';}else{obj.className='fc_element fc_dateRegular';}},lcs:function(ielem1,ielem2,calNo){var curdtarr,isdt;this.activeCal=calNo;if(this.updobj[0][0]==null){this.updobj[0][0]=this.getObj(ielem1);this.updobj[1][0]=this.getObj(ielem2);}
curdtarr=this.updobj[calNo][0].value.split('/');isdt=true;for(var k=0;k<curdtarr.length;k++){if(isNaN(curdtarr[k]))
isdt=false;}
if(isdt&(curdtarr.length==3)){this.ccm=curdtarr[1]-1;this.ccy=curdtarr[2];this.prepcalendar(curdtarr[0],curdtarr[1]-1,curdtarr[2]);}else{this.prepcalendar('',this.ccm,this.ccy);}
this.ShowPopupDiv('fcP',this.Left(this.updobj[calNo][0]),this.Top(this.updobj[calNo][0])+this.updobj[calNo][0].offsetHeight);},ddlcs:function(dayDD1,monthDD1,dayDD2,monthDD2,calNo){var curdtarr;if(this.updobj[0][0]==null){this.updobj[0][0]=this.getObj(dayDD1);this.updobj[0][1]=this.getObj(monthDD1);this.updobj[1][0]=this.getObj(dayDD2);this.updobj[1][1]=this.getObj(monthDD2);}
this.activeCal=calNo;curdtarr=this.updobj[calNo][1].options[this.updobj[calNo][1].selectedIndex].value.split('/');if(isNaN(this.updobj[calNo][0].options[this.updobj[calNo][0].selectedIndex].value)==false&&isNaN(curdtarr[0]-1)==false&&isNaN(curdtarr[1])==false){this.ccm=curdtarr[0]-1;this.ccy=curdtarr[1];this.prepcalendar(this.updobj[calNo][0].options[this.updobj[calNo][0].selectedIndex].value,curdtarr[0]-1,curdtarr[1]);}else{this.prepcalendar('',this.ccm,this.ccy);}
this.ShowPopupDiv('fcP',this.Left(this.updobj[calNo][0]),this.Top(this.updobj[calNo][0])+this.updobj[calNo][0].offsetHeight);},IsIE:function(){return(navigator.appName=="Microsoft Internet Explorer");},HidePopupDiv:function(divID){var divPopup;divPopup=this.getObj(divID);divPopup.style.display='none';if(this.IsIE()&&this.g_PopupIFrame){document.body.removeChild(this.g_PopupIFrame);this.g_PopupIFrame=null;}},ShowPopupDiv:function(divID,left,top){var divPopup=this.getObj(divID);divPopup.style.left=left+"px";divPopup.style.top=top+"px";if(!this.IsIE()){divPopup.style.display='';return;}
if(this.g_PopupIFrame){this.HidePopupDiv(divID);}
divPopup.style.zIndex=divPopup.style.zIndex+1;divPopup.style.display='';var iFrame=document.createElement("IFRAME");iFrame.setAttribute("src","");iFrame.style.position="absolute";iFrame.style.left=left+'px';iFrame.style.top=top+'px';iFrame.style.width=divPopup.offsetWidth+'px';iFrame.style.height=divPopup.offsetHeight+'px';document.body.appendChild(iFrame);this.g_PopupIFrame=iFrame;divPopup.style.display='';},selectValue:function(val,dd){for(var i=0;i<dd.length;i++){if(dd[i].value==val){dd.selectedIndex=i;return 1;}}
return 0;},isChild:function(s,d){while(s){if(s==d)
return true;s=s.parentNode;}
return false;},caddm:function(){marr=((this.ccy%4)==0)?this.mnl:this.mnn;this.ccm+=1;if(this.ccm>=12){this.ccm=0;this.ccy++;}
this.cdayf();this.prepcalendar('',this.ccm,this.ccy);},csubm:function(){marr=((this.ccy%4)==0)?this.mnl:this.mnn;this.ccm-=1;if(this.ccm<0){this.ccm=11;this.ccy--;}
this.cdayf();this.prepcalendar('',this.ccm,this.ccy);},cdayf:function(){if((this.ccy>this.sccy)|((this.ccy==this.sccy)&&(this.ccm>=this.sccm)))
return;else{this.ccy=this.sccy;this.ccm=this.sccm;}},Left:function(obj){var curleft=0;if(obj.offsetParent)
{while(obj.offsetParent)
{curleft+=obj.offsetLeft
obj=obj.offsetParent;}}
else if(obj.x)
curleft+=obj.x;return curleft;},Top:function(obj){var curtop=0;if(obj.offsetParent)
{while(obj.offsetParent)
{curtop+=obj.offsetTop
obj=obj.offsetParent;}}
else if(obj.y)
curtop+=obj.y;return curtop;},checkClick:function(e,ptr){var obj=ptr.getObj('fcP');e?evt=e:evt=event;CSE=evt.target?evt.target:evt.srcElement;if(obj){if(!ptr.isChild(CSE,obj)){ptr.HidePopupDiv('fcP');}}},cs_over:function(e,ptr){var date=ptr.calvalarr[ptr.evtTgt(ptr.EvtObj(e)).id.substring(2,ptr.evtTgt(ptr.EvtObj(e)).id.length)];if(ptr.evtTgt(ptr.EvtObj(e)).className=='fc_element fc_dateHighlighted'){return;}else{ptr.evtTgt(ptr.EvtObj(e)).className='fc_element fc_mouseOver';}},cs_out:function(e,ptr){var date=ptr.calvalarr[ptr.evtTgt(ptr.EvtObj(e)).id.substring(2,ptr.evtTgt(ptr.EvtObj(e)).id.length)];if(ptr.evtTgt(ptr.EvtObj(e)).className=='fc_element fc_dateHighlighted'){return;}else{ptr.evtTgt(ptr.EvtObj(e)).className='fc_element fc_dateRegular';ptr.setCss(ptr.evtTgt(ptr.EvtObj(e)),ptr);}},cs_click0:function(e,ptr){var curdtarr;if(ptr.updobj[0][0].length>3){var date=ptr.calvalarr[ptr.evtTgt(ptr.EvtObj(e)).id.substring(2,ptr.evtTgt(ptr.EvtObj(e)).id.length)];curdtarr=date.split('/');ptr.selectValue((curdtarr[0]),ptr.updobj[0][0]);ptr.selectValue((curdtarr[1]+"/"+curdtarr[2]),ptr.updobj[0][1]);}else{ptr.updobj[0][0].value=ptr.calvalarr[ptr.evtTgt(ptr.EvtObj(e)).id.substring(2,ptr.evtTgt(ptr.EvtObj(e)).id.length)];}
var date1=ptr.getElementDate(0,ptr)
var date2=ptr.getElementDate(1,ptr)
if(date1>date2){date1.setDate(date1.getDate()+ptr.tripLength);ptr.setElementDate(1,ptr,date1);}
ptr.HidePopupDiv('fcP');},cs_click1:function(e,ptr){var curdtarr;if(ptr.updobj[1][0].length>3){var date=ptr.calvalarr[ptr.evtTgt(ptr.EvtObj(e)).id.substring(2,ptr.evtTgt(ptr.EvtObj(e)).id.length)];curdtarr=date.split('/');ptr.selectValue((curdtarr[0]),ptr.updobj[1][0]);ptr.selectValue((curdtarr[1]+"/"+curdtarr[2]),ptr.updobj[1][1]);}else{ptr.updobj[1][0].value=ptr.calvalarr[ptr.evtTgt(ptr.EvtObj(e)).id.substring(2,ptr.evtTgt(ptr.EvtObj(e)).id.length)];}
var date1=ptr.getElementDate(0,ptr)
var date2=ptr.getElementDate(1,ptr)
if(date1>date2){date2.setDate(date2.getDate()-ptr.tripLength);date1=new Date;date1.setDate(date1.getDate()+ptr.delay);if(date2<date1){date2=date1;}
ptr.setElementDate(0,ptr,date2)}
ptr.HidePopupDiv('fcP');},getElementDate:function(cal,ptr){var curdtarr;var returnDate=null;if(ptr.updobj[1][0].length>3){curdtarr=ptr.updobj[cal][1].value.split('/');returnDate=new Date(curdtarr[1],(curdtarr[0]-1),(parseInt(ptr.updobj[cal][0].value)+parseInt(ptr.minDayDiff)));}else{curdtarr=ptr.updobj[cal][0].value.split('/');returnDate=new Date(curdtarr[2],(curdtarr[1]-1),curdtarr[0]);}
return returnDate;},setElementDate:function(cal,ptr,newDate){if(ptr.updobj[cal][0].length>3){ptr.selectValue(newDate.getDate(),ptr.updobj[cal][0]);ptr.selectValue(((newDate.getMonth()+1)+"/"+newDate.getFullYear()),ptr.updobj[cal][1]);}else{ptr.updobj[cal][0].value=newDate.getDate()+"/"+(newDate.getMonth()+1)+"/"+newDate.getFullYear();}},EvtObj:function(e){if(!e)
e=window.event;return e;},evtTgt:function(e)
{var el;if(e.target)
el=e.target;else if(e.srcElement)
el=e.srcElement;if(el.nodeType==3)
el=el.parentNode;return el;},getObj:function(objID){if(document.getElementById){return document.getElementById(objID);}else if(document.all){return document.all[objID];}else if(document.layers){return document.layers[objID];}}}
swazzPackage.init();
