function EKFadeAnim(a,b){this.opacity=0;this.interval=10;this.increment=25;this.elementStyle=a.style;if(b){this.relatedStyle=b.style}this.timer=null}EKFadeAnim.prototype.setOpacity=function(a,b){if(b==0){a.visibility="hidden"}else{a.visibility="visible"}};EKFadeAnim.prototype.stop=function(){if(this.opacity>0){this.setOpacity(this.elementStyle,100);if(this.relatedStyle){this.setOpacity(this.relatedStyle,100)}}};EKFadeAnim.prototype.fadeIn=function(){if(this.timer==null){var a=this;a.fadeInTimer()}};EKFadeAnim.prototype.fadeInTimer=function(){this.setOpacity(this.elementStyle,100);if(this.relatedStyle){this.setOpacity(this.relatedStyle,100)}};EKFadeAnim.prototype.fadeOut=function(){if(this.timer==null){var a=this;a.fadeOutTimer()}};EKFadeAnim.prototype.fadeOutTimer=function(){this.setOpacity(this.elementStyle,0);if(this.relatedStyle){this.setOpacity(this.relatedStyle,0)}};function MangoCalendar(){this.Config=function(){};this.Config.maxScreen=960;this.Config.txtClose="Close";this.Config.txtPrevMonth="Previous month";this.Config.txtNextMonth="Next month";this.Config.monthLong=["January","February","March","April","May","June","July","August","September","October","November","December"];this.Config.monthShort=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];this.Config.dayShort=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];this.Config.firstDay=0;this.Config.monthDays=[31,28,31,30,31,30,31,31,30,31,30,31];this.Config.dateFormat="dd-MMM-yy";this.Config.dateFormatTitle="MMMM, yyyy";this.Config.templateHTML=""}MangoCalendar.prototype.stringFill=function(b,c){var a="";for(;;){if(c&1){a+=b}c>>=1;if(c){b+=b}else{break}}return a};MangoCalendar.prototype.padLeft=function(b,d,a){var c=b+"";while(c.length<a){c=d+c}return c};MangoCalendar.prototype.isNumeric=function(e){var a,f,c,d,b;a="0123456789";f=true;for(d=0,b=e.length;d<b&&f==true;d++){c=e.charAt(d);if(a.indexOf(c)==-1){f=false}}return f};MangoCalendar.prototype.findPos=function(a){var b=function(){};b.x=0;b.y=0;while(a.offsetParent){b.x+=a.offsetLeft;b.y+=a.offsetTop;a=a.offsetParent}return b};MangoCalendar.prototype.getWindowSize=function(){var a=function(){};a.width=0;a.height=0;if(typeof(window.innerWidth)=="number"){a.width=window.innerWidth;a.height=window.innerHeight}else{if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){a.width=document.documentElement.clientWidth;a.height=document.documentElement.clientHeight}else{if(document.body&&(document.body.clientWidth||document.body.clientHeight)){a.width=document.body.clientWidth;a.height=document.body.clientHeight}}}return a};MangoCalendar.prototype.getScrollPosition=function(){var a=function(){};a.x=0;a.y=0;if(typeof(window.pageYOffset)=="number"){a.x=window.pageXOffset;a.y=window.pageYOffset}else{if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){a.x=document.body.scrollLeft;a.y=document.body.scrollTop}else{if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){a.x=document.documentElement.scrollLeft;a.y=document.documentElement.scrollTop}}}return a};MangoCalendar.prototype.leapYear=function(a){return((a%400)===0||((a%4)===0&&(a%100)!==0))};MangoCalendar.prototype.resolveMonth=function(b,c){for(var a=0;a<b.length;a++){if(c.indexOf(b[a])!=-1){return a}}return -1};MangoCalendar.prototype.cleanMonth=function(b,c){for(var a=0;a<b.length;a++){if(c.indexOf(b[a])!=-1){return c.replace(b[a],this.stringFill("M",b[a].length))}}return c};MangoCalendar.prototype.addMonth=function(c,b){var a=new Date(c.getTime());a.setDate(1);if(!b){if(a.getMonth()===0){a.setYear(a.getFullYear()-1);a.setMonth(11)}else{a.setMonth(a.getMonth()-1)}}else{if(a.getMonth()==11){a.setYear(a.getFullYear()+1);a.setMonth(0)}else{a.setMonth(a.getMonth()+1)}}return a};MangoCalendar.prototype.formatDate=function(a,b){var c=false;var f=-1;var g="";var k=b+" ";var e=k.split("");for(var h=0;h<e.length;h++){if(h>0&&(e[h-1]!=e[h])&&!c){f++;switch(e[h-1]){case"d":switch(f){case 1:g=g+a.getDate();break;case 2:g=g+this.padLeft(a.getDate(),"0",2);break}break;case"M":switch(f){case 1:g=g+(a.getMonth()+1);break;case 2:g=g+this.padLeft(a.getMonth()+1,"0",2);break;case 3:g=g+this.Config.monthShort[a.getMonth()];break;case 4:g=g+this.Config.monthLong[a.getMonth()];break}break;case"y":var d=a.getFullYear()+"";switch(f){case 1:if(d.substr(3,1)!="0"){g=g+d.substr(3,1)}else{g=g+d.substr(2,2)}break;case 2:g=g+d.substr(2,2);break;default:g=g+d;break}break;case"\\":g=g+e[h];c=true;break;default:for(j=0;j<f;j++){g=g+e[h-1]}break}f=0}else{f++;c=false}}return g};MangoCalendar.prototype.parseDate=function(a,c){var d=false;var l=-1;var n=0;var m="";var q=c+" ";var g=q.split("");var p=this.startDate.getDate();var h=this.startDate.getMonth();var f=this.startDate.getFullYear();var r=a;if(c.indexOf("MMMM")!=-1){r=this.cleanMonth(this.Config.monthLong,a)}if(c.indexOf("MMM")!=-1){r=this.cleanMonth(this.Config.monthShort,a)}for(var o=0,b=g.length;o<b;o++){if(o>0&&(g[o-1]!=g[o])&&!d){l++;switch(g[o-1]){case"d":switch(l){case 1:if(this.isNumeric(r.substr(o+n-1,2))){p=parseFloat(r.substr(o+n-1,2));n++}else{p=parseFloat(r.substr(o+n-1,1))}break;default:p=parseFloat(r.substr(o+n-l,l))}break;case"M":switch(l){case 1:if(this.isNumeric(r.substr(o+n-1,2))){h=parseFloat(r.substr(o+n-1,2));n++}else{h=parseFloat(r.substr(o+n-1,1))}h--;break;case 2:h=parseFloat(r.substr(o-2,2));h--;break;case 3:h=this.resolveMonth(this.Config.monthShort,a);if(h!=-1){n=n+this.Config.monthShort[h].length-3}break;case 4:h=this.resolveMonth(this.Config.monthLong,a);if(h!=-1){n=n+this.Config.monthShort[h].length-3}break}break;case"y":f=parseFloat(r.substr(o+n-l,l));if(f<100){f=f+2000}break;case"\\":d=true;break}l=0}else{l++;d=false}}try{var e=new Date(f,h,p);if(e.getFullYear()==f&&e.getMonth()==h&&e.getDate()==p){if(e<this.startDate){e.setTime(this.startDate.getTime())}if(e>this.endDate){e.setTime(this.endDate.getTime());e.setDate(1)}return e}}catch(k){return this.startDate}return this.startDate};MangoCalendar.prototype.preloadImages=function(){if(false){for(var b=0;b<this.Config.calendarImages.length;b++){var a=new Image(1,1);a.src=this.Config.imagePath+this.Config.calendarImages[b]}}};MangoCalendar.prototype.initialize=function(){var IE6=false
/*@cc_on || @_jscript_version < 5.7 @*/
;this.iframe=null;if(IE6){this.iframe=document.createElement("IFRAME");this.iframe.className="calendar";this.iframe.border="0";document.body.appendChild(this.iframe)}this.calendarDiv=document.createElement("DIV");this.calendarDiv.id="calendarDiv";this.calendarDiv.onselectstart=function(){return false};this.calendarDiv.onmousedown=function(){return false};var oThis=this;this.oldKeyDown=document.onkeydown;document.onkeydown=function(oEvent){oEvent=oEvent||window.event;return oThis.handleKeyDown(oEvent)};this.oldMouseDown=document.onmousedown;document.onmousedown=function(oEvent){oEvent=oEvent||window.event;return oThis.handleMouseDown(oEvent)};this.calendarDiv.style.zIndex=-1000;document.body.appendChild(this.calendarDiv);this.calendarDiv.innerHTML=this.Config.templateHTML;if(this.iframe){this.fade=new EKFadeAnim(this.calendarDiv,this.iframe)}else{this.fade=new EKFadeAnim(this.calendarDiv,null)}this.parseTemplate();this.refreshData()};MangoCalendar.prototype.handleKeyDown=function(a){if(a.keyCode==27){this.closeCalendar()}if(this.oldKeyDown){return this.oldKeyDown(a)}};MangoCalendar.prototype.handleMouseDown=function(b){var a=b.target||b.srcElement;bInCalendar=false;while(a){if(a==this.calendarDiv||a==this.returnDateTo){bInCalendar=true}a=a.parentNode}if(!bInCalendar){this.closeCalendar()}if(this.oldMouseDown){return this.oldMouseDown(b)}return true};MangoCalendar.prototype.parseTemplate=function(){this.calendarLeft=document.getElementById("calendarLeft");this.calendarRight=document.getElementById("calendarRight");this.monthLeft=document.getElementById("monthLeft");this.monthRight=document.getElementById("monthRight");this.prevMonth=document.getElementById("prevMonth");this.nextMonth=document.getElementById("nextMonth");this.dataLeft=document.getElementById("dataLeft");this.dataRight=document.getElementById("dataRight");var b=document.getElementById("daysLeft");for(var c=0;c<this.Config.dayShort.length;c++){b.cells[c].innerHTML=this.Config.dayShort[c]}var a=document.getElementById("daysRight");for(var c=0;c<this.Config.dayShort.length;c++){a.cells[c].innerHTML=this.Config.dayShort[c]}this.prevMonth.title=this.Config.txtPrevMonth;this.nextMonth.title=this.Config.txtNextMonth};MangoCalendar.prototype.switchMonth=function(c){var a=c.target||c.srcElement;var b=this.outputDate.getFullYear();this.outputDate=this.addMonth(this.outputDate,a.id.indexOf("next")>=0);this.refreshData();return false};MangoCalendar.prototype.updateButtons=function(){var c=this;var b=this.prevMonth;var a=this.nextMonth;if((this.outputDate.getFullYear()<=this.startDate.getFullYear())&&this.outputDate.getMonth()<=this.startDate.getMonth()){b.className="arrowLeftDisabled";b.innerText="";b.onclick=null;b.title=""}else{b.className="arrowLeft";b.innerText="<<";b.onclick=function(d){d=d||window.event;return c.switchMonth(d)};b.title=this.Config.txtPrevMonth}if(this.outputDate.getFullYear()>=this.endDate.getFullYear()&&this.outputDate.getMonth()>=(this.endDate.getMonth()-1)){a.className="arrowRightDisabled";a.innerText="";a.onclick=null;a.title=""}else{a.className="arrowRight";a.innerText=">>";a.onclick=function(d){d=d||window.event;return c.switchMonth(d)};a.title=this.Config.txtNextMonth}};MangoCalendar.prototype.highlightDay=function(){switch(this.className){case"activeDay":this.className="activeDayOver";break;case"activeDayOver":this.className="activeDay";break;case"Day":this.className="DayOver";break;case"DayOver":this.className="Day";break}};MangoCalendar.prototype.refreshData=function(){if(this.outputDate.getFullYear()>=this.endDate.getFullYear()&&this.outputDate.getMonth()>=this.endDate.getMonth()){this.writeCalendarContent(this.addMonth(this.outputDate,false),this.monthLeft,this.dataLeft);this.writeCalendarContent(this.outputDate,this.monthRight,this.dataRight)}else{this.writeCalendarContent(this.outputDate,this.monthLeft,this.dataLeft);this.writeCalendarContent(this.addMonth(this.outputDate,true),this.monthRight,this.dataRight)}this.resizeContent();this.updateButtons()};MangoCalendar.prototype.writeCalendarContent=function(c,f,a){var n=this;if(this.calendarLeft.style.removeProperty){this.calendarLeft.style.removeProperty("height");this.calendarRight.style.removeProperty("height")}else{this.calendarLeft.style.removeAttribute("height");this.calendarRight.style.removeAttribute("height")}f.innerHTML=this.formatDate(c,this.Config.dateFormatTitle);var e=new Array();var g=new Date();g.setTime(c.getTime());g.setDate(1);var q=g.getDay();q=(7-(this.Config.firstDay-q))%7;var d=this.Config.monthDays[c.getMonth()];if(d==28){if(this.leapYear(c.getFullYear())){d=29}}var h=0;var k=1;var b=d;var m;if(c.getFullYear()<=this.startDate.getFullYear()&&c.getMonth()<=this.startDate.getMonth()){k=this.startDate.getDate()}if(c.getFullYear()>=this.endDate.getFullYear()&&c.getMonth()>=this.endDate.getMonth()){b=this.endDate.getDate()}if(c.getFullYear()==this.inputDate.getFullYear()&&c.getMonth()==this.inputDate.getMonth()){h=this.inputDate.getDate()}for(i=0;i<a.rows.length*7;i++){var l=a.rows[parseInt(i/7)].cells[i%7];var p=i-q+1;if(i<q||p>d){l.id="";l.className="inActiveDay";l.innerHTML="";l.onmouseover=null;l.onmouseout=null;l.onclick=null}else{l.id="day-"+p+"-"+c.getMonth()+"-"+c.getFullYear();l.innerHTML=p;l.className="inActiveDay";if(c.getFullYear()<this.startDate.getFullYear()){l.className="inActiveDay";l.onmouseover=null;l.onmouseout=null;l.onclick=null}else{if(c.getFullYear()<=this.startDate.getFullYear()&&c.getMonth()<this.startDate.getMonth()){l.className="inActiveDay";l.onmouseover=null;l.onmouseout=null;l.onclick=null}else{m=new Date(c.getFullYear(),c.getMonth(),p);var o=m.getDay();if(p>=k&&p<=b){if(this.WeekShow){if((o+1)%7!=0&&o%7!=0){l.onmouseover=this.highlightDay;l.onmouseout=this.highlightDay;l.onclick=function(r){r=r||window.event;return n.pickDate(r)};if(p==h){l.className="activeDay"}else{l.className="Day"}}}else{l.onmouseover=this.highlightDay;l.onmouseout=this.highlightDay;l.onclick=function(r){r=r||window.event;return n.pickDate(r)};if(p==h){l.className="activeDay"}else{l.className="Day"}}}else{l.className="inActiveDay";l.onmouseover=null;l.onmouseout=null;l.onclick=null}}}}}if(d+q>5*7){a.rows[a.rows.length-1].style.display=""}else{a.rows[a.rows.length-1].style.display="none"}};MangoCalendar.prototype.resizeContent=function(){if(this.calendarRight.offsetHeight>this.calendarLeft.offsetHeight){this.calendarLeft.style.height=(this.calendarRight.offsetHeight+4)+"px"}else{this.calendarLeft.style.height=(this.calendarLeft.offsetHeight+4)+"px"}if(this.iframe){var g=parseFloat(this.calendarDiv.currentStyle.borderWidth);if(!isNaN(g)){this.iframe.style.width=(this.calendarDiv.clientWidth-(2*g))+"px";this.iframe.style.height=(this.calendarDiv.clientHeight+(2*g))+"px"}else{this.iframe.style.width=this.calendarDiv.clientWidth+"px";this.iframe.style.height=this.calendarDiv.clientHeight+"px"}}if(this.returnDateTo){var b=this.findPos(this.returnDateTo);var a=this.getScrollPosition();var e=this.getWindowSize();var c=b.x;var f=b.y+this.returnDateTo.offsetHeight+2;var d=this.calendarDiv;if((d.offsetHeight+f)>(a.y+e.height)){window.scrollTo(a.x,a.y+(d.offsetHeight+f)-(a.y+e.height)+25)}}};MangoCalendar.prototype.positionCalendar=function(e){var b=this.findPos(this.returnDateTo);var a=this.getScrollPosition();var f=this.getWindowSize();var c=b.x;var g=b.y+this.returnDateTo.offsetHeight+2;var d=this.calendarDiv;if((d.offsetHeight+g)>(a.y+f.height+4)){window.scrollTo(a.x,a.y+(d.offsetHeight+g)-(a.y+f.height)+25)}if(this.Config.maxScreen!==0&&f.width>this.Config.maxScreen){f.width=this.Config.maxScreen+(document.body.clientWidth-this.Config.maxScreen)/2}if((d.offsetWidth+c+20)>(a.x+f.width)){c=b.x+this.returnDateTo.offsetWidth-d.offsetWidth}this.calendarDiv.style.left=c+e+"px";this.calendarDiv.style.top=g+"px";if(this.iframe){this.iframe.style.left=this.calendarDiv.style.left;this.iframe.style.top=this.calendarDiv.style.top}};MangoCalendar.prototype.pickDate=function(d){var a=d.target||d.srcElement;var c=a.id.split("-");this.outputDate.setDate(1);this.outputDate.setYear(c[3]);this.outputDate.setMonth(c[2]);this.outputDate.setDate(c[1]);var b=this.formatDate(this.outputDate,this.Config.dateFormat);this.returnDateTo.value=b;if(this.dependentDateTo&&this.dependentDaysDiff){this.outputDate.setDate(this.outputDate.getDate()+this.dependentDaysDiff);if(this.outputDate>this.endDate){this.outputDate.setDate(this.endDate.getDate())}if(this.outputDate<this.startDate){this.outputDate.setDate(this.startDate.getDate())}this.dependentDateTo.value=this.formatDate(this.outputDate,this.Config.dateFormat)}this.returnDateTo.style.color="#000000";this.closeCalendar();if(this.nextDocument!=null&&this.nextDocument!=undefined){this.nextDocument.focus()}if(typeof(this.pickDateCallback)!="undefined"){this.pickDateCallback(b,this.returnDateTo);this.pickDateCallback=undefined}};MangoCalendar.prototype.ajaxac_getkeycode=function(b){var a;if(!b){var b=window.event}if(b.keyCode){a=b.keyCode}else{if(b.which){a=b.which}}return a};MangoCalendar.prototype.display=function(d,g,o,a,m,n,h,k,l,f){if(!this.Config){return}this.nextDocument=((h==undefined||h=="")?null:h);if(typeof(l)!="undefined"){this.pickDateCallback=l}if(typeof f=="undefined"){this.WeekShow=false}else{this.WeekShow=f}if(typeof a=="undefined"){a=null}if(typeof m=="undefined"){m=null}if(typeof n=="undefined"){n=0}this.startDate=new Date(g.getTime());this.endDate=new Date(o.getTime());var c=this.ajaxac_getkeycode(k);switch(c){case 13:this.closeCalendar();if(this.nextDocument!=null){this.nextDocument.focus()}return;break;case 18:this.closeCalendar();return;break;case 27:this.closeCalendar();return;break}if(a&&!m&&a.value){this.startDate=this.parseDate(a.value,this.Config.dateFormat)}this.outFlag=true;if(d&&d.tagName=="INPUT"){this.outFlag=false;this.inputDate=this.parseDate(d.value,this.Config.dateFormat);this.outputDate=new Date(this.inputDate.getTime())}else{if(d&&d.tagName=="A"){this.outFlag=false;this.inputDate=this.parseDate("",this.Config.dateFormat);this.outputDate=new Date(this.inputDate.getTime())}else{return}}if(d.style.display=="none"||d.disabled=="true"){return}if(!this.calendarDiv){this.initialize()}this.returnDateTo=d;this.dependentDateTo=a;this.dependentDaysDiff=m;var b=this.calendarDiv.style.visibility=="visible";this.calendarDiv.style.zIndex=-1000;this.calendarDiv.style.visibility="visible";this.refreshData();this.positionCalendar(n);if(!b){this.calendarDiv.style.visibility="hidden"}this.calendarDiv.style.zIndex=1000;if(!b){this.fade.fadeIn()}};MangoCalendar.prototype.closeCalendar=function(){if(this.calendarDiv){if(this.calendarDiv.style.visibility=="visible"){this.fade.fadeOut()}}if(this.outFlag){this.pickDateCallback=undefined}return false};function showSearchCalendarn(g,l,b,f,h,k,e,a,d,c){if(l){if(g.value==""){g.style.color="#C1C1C1";g.value="yyyy-mm-dd"}}else{if(g.value=="yyyy-mm-dd"){g.style.color="#000000";g.value=""}if(MangoCalendar){MangoCalendar.display(g,b,f,h,k,undefined,e,a,d,c)}}}var MangoCalendar=new MangoCalendar();