if(typeof (iMonth)=="undefined"){iMonth=new Date().getMonth()}if(typeof (iYear)=="undefined"){iYear=new Date().getFullYear()}if(typeof (iDay)=="undefined"){iDay=new Date().getDate()}if(typeof (itype)=="undefined"){itype="loose"}if(typeof (imaxDays)=="undefined"){imaxDays=330}if(typeof (stDay)=="undefined"){startDay=iDay}if(typeof (stMonth)=="undefined"){startMonth=iMonth}if(typeof (stYear)=="undefined"){startYear=iYear}if(typeof (addZero)=="undefined"){addZero=true}if(typeof (offX)=="undefined"){offX=10}if(typeof (offY)=="undefined"){offY=-10}if(typeof (formatInputs)=="undefined"){formatInputs=1}if(typeof (formatSplitter)=="undefined"){formatSplitter="/"}if(typeof (monthFormat)=="undefined"){monthFormat="mm"}if(typeof (yearFormat)=="undefined"){yearFormat="yyyy"}if(typeof (folowMouse)=="undefined"){folowMouse=true}if(typeof (formatType)=="undefined"){formatType="dd"+formatSplitter+monthFormat+formatSplitter+yearFormat}if(typeof (callNotice)=="undefined"){callNotice="fallsilent()"}if(window.addEventListener){window.addEventListener("load",createBase,false)}else{if(window.attachEvent){window.attachEvent("onload",createBase)}else{if(document.getElementById){window.onload=createBase}}}document.onmousemove=getMouseXY;var IE=document.all?true:false;if(!IE){document.captureEvents(Event.MOUSEMOVE)}var tempX=0;var tempY=0;function getMouseXY(A){if(IE){tempX=event.clientX+(document.documentElement.scrollLeft);tempY=event.clientY+(document.documentElement.scrollTop)}else{tempX=A.pageX;tempY=A.pageY}if(tempX<0){tempX=0}if(tempY<0){tempY=0}return true}function getScrollXY(){var B=0,A=0;if(typeof (window.pageYOffset)=="number"){A=window.pageYOffset;B=window.pageXOffset}else{if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){A=document.body.scrollTop;B=document.body.scrollLeft}else{if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){A=document.documentElement.scrollTop;B=document.documentElement.scrollLeft}}}return[B,A]
}var d=document;function cel(A){return d.createElement(A)}function sa(B,C,A){return B.setAttribute(C,A)}function appendc(B,A){return B.appendChild(A)}function cNode(B,A){return B.appendChild(d.createTextNode(A))}function getID(A){return d.getElementById(A)}var DayCol=new Array("M","T","W","T","F","S","S");var MonthCol=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");function getDaysInMonth(C,B){var A=new Array(31,28,31,30,31,30,31,31,30,31,30,31);if(C==1){A[1]=((B%400==0)||((B%4==0)&&(B%100!=0)))?29:28}return A[C]}var cw={currMonth:iMonth,currYear:iYear,currDay:iDay,selMonth:iMonth,selYear:iYear,selDay:iDay,config:itype,maxDays:imaxDays,stMonth:startMonth,stYear:startYear,stDay:startDay,endMonth:11,endYear:iYear,endDay:31,addZ:addZero,setMarks:function(){if(this.config=="strict"){this.stDay=iDay;this.stMonth=iMonth;this.stYear=iYear;this.getEnd()}},getConfMonths:function(){if(this.config=="strict"){cw.setMarks()}mthCol=cel("ul");mthCol.id="months";k=0;for(i=0;i<12;i++){mth=cel("li");if(cw.isValidMonth(i)){mth.className="months";if(cw.isCurrentMonth(i)){mth.className="currMonth"}mtha=cel("a");mtha.href="javascript:modMonth("+this.selYear+","+i+")";mtha.innerHTML=MonthCol[i];appendc(mth,mtha)}else{mth.className="monthDisabled";mth.innerHTML=MonthCol[i]}appendc(mthCol,mth)}cw.setBrowseYears();return mthCol},getConfDays:function(){dayCol=cel("ul");dayCol.id="days";for(i=0;i<7;i++){dayCell=cel("li");dayCell.className="headDay";dayCell.innerHTML=DayCol[i];appendc(dayCol,dayCell)}var A=new Date(this.selYear,this.selMonth,1).getDay();A--;if(A<0){A=6}for(i=0;i<A;i++){dayCell=cel("li");dayCell.className="dayBlank";dayCell.innerHTML="&nbsp;";appendc(dayCol,dayCell)}for(i=1;i<=getDaysInMonth(this.selMonth,this.selYear);i++){dayCell=cel("li");if(cw.isValidDate(i)){dayCell.className="dayNormal";if(cw.isWeekend(i)){dayCell.className="dayWeekend"}if(cw.isCurrentDay(i)){dayCell.className="dayCurrent"}dayLink=cel("a");dayLink.href="javascript: newDay("+i+");fillBackDate("+i+","+this.selMonth+","+this.selYear+")";
dayLink.innerHTML=i;appendc(dayCell,dayLink)}else{dayCell.className="dayDisabled";dayCell.innerHTML=i}appendc(dayCol,dayCell)}return dayCol},getEnd:function(){imaxD=imaxDays-(getDaysInMonth(this.stMonth,this.stYear)-this.stDay);tmpM=this.stMonth;tmpY=this.stYear;tmpD=this.stDay;i=0;while(imaxD>=getDaysInMonth(tmpM,tmpY)){tmpM++;if(tmpM>11){tmpM=0;tmpY++}tmpD=imaxD-=getDaysInMonth(tmpM,tmpY)}tmpM++;if(tmpM>11){tmpM=0;tmpY++}this.endMonth=tmpM;this.endDay=tmpD;this.endYear=tmpY},isValidDate:function(A){if(this.config=="loose"){return true}if(this.selYear==this.stYear){if(this.selMonth<this.stMonth){return false}if(this.selMonth==this.stMonth&&A<this.stDay){return false}}if(this.selYear==this.endYear){if(this.selMonth>this.endMonth){return false}if(this.selMonth==this.endMonth&&A>this.endDay){return false}}if(this.selYear==this.endYear&&this.selYear==this.stYear){if(this.selMonth>this.endMonth||this.selMonth<this.stMonth){return false}}if(this.selYear>this.endYear){return false}return true},isWeekend:function(A){sun=new Date(this.selYear,this.selMonth,A).getDay();if(sun==6||sun==0){return true}return false},isCurrentDay:function(A){if(this.selDay==A){return true}return false},setBrowseYears:function(){brsY=cel("li");brsY.className="yearBrowse";if(this.selYear<=this.stYear&&this.config=="strict"){backB=cel("span")}else{backB=cel("a");backB.href="javascript: modYear(-1)"}backB.innerHTML="&laquo;&nbsp;";yText=cel("b");yText.innerHTML=cw.selYear;if(this.selYear>=this.endYear&&this.config=="strict"){fwdB=cel("span")}else{fwdB=cel("a");fwdB.href="javascript: modYear(1)"}fwdB.innerHTML="&nbsp;&raquo;";appendc(brsY,backB);appendc(brsY,yText);appendc(brsY,fwdB);appendc(mthCol,brsY)},isValidMonth:function(A){if(this.config=="loose"){return true}else{if(this.selYear<this.stYear){return false}if(this.selYear==this.stYear&&A<this.stMonth){return false}if(this.selYear>this.endYear){return false}if(this.selYear==this.endYear&&A>this.endMonth){return false}}return true},isCurrentMonth:function(A){if(A==this.selMonth){return true
}return false}};cw.setMarks();function createBase(){var B=cel("div");B.id="calendar";B.style.display="none";if(typeof (elToAppend)=="undefined"){tDocument=document.getElementsByTagName("body").item(0)}else{var A=elToAppend;tDocument=document.getElementById(A)}appendc(tDocument,B)}function createCalendarElements(){var B="calendar";var A=cel("div");A.id="elements";while(document.getElementById(B).firstChild){document.getElementById(B).removeChild(document.getElementById(B).firstChild)}appendc(document.getElementById(B),A);mthCol=cw.getConfMonths();appendc(A,mthCol);dayStruct=cw.getConfDays();appendc(A,dayStruct);closeBtn=cel("div");closeBtn.id="closeBtn";closeBtna=cel("a");closeBtna.href="javascript: closeCalendar()";closeBtna.innerHTML="close";appendc(closeBtn,closeBtna);appendc(document.getElementById(B),closeBtn)}function modMonth(A,B){cw.selYear=A;cw.selMonth=B;createCalendarElements()}function newDay(A){cw.selDay=A;createCalendarElements()}function modYear(A){cw.selYear=parseInt(cw.selYear)+parseInt(A);createCalendarElements()}var datas;var elem1;var elem2;var elem3;var mA=0;var yA=0;var mm=new Array("mm","mmm");var yy=new Array("yy","yyyy");function fPopCalendar(D,C,B){tmpString=new String();if(formatInputs==1){elem1=D;tmpString=document.getElementById(elem1).value}if(formatInputs==2){elem1=D;elem2=C;tmpString=document.getElementById(elem1).value+formatSplitter+document.getElementById(elem2).value}if(formatInputs==3){elem1=D;elem2=C;elem3=B;tmpString=document.getElementById(elem1).value+formatSplitter+document.getElementById(elem2).value+formatSplitter+document.getElementById(elem3).value}datas=tmpString.split(formatSplitter);tmpo=formatType.split(formatSplitter);dC="";tC="";if(datas.length==tmpo.length){for(i=0;i<datas.length;i++){if(datas[i].length<2){datas[i]="0"+datas[i]}dC+=datas[i];tC+=tmpo[i]}if(dC.length==tC.length){orderData()}}else{datas=new Array(cw.selDay,cw.selMonth,cw.selYear)}createCalendarElements();offsets=getScrollXY();document.getElementById("calendar").style.display="block";
if(folowMouse){var A=navigator.appName;if(A=="Microsoft Internet Explorer"){document.getElementById("calendar").style.left=parseInt(tempX)+parseInt(offX)+parseInt(offsets[0])+"px";document.getElementById("calendar").style.top=parseInt(tempY)+parseInt(offY)+parseInt(offsets[1])+"px"}else{document.getElementById("calendar").style.left=parseInt(tempX)+parseInt(offX)+"px";document.getElementById("calendar").style.top=parseInt(tempY)+parseInt(offY)+"px"}}order=new String(formatType).split(formatSplitter);for(i=0;i<mm.length;i++){for(j=0;j<order.length;j++){if(mm[i]==order[j]){mA=i}if(yy[i]==order[j]){yA=i}}}window.oldOnMouseUp=document.onmouseup;document.onmouseup=handleClickAway}function orderData(){order=new String(formatType).split(formatSplitter);for(i=0;i<order.length;i++){for(j=0;j<mm.length;j++){if(mm[j]==order[i]){cw.selMonth=datas[i];if(cw.selMonth.slice(0,1)==0){cw.selMonth=parseInt(cw.selMonth.slice(1,cw.selMonth.length))-1}else{if(cw.selMonth.length<3){cw.selMonth=parseInt(cw.selMonth)-1}}if(j==1){for(k=0;k<MonthCol.length;k++){if(MonthCol[k].toLowerCase()==cw.selMonth.toLowerCase()){cw.selMonth=k;break}}}}if(yy[j]==order[i]){cw.selYear=datas[i];if(cw.selYear.slice(0,1)==0){cw.selYear=parseInt(cw.selYear.slice(1,cw.selYear.length))}if(j==0){cw.selYear=2000+parseInt(cw.selYear)}}}if(order[i].toLowerCase()=="dd"){cw.selDay=datas[i];if(cw.selDay.slice(0,1)==0){cw.selDay=parseInt(cw.selDay.slice(1,cw.selDay.length))}}}}function fillBackDate(A,C,B){if(mA==1){C=MonthCol[C]}if(mA==0){C++;if(C<10&&cw.addZ==true){C="0"+C}}if(yA==0){B=new String(B).slice(2,4)}if(A<10&&cw.addZ==true){A="0"+A}if(formatType.slice(0,2)!="dd"){tmpDATA=A;A=B;B=tmpDATA}if(formatInputs==1){document.getElementById(elem1).value=A+formatSplitter+C+formatSplitter+B}if(formatInputs==2){document.getElementById(elem1).value=A;document.getElementById(elem2).value=C+formatSplitter+B}if(formatInputs==3){document.getElementById(elem1).value=A;document.getElementById(elem2).value=C;document.getElementById(elem3).value=B
}setTimeout(callNotice,0);closeCalendar()}function handleClickAway(B){if(document.all){var A=window.event.srcElement;while(A.parentElement!=null){if(A.id=="calendar"){return true}A=A.parentElement}closeCalendar();return false}else{var A=B.originalTarget;while(A.parentNode!=null){if(A.id=="calendar"){return true}A=A.parentNode}closeCalendar();return false}}function closeCalendar(){var A="calendar";document.getElementById(A).style.display="none";document.onmouseup=window.oldOnMouseUp}function fallsilent(){};