var a;
Calendar=function(b,c,d,e){b=1;this.timeout=this.getDateStatus=this.currentDateEl=this.activeDiv=null;this.onSelected=d||null;this.onClose=e||null;this.hidden=this.dragging=false;this.minYear=1970;this.maxYear=2050;this.dateFormat=Calendar._TT.DEF_DATE_FORMAT;this.ttDateFormat=Calendar._TT.TT_DATE_FORMAT;this.weekNumbers=this.isPopup=true;this.firstDayOfWeek=b;this.showsOtherMonths=false;this.dateStr=c;this.ar_days=null;this.showsTime=false;this.time24=true;this.yearStep=2;this.activeYear=this.hilitedYear=this.activeMonth=
this.hilitedMonth=this.yearsCombo=this.monthsCombo=this.firstdayname=this.tbody=this.element=this.table=null;this.dateClicked=false;if(typeof Calendar._SDN=="undefined"){if(typeof Calendar._SDN_len=="undefined")Calendar._SDN_len=3;b=[];for(c=8;c>0;)b[--c]=Calendar._DN[c].substr(0,Calendar._SDN_len);Calendar._SDN=b;if(typeof Calendar._SMN_len=="undefined")Calendar._SMN_len=3;b=[];for(c=12;c>0;)b[--c]=Calendar._MN[c].substr(0,Calendar._SMN_len);Calendar._SMN=b}};Calendar._C=null;
Calendar.is_ie=/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent);Calendar.is_ie5=Calendar.is_ie&&/msie 5\.0/i.test(navigator.userAgent);Calendar.is_opera=/opera/i.test(navigator.userAgent);Calendar.is_khtml=/Konqueror|Safari|KHTML/i.test(navigator.userAgent);
Calendar.getAbsolutePos=function(b){var c=0,d=0,e=/^div$/i.test(b.tagName);if(e&&b.scrollLeft)c=b.scrollLeft;if(e&&b.scrollTop)d=b.scrollTop;c={x:b.offsetLeft-c,y:b.offsetTop-d};if(b.offsetParent){b=this.getAbsolutePos(b.offsetParent);c.x+=b.x;c.y+=b.y}return c};Calendar.isRelated=function(b,c){var d=c.relatedTarget;if(!d){var e=c.type;if(e=="mouseover")d=c.fromElement;else if(e=="mouseout")d=c.toElement}for(;d;){if(d==b)return true;d=d.parentNode}return false};
Calendar.removeClass=function(b,c){if(b&&b.className){for(var d=b.className.split(" "),e=[],h=d.length;h>0;)if(d[--h]!=c)e[e.length]=d[h];b.className=e.join(" ")}};Calendar.addClass=function(b,c){Calendar.removeClass(b,c);b.className+=" "+c};Calendar.getElement=function(b){return Calendar.is_ie?window.event.srcElement:b.currentTarget};Calendar.getTargetElement=function(b){return Calendar.is_ie?window.event.srcElement:b.target};
Calendar.stopEvent=function(b){b||(b=window.event);if(Calendar.is_ie){b.cancelBubble=true;b.returnValue=false}else{b.preventDefault();b.stopPropagation()}return false};Calendar.addEvent=function(b,c,d){if(b.attachEvent)b.attachEvent("on"+c,d);else if(b.addEventListener)b.addEventListener(c,d,true);else b["on"+c]=d};Calendar.removeEvent=function(b,c,d){if(b.detachEvent)b.detachEvent("on"+c,d);else if(b.removeEventListener)b.removeEventListener(c,d,true);else b["on"+c]=null};
Calendar.createElement=function(b,c){var d=null;d=document.createElementNS?document.createElementNS("http://www.w3.org/1999/xhtml",b):document.createElement(b);typeof c!="undefined"&&c.appendChild(d);return d};Calendar._add_evs=function(b){with(Calendar){addEvent(b,"mouseover",dayMouseOver);addEvent(b,"mousedown",dayMouseDown);addEvent(b,"mouseout",dayMouseOut);if(is_ie){addEvent(b,"dblclick",dayMouseDblClick);b.setAttribute("unselectable",true)}}};
Calendar.findMonth=function(b){if(typeof b.month!="undefined")return b;else if(typeof b.parentNode.month!="undefined")return b.parentNode;return null};Calendar.findYear=function(b){if(typeof b.year!="undefined")return b;else if(typeof b.parentNode.year!="undefined")return b.parentNode;return null};
Calendar.showMonthsCombo=function(){var b=Calendar._C;if(!b)return false;b=b;var c=b.activeDiv,d=b.monthsCombo;b.hilitedMonth&&Calendar.removeClass(b.hilitedMonth,"hilite");b.activeMonth&&Calendar.removeClass(b.activeMonth,"active");var e=b.monthsCombo.getElementsByTagName("div")[b.date.getMonth()];Calendar.addClass(e,"active");b.activeMonth=e;b=d.style;b.display="block";if(c.navtype<0)b.left=c.offsetLeft+"px";else{d=d.offsetWidth;if(typeof d=="undefined")d=50;b.left=c.offsetLeft+c.offsetWidth-d+
"px"}b.top=c.offsetTop+c.offsetHeight+"px"};
Calendar.showYearsCombo=function(b){var c=Calendar._C;if(!c)return false;c=c;var d=c.activeDiv,e=c.yearsCombo;c.hilitedYear&&Calendar.removeClass(c.hilitedYear,"hilite");c.activeYear&&Calendar.removeClass(c.activeYear,"active");c.activeYear=null;for(var h=c.date.getFullYear()+(b?1:-1),g=e.firstChild,f=false,i=12;i>0;--i){if(h>=c.minYear&&h<=c.maxYear){g.firstChild.data=h;g.year=h;g.style.display="block";f=true}else g.style.display="none";g=g.nextSibling;h+=b?c.yearStep:-c.yearStep}if(f){b=e.style;
b.display="block";if(d.navtype<0)b.left=d.offsetLeft+"px";else{e=e.offsetWidth;if(typeof e=="undefined")e=50;b.left=d.offsetLeft+d.offsetWidth-e+"px"}b.top=d.offsetTop+d.offsetHeight+"px"}};
Calendar.tableMouseUp=function(b){var c=Calendar._C;if(!c)return false;c.timeout&&clearTimeout(c.timeout);var d=c.activeDiv;if(!d)return false;var e=Calendar.getTargetElement(b);b||(b=window.event);Calendar.removeClass(d,"active");if(e==d||e.parentNode==d)Calendar.cellClick(d,b);var h=Calendar.findMonth(e);d=null;if(h){d=new Date(c.date);if(h.month!=d.getMonth()){d.setMonth(h.month);c.setDate(d);c.dateClicked=false;c.callHandler()}}else if(e=Calendar.findYear(e)){d=new Date(c.date);if(e.year!=d.getFullYear()){d.setFullYear(e.year);
c.setDate(d);c.dateClicked=false;c.callHandler()}}with(Calendar){removeEvent(document,"mouseup",tableMouseUp);removeEvent(document,"mouseover",tableMouseOver);removeEvent(document,"mousemove",tableMouseOver);c._hideCombos();_C=null;return stopEvent(b)}};
Calendar.tableMouseOver=function(b){var c=Calendar._C;if(c){var d=c.activeDiv,e=Calendar.getTargetElement(b);if(e==d||e.parentNode==d){Calendar.addClass(d,"hilite active");Calendar.addClass(d.parentNode,"rowhilite")}else{if(typeof d.navtype=="undefined"||d.navtype!=50&&(d.navtype==0||Math.abs(d.navtype)>2))Calendar.removeClass(d,"active");Calendar.removeClass(d,"hilite");Calendar.removeClass(d.parentNode,"rowhilite")}b||(b=window.event);if(d.navtype==50&&e!=d){var h=Calendar.getAbsolutePos(d),g=d.offsetWidth,
f=b.clientX,i=true;if(f>h.x+g){f=f-h.x-g;i=false}else f=h.x-f;if(f<0)f=0;h=d._range;g=d._current;f=Math.floor(f/10)%h.length;for(var k=h.length;--k>=0;)if(h[k]==g)break;for(;f-- >0;)if(i){if(--k<0)k=h.length-1}else if(++k>=h.length)k=0;i=h[k];d.firstChild.data=i;c.onUpdateTime()}if(d=Calendar.findMonth(e))if(d.month!=c.date.getMonth()){c.hilitedMonth&&Calendar.removeClass(c.hilitedMonth,"hilite");Calendar.addClass(d,"hilite");c.hilitedMonth=d}else c.hilitedMonth&&Calendar.removeClass(c.hilitedMonth,
"hilite");else{c.hilitedMonth&&Calendar.removeClass(c.hilitedMonth,"hilite");if(e=Calendar.findYear(e))if(e.year!=c.date.getFullYear()){c.hilitedYear&&Calendar.removeClass(c.hilitedYear,"hilite");Calendar.addClass(e,"hilite");c.hilitedYear=e}else c.hilitedYear&&Calendar.removeClass(c.hilitedYear,"hilite");else c.hilitedYear&&Calendar.removeClass(c.hilitedYear,"hilite")}return Calendar.stopEvent(b)}};Calendar.tableMouseDown=function(b){if(Calendar.getTargetElement(b)==Calendar.getElement(b))return Calendar.stopEvent(b)};
Calendar.calDragIt=function(b){var c=Calendar._C;if(!(c&&c.dragging))return false;var d,e;if(Calendar.is_ie){e=window.event.clientY+document.body.scrollTop;d=window.event.clientX+document.body.scrollLeft}else{d=b.pageX;e=b.pageY}c.hideShowCovered();var h=c.element.style;h.left=d-c.xOffs+"px";h.top=e-c.yOffs+"px";return Calendar.stopEvent(b)};
Calendar.calDragEnd=function(b){var c=Calendar._C;if(!c)return false;c.dragging=false;with(Calendar){removeEvent(document,"mousemove",calDragIt);removeEvent(document,"mouseup",calDragEnd);tableMouseUp(b)}c.hideShowCovered()};
Calendar.dayMouseDown=function(b){var c=Calendar.getElement(b);if(c.disabled)return false;var d=c.calendar;d.activeDiv=c;Calendar._C=d;if(c.navtype!=300)with(Calendar){if(c.navtype==50){c._current=c.firstChild.data;addEvent(document,"mousemove",tableMouseOver)}else addEvent(document,Calendar.is_ie5?"mousemove":"mouseover",tableMouseOver);addClass(c,"hilite active");addEvent(document,"mouseup",tableMouseUp)}else d.isPopup&&d._dragStart(b);if(c.navtype==-1||c.navtype==1){d.timeout&&clearTimeout(d.timeout);
d.timeout=setTimeout("Calendar.showMonthsCombo()",250)}else if(c.navtype==-2||c.navtype==2){d.timeout&&clearTimeout(d.timeout);d.timeout=setTimeout(c.navtype>0?"Calendar.showYearsCombo(true)":"Calendar.showYearsCombo(false)",250)}else d.timeout=null;return Calendar.stopEvent(b)};Calendar.dayMouseDblClick=function(b){Calendar.cellClick(Calendar.getElement(b),b||window.event);Calendar.is_ie&&document.selection.empty()};
Calendar.dayMouseOver=function(b){var c=Calendar.getElement(b);if(Calendar.isRelated(c,b)||Calendar._C||c.disabled)return false;if(c.ttip){if(c.ttip.substr(0,1)=="_")c.ttip=c.caldate.print(c.calendar.ttDateFormat)+c.ttip.substr(1);c.calendar.tooltips.firstChild.data=c.ttip}if(c.navtype!=300){Calendar.addClass(c,"hilite");c.caldate&&Calendar.addClass(c.parentNode,"rowhilite")}return Calendar.stopEvent(b)};
Calendar.dayMouseOut=function(b){with(Calendar){var c=getElement(b);if(isRelated(c,b)||_C||c.disabled)return false;removeClass(c,"hilite");c.caldate&&removeClass(c.parentNode,"rowhilite");c.calendar.tooltips.firstChild.data=_TT.SEL_DATE;return stopEvent(b)}};
Calendar.cellClick=function(b,c){var d=b.calendar,e=false,h=false,g=null;if(typeof b.navtype=="undefined"){Calendar.removeClass(d.currentDateEl,"selected");Calendar.addClass(b,"selected");e=d.currentDateEl==b;if(!e)d.currentDateEl=b;d.date=new Date(b.caldate);g=d.date;h=true;(d.dateClicked=!b.otherMonth)||d._init(d.firstDayOfWeek,g)}else{if(b.navtype==200){Calendar.removeClass(b,"hilite");d.callCloseHandler();return}g=b.navtype==0?new Date:new Date(d.date);d.dateClicked=false;var f=g.getFullYear(),
i=g.getMonth();function k(j){var l=g.getDate(),n=g.getMonthDays(j);l>n&&g.setDate(n);g.setMonth(j)}switch(b.navtype){case 400:Calendar.removeClass(b,"hilite");b=Calendar._TT.ABOUT;if(typeof b!="undefined")b+=d.showsTime?Calendar._TT.ABOUT_TIME:"";else b='Help and about box text is not translated into this language.\nIf you know this language and you feel generous please update\nthe corresponding file in "lang" subdir to match calendar-es.js\nand send it back to <mishoo@infoiasi.ro> to get it into the distribution  ;-)\n\nThank you!\nhttp://dynarch.com/mishoo/calendar.epl\n';
alert(b);return;case -2:f>d.minYear&&g.setFullYear(f-1);break;case -1:if(i>0)k(i-1);else if(f-- >d.minYear){g.setFullYear(f);k(11)}break;case 1:if(i<11)k(i+1);else if(f<d.maxYear){g.setFullYear(f+1);k(0)}break;case 2:f<d.maxYear&&g.setFullYear(f+1);break;case 100:d.setFirstDayOfWeek(b.fdow);return;case 50:e=b._range;h=b.firstChild.data;for(f=e.length;--f>=0;)if(e[f]==h)break;if(c&&c.shiftKey){if(--f<0)f=e.length-1}else if(++f>=e.length)f=0;c=e[f];b.firstChild.data=c;d.onUpdateTime();return;case 0:if(typeof d.getDateStatus==
"function"&&d.getDateStatus(g,g.getFullYear(),g.getMonth(),g.getDate()))return false;break}if(!g.equalsTo(d.date)){d.setDate(g);h=true}}h&&d.callHandler();if(e){Calendar.removeClass(b,"hilite");d.callCloseHandler()}};
Calendar.prototype.create=function(b){var c=null;if(b){c=b;this.isPopup=false}else{c=document.getElementsByTagName("body")[0];this.isPopup=true}this.date=this.dateStr?new Date(this.dateStr):new Date;var d=Calendar.createElement("table");this.table=d;d.cellSpacing=0;d.cellPadding=0;d.calendar=this;Calendar.addEvent(d,"mousedown",Calendar.tableMouseDown);var e=Calendar.createElement("div");this.element=e;e.className="calendar";if(this.isPopup){e.style.position="absolute";e.style.display="none"}e.appendChild(d);
var h=Calendar.createElement("thead",d),g=null,f=null,i=this;function k(l,n,o){g=Calendar.createElement("td",f);g.colSpan=n;g.className="button";if(o!=0&&Math.abs(o)<=2)g.className+=" nav";Calendar._add_evs(g);g.calendar=i;g.navtype=o;if(l.substr(0,1)!="&")g.appendChild(document.createTextNode(l));else g.innerHTML=l;return g}f=Calendar.createElement("tr",h);e=6;this.isPopup&&--e;this.weekNumbers&&++e;k("?",1,400).ttip=Calendar._TT.INFO;this.title=k("",e,300);this.title.className="title";if(this.isPopup){this.title.ttip=
Calendar._TT.DRAG_TO_MOVE;this.title.style.cursor="move";k("&#x00d7;",1,200).ttip=Calendar._TT.CLOSE}f=Calendar.createElement("tr",h);f.className="headrow";this._nav_py=k("&#x00ab;",1,-2);this._nav_py.ttip=Calendar._TT.PREV_YEAR;this._nav_pm=k("&#x2039;",1,-1);this._nav_pm.ttip=Calendar._TT.PREV_MONTH;this._nav_now=k(Calendar._TT.TODAY,this.weekNumbers?4:3,0);this._nav_now.ttip=Calendar._TT.GO_TODAY;this._nav_nm=k("&#x203a;",1,1);this._nav_nm.ttip=Calendar._TT.NEXT_MONTH;this._nav_ny=k("&#x00bb;",
1,2);this._nav_ny.ttip=Calendar._TT.NEXT_YEAR;f=Calendar.createElement("tr",h);f.className="daynames";if(this.weekNumbers){g=Calendar.createElement("td",f);g.className="name wn";g.appendChild(document.createTextNode(Calendar._TT.WK))}for(h=7;h>0;--h){g=Calendar.createElement("td",f);g.appendChild(document.createTextNode(""));if(!h){g.navtype=100;g.calendar=this;Calendar._add_evs(g)}}this.firstdayname=this.weekNumbers?f.firstChild.nextSibling:f.firstChild;this._displayWeekdays();this.tbody=e=Calendar.createElement("tbody",
d);for(h=6;h>0;--h){f=Calendar.createElement("tr",e);if(this.weekNumbers){g=Calendar.createElement("td",f);g.appendChild(document.createTextNode(""))}for(var j=7;j>0;--j){g=Calendar.createElement("td",f);g.appendChild(document.createTextNode(""));g.calendar=this;Calendar._add_evs(g)}}if(this.showsTime){f=Calendar.createElement("tr",e);f.className="time";g=Calendar.createElement("td",f);g.className="time";g.colSpan=2;g.innerHTML=Calendar._TT.TIME||"&nbsp;";g=Calendar.createElement("td",f);g.className=
"time";g.colSpan=this.weekNumbers?4:3;(function(){function l(m,q,t,w){var r=Calendar.createElement("span",g);r.className=m;r.appendChild(document.createTextNode(q));r.calendar=i;r.ttip=Calendar._TT.TIME_PART;r.navtype=50;r._range=[];if(typeof t!="number")r._range=t;else for(m=t;m<=w;++m){q=m<10&&w>=10?"0"+m:""+m;r._range[r._range.length]=q}Calendar._add_evs(r);return r}var n=i.date.getHours(),o=i.date.getMinutes(),p=!i.time24,u=n>12;if(p&&u)n-=12;var s=l("hour",n,p?1:0,p?12:23);n=Calendar.createElement("span",
g);n.appendChild(document.createTextNode(":"));n.className="colon";var v=l("minute",o,0,59),x=null;g=Calendar.createElement("td",f);g.className="time";g.colSpan=2;if(p)x=l("ampm",u?"pm":"am",["am","pm"]);else g.innerHTML="&nbsp;";i.onSetTime=function(){var m=this.date.getHours(),q=this.date.getMinutes(),t=m>12;if(t&&p)m-=12;s.firstChild.data=m<10?"0"+m:m;v.firstChild.data=q<10?"0"+q:q;if(p)x.firstChild.data=t?"pm":"am"};i.onUpdateTime=function(){var m=this.date,q=parseInt(s.firstChild.data,10);if(p)if(/pm/i.test(x.firstChild.data)&&
q<12)q+=12;else if(/am/i.test(x.firstChild.data)&&q==12)q=0;var t=m.getDate(),w=m.getMonth(),r=m.getFullYear();m.setHours(q);m.setMinutes(parseInt(v.firstChild.data,10));m.setFullYear(r);m.setMonth(w);m.setDate(t);this.dateClicked=false;this.callHandler()}})()}else this.onSetTime=this.onUpdateTime=function(){};d=Calendar.createElement("tfoot",d);f=Calendar.createElement("tr",d);f.className="footrow";g=k(Calendar._TT.SEL_DATE,this.weekNumbers?8:7,300);g.className="ttip";if(this.isPopup){g.ttip=Calendar._TT.DRAG_TO_MOVE;
g.style.cursor="move"}this.tooltips=g;this.monthsCombo=e=Calendar.createElement("div",this.element);e.className="combo";for(h=0;h<Calendar._MN.length;++h){d=Calendar.createElement("div");d.className=Calendar.is_ie?"label-IEfix":"label";d.month=h;d.appendChild(document.createTextNode(Calendar._SMN[h]));e.appendChild(d)}this.yearsCombo=e=Calendar.createElement("div",this.element);e.className="combo";for(h=12;h>0;--h){d=Calendar.createElement("div");d.className=Calendar.is_ie?"label-IEfix":"label";d.appendChild(document.createTextNode(""));
e.appendChild(d)}this._init(this.firstDayOfWeek,this.date);c.appendChild(this.element)};
Calendar._keyEvent=function(b){if(!window.calendar)return false;Calendar.is_ie&&(b=window.event);var c=window.calendar,d=Calendar.is_ie||b.type=="keypress";if(b.ctrlKey)switch(b.keyCode){case 37:d&&Calendar.cellClick(c._nav_pm);break;case 38:d&&Calendar.cellClick(c._nav_py);break;case 39:d&&Calendar.cellClick(c._nav_nm);break;case 40:d&&Calendar.cellClick(c._nav_ny);break;default:return false}else switch(b.keyCode){case 32:Calendar.cellClick(c._nav_now);break;case 27:d&&c.callCloseHandler();break;
case 37:case 38:case 39:case 40:if(d){d=c.date.getDate()-1;var e=c.currentDateEl,h=null,g=b.keyCode==37||b.keyCode==38;switch(b.keyCode){case 37:--d>=0&&(h=c.ar_days[d]);break;case 38:d-=7;d>=0&&(h=c.ar_days[d]);break;case 39:++d<c.ar_days.length&&(h=c.ar_days[d]);break;case 40:d+=7;d<c.ar_days.length&&(h=c.ar_days[d]);break}if(!h){g?Calendar.cellClick(c._nav_pm):Calendar.cellClick(c._nav_nm);d=g?c.date.getMonthDays():1;e=c.currentDateEl;h=c.ar_days[d-1]}Calendar.removeClass(e,"selected");Calendar.addClass(h,
"selected");c.date=new Date(h.caldate);c.callHandler();c.currentDateEl=h}break;case 13:if(d){c.callHandler();c.hide()}break;default:return false}return Calendar.stopEvent(b)};a=Calendar.prototype;
a._init=function(b,c){var d=new Date;this.table.style.visibility="hidden";var e=c.getFullYear();if(e<this.minYear){e=this.minYear;c.setFullYear(e)}else if(e>this.maxYear){e=this.maxYear;c.setFullYear(e)}this.firstDayOfWeek=b;this.date=new Date(c);b=c.getMonth();var h=c.getDate(),g=c.getMonthDays();c.setDate(1);g=(c.getDay()-this.firstDayOfWeek)%7;if(g<0)g+=7;c.setDate(-g);c.setDate(c.getDate()+1);g=this.tbody.firstChild;var f=Calendar._SMN[b];f=[];for(var i=Calendar._TT.WEEKEND,k=0;k<6;++k,g=g.nextSibling){var j=
g.firstChild;if(this.weekNumbers){j.className="day wn";j.firstChild.data=c.getWeekNumber();j=j.nextSibling}g.className="daysrow";for(var l=false,n=0;n<7;++n,j=j.nextSibling,c.setDate(c.getDate()+1)){var o=c.getDate(),p=c.getDay();j.className="day";var u=c.getMonth()==b;if(u){j.otherMonth=false;l=true}else if(this.showsOtherMonths){j.className+=" othermonth";j.otherMonth=true}else{j.className="emptycell";j.innerHTML="&nbsp;";j.disabled=true;continue}j.disabled=false;j.firstChild.data=o;if(typeof this.getDateStatus==
"function"){var s=this.getDateStatus(c,e,b,o);if(s===true){j.className+=" disabled";j.disabled=true}else{if(/disabled/i.test(s))j.disabled=true;j.className+=" "+s}}if(!j.disabled){f[f.length]=j;j.caldate=new Date(c);j.ttip="_";if(u&&o==h){j.className+=" selected";this.currentDateEl=j}if(c.getFullYear()==d.getFullYear()&&c.getMonth()==d.getMonth()&&o==d.getDate()){j.className+=" today";j.ttip+=Calendar._TT.PART_TODAY}if(i.indexOf(p.toString())!=-1)j.className+=j.otherMonth?" oweekend":" weekend"}}if(!(l||
this.showsOtherMonths))g.className="emptyrow"}this.ar_days=f;this.title.firstChild.data=Calendar._MN[b]+", "+e;this.onSetTime();this.table.style.visibility="visible"};a.setDate=function(b){b.equalsTo(this.date)||this._init(this.firstDayOfWeek,b)};a.refresh=function(){this._init(this.firstDayOfWeek,this.date)};a.setFirstDayOfWeek=function(b){this._init(b,this.date);this._displayWeekdays()};a.setDateStatusHandler=Calendar.prototype.setDisabledHandler=function(b){this.getDateStatus=b};
a.setRange=function(b,c){this.minYear=b;this.maxYear=c};a.callHandler=function(){this.onSelected&&this.onSelected(this,this.date.print(this.dateFormat))};a.callCloseHandler=function(){this.onClose&&this.onClose(this);this.hideShowCovered()};a.destroy=function(){var b=this.element.parentNode;b.removeChild(this.element);Calendar._C=null;window.calendar=null};a.reparent=function(b){var c=this.element;c.parentNode.removeChild(c);b.appendChild(c)};
Calendar._checkCalendar=function(b){if(!window.calendar)return false;for(var c=Calendar.is_ie?Calendar.getElement(b):Calendar.getTargetElement(b);c!=null&&c!=calendar.element;c=c.parentNode);if(c==null){window.calendar.callCloseHandler();return Calendar.stopEvent(b)}};a=Calendar.prototype;
a.show=function(){for(var b=this.table.getElementsByTagName("tr"),c=b.length;c>0;){var d=b[--c];Calendar.removeClass(d,"rowhilite");d=d.getElementsByTagName("td");for(var e=d.length;e>0;){var h=d[--e];Calendar.removeClass(h,"hilite");Calendar.removeClass(h,"active")}}this.element.style.display="block";this.hidden=false;if(this.isPopup){window.calendar=this;Calendar.addEvent(document,"keydown",Calendar._keyEvent);Calendar.addEvent(document,"keypress",Calendar._keyEvent);Calendar.addEvent(document,
"mousedown",Calendar._checkCalendar)}this.hideShowCovered()};a.hide=function(){if(this.isPopup){Calendar.removeEvent(document,"keydown",Calendar._keyEvent);Calendar.removeEvent(document,"keypress",Calendar._keyEvent);Calendar.removeEvent(document,"mousedown",Calendar._checkCalendar)}this.element.style.display="none";this.hidden=true;this.hideShowCovered()};a.showAt=function(b,c){var d=this.element.style;d.left=b+"px";d.top=c+"px";this.show()};
a.showAtElement=function(b,c){var d=this,e=Calendar.getAbsolutePos(b);if(!c||typeof c!="string"){this.showAt(e.x,e.y+b.offsetHeight);return true}function h(g){if(g.x<0)g.x=0;if(g.y<0)g.y=0;var f=document.createElement("div"),i=f.style;i.position="absolute";i.right=i.bottom=i.width=i.height="0px";document.body.appendChild(f);i=Calendar.getAbsolutePos(f);document.body.removeChild(f);if(Calendar.is_ie){i.y+=document.body.scrollTop;i.x+=document.body.scrollLeft}else{i.y+=window.scrollY;i.x+=window.scrollX}f=
g.x+g.width-i.x;if(f>0)g.x-=f;f=g.y+g.height-i.y;if(f>0)g.y-=f}this.element.style.display="block";Calendar.continuation_for_the_fucking_khtml_browser=function(){var g=d.element.offsetWidth,f=d.element.offsetHeight;d.element.style.display="none";var i=c.substr(0,1),k="l";if(c.length>1)k=c.substr(1,1);switch(i){case "T":e.y-=f;break;case "B":e.y+=b.offsetHeight;break;case "C":e.y+=(b.offsetHeight-f)/2;break;case "t":e.y+=b.offsetHeight-f;break;case "b":break}switch(k){case "L":e.x-=g;break;case "R":e.x+=
b.offsetWidth;break;case "C":e.x+=(b.offsetWidth-g)/2;break;case "r":e.x+=b.offsetWidth-g;break;case "l":break}e.width=g;e.height=f+40;d.monthsCombo.style.display="none";h(e);d.showAt(e.x,e.y)};Calendar.is_khtml?setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()",10):Calendar.continuation_for_the_fucking_khtml_browser()};a.setDateFormat=function(b){this.dateFormat=b};a.setTtDateFormat=function(b){this.ttDateFormat=b};
a.parseDate=function(b,c){var d=0,e=-1,h=0;b=b.split(/\W+/);if(!c)c=this.dateFormat;var g=c.match(/%./g),f=0,i=0,k=c=0;for(f=0;f<b.length;++f)if(b[f])switch(g[f]){case "%d":case "%e":h=parseInt(b[f],10);break;case "%m":e=parseInt(b[f],10)-1;break;case "%Y":case "%y":d=parseInt(b[f],10);d<100&&(d+=d>29?1900:2000);break;case "%b":case "%B":for(i=0;i<12;++i)if(Calendar._MN[i].substr(0,b[f].length).toLowerCase()==b[f].toLowerCase()){e=i;break}break;case "%H":case "%I":case "%k":case "%l":c=parseInt(b[f],
10);break;case "%P":case "%p":if(/pm/i.test(b[f])&&c<12)c+=12;break;case "%M":k=parseInt(b[f],10);break}if(d!=0&&e!=-1&&h!=0)this.setDate(new Date(d,e,h,c,k,0));else{d=0;e=-1;for(f=h=0;f<b.length;++f)if(b[f].search(/[a-zA-Z]+/)!=-1){g=-1;for(i=0;i<12;++i)if(Calendar._MN[i].substr(0,b[f].length).toLowerCase()==b[f].toLowerCase()){g=i;break}if(g!=-1){if(e!=-1)h=e+1;e=g}}else if(parseInt(b[f],10)<=12&&e==-1)e=b[f]-1;else if(parseInt(b[f],10)>31&&d==0){d=parseInt(b[f],10);d<100&&(d+=d>29?1900:2000)}else if(h==
0)h=b[f];if(d==0){d=new Date;d=d.getFullYear()}e!=-1&&h!=0&&this.setDate(new Date(d,e,h,c,k,0))}};
a.hideShowCovered=function(){var b=this;Calendar.continuation_for_the_fucking_khtml_browser=function(){function c(s){var v=s.style.visibility;v||(v=document.defaultView&&typeof document.defaultView.getComputedStyle=="function"?Calendar.is_khtml?"":document.defaultView.getComputedStyle(s,"").getPropertyValue("visibility"):s.currentStyle?s.currentStyle.visibility:"");return v}var d=new Array("applet","iframe","select"),e=b.element,h=Calendar.getAbsolutePos(e),g=h.x,f=e.offsetWidth+g,i=h.y;e=e.offsetHeight+
i;for(var k=d.length;k>0;)for(var j=document.getElementsByTagName(d[--k]),l=null,n=j.length;n>0;){l=j[--n];h=Calendar.getAbsolutePos(l);var o=h.x,p=l.offsetWidth+o;h=h.y;var u=l.offsetHeight+h;if(b.hidden||o>f||p<g||h>e||u<i){if(!l.__msh_save_visibility)l.__msh_save_visibility=c(l);l.style.visibility=l.__msh_save_visibility}else{if(!l.__msh_save_visibility)l.__msh_save_visibility=c(l);l.style.visibility="hidden"}}};Calendar.is_khtml?setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()",
10):Calendar.continuation_for_the_fucking_khtml_browser()};a._displayWeekdays=function(){for(var b=this.firstDayOfWeek,c=this.firstdayname,d=Calendar._TT.WEEKEND,e=0;e<7;++e){c.className="day name";var h=(e+b)%7;if(e){c.ttip=Calendar._TT.DAY_FIRST.replace("%s",Calendar._DN[h]);c.navtype=100;c.calendar=this;c.fdow=h;Calendar._add_evs(c)}d.indexOf(h.toString())!=-1&&Calendar.addClass(c,"weekend");c.firstChild.data=Calendar._SDN[(e+b)%7];c=c.nextSibling}};
a._hideCombos=function(){this.monthsCombo.style.display="none";this.yearsCombo.style.display="none"};
a._dragStart=function(b){if(!this.dragging){this.dragging=true;var c;if(Calendar.is_ie){c=window.event.clientY+document.body.scrollTop;b=window.event.clientX+document.body.scrollLeft}else{c=b.clientY+window.scrollY;b=b.clientX+window.scrollX}var d=this.element.style;this.xOffs=b-parseInt(d.left);this.yOffs=c-parseInt(d.top);with(Calendar){addEvent(document,"mousemove",calDragIt);addEvent(document,"mouseup",calDragEnd)}}};Date._MD=new Array(31,28,31,30,31,30,31,31,30,31,30,31);Date.SECOND=1000;
Date.MINUTE=60*Date.SECOND;Date.HOUR=60*Date.MINUTE;Date.DAY=24*Date.HOUR;Date.WEEK=7*Date.DAY;a=Date.prototype;a.getMonthDays=function(b){var c=this.getFullYear();if(typeof b=="undefined")b=this.getMonth();return 0==c%4&&(0!=c%100||0==c%400)&&b==1?29:Date._MD[b]};a.getDayOfYear=function(){var b=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0),c=new Date(this.getFullYear(),0,0,0,0,0);b=b-c;return Math.floor(b/Date.DAY)};
a.getWeekNumber=function(){var b=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0),c=b.getDay();b.setDate(b.getDate()-(c+6)%7+3);c=b.valueOf();b.setMonth(0);b.setDate(4);return Math.round((c-b.valueOf())/604800000)+1};a.equalsTo=function(b){return this.getFullYear()==b.getFullYear()&&this.getMonth()==b.getMonth()&&this.getDate()==b.getDate()&&this.getHours()==b.getHours()&&this.getMinutes()==b.getMinutes()};
a.print=function(b){var c=this.getMonth(),d=this.getDate(),e=this.getFullYear(),h=this.getWeekNumber(),g=this.getDay(),f={},i=this.getHours(),k=i>=12,j=k?i-12:i,l=this.getDayOfYear();if(j==0)j=12;var n=this.getMinutes(),o=this.getSeconds();f["%a"]=Calendar._SDN[g];f["%A"]=Calendar._DN[g];f["%b"]=Calendar._SMN[c];f["%B"]=Calendar._MN[c];f["%C"]=1+Math.floor(e/100);f["%d"]=d<10?"0"+d:d;f["%e"]=d;f["%H"]=i<10?"0"+i:i;f["%I"]=j<10?"0"+j:j;f["%j"]=l<100?l<10?"00"+l:"0"+l:l;f["%k"]=i;f["%l"]=j;f["%m"]=
c<9?"0"+(1+c):1+c;f["%M"]=n<10?"0"+n:n;f["%n"]="\n";f["%p"]=k?"PM":"AM";f["%P"]=k?"pm":"am";f["%s"]=Math.floor(this.getTime()/1000);f["%S"]=o<10?"0"+o:o;f["%t"]="\t";f["%U"]=f["%W"]=f["%V"]=h<10?"0"+h:h;f["%u"]=g+1;f["%w"]=g;f["%y"]=(""+e).substr(2,2);f["%Y"]=e;f["%%"]="%";c=/%./g;if(!Calendar.is_ie5)return b.replace(c,function(p){return f[p]||p});d=b.match(c);for(e=0;e<d.length;e++)if(h=f[d[e]]){c=new RegExp(d[e],"g");b=b.replace(c,h)}return b};a.__msh_oldSetFullYear=Date.prototype.setFullYear;
a.setFullYear=function(b){var c=new Date(this);c.__msh_oldSetFullYear(b);c.getMonth()!=this.getMonth()&&this.setDate(28);this.__msh_oldSetFullYear(b)};window.calendar=null;
