Calendar=function(firstDayOfWeek,dateStr,onSelected,onClose){if(this.activeDiv=null,this.currentDateEl=null,this.getDateStatus=null,this.getDateToolTip=null,this.getDateText=null,this.timeout=null,this.onSelected=onSelected||null,this.onClose=onClose||null,this.dragging=!1,this.hidden=!1,this.minYear=1970,this.maxYear=2050,this.dateFormat=Calendar._TT.DEF_DATE_FORMAT,this.ttDateFormat=Calendar._TT.TT_DATE_FORMAT,this.isPopup=!0,this.weekNumbers=!0,this.firstDayOfWeek="number"==typeof firstDayOfWeek?firstDayOfWeek:Calendar._FD,this.showsOtherMonths=!1,this.dateStr=dateStr,this.ar_days=null,this.showsTime=!1,this.time24=!0,this.yearStep=2,this.hiliteToday=!0,this.multiple=null,this.table=null,this.element=null,this.tbody=null,this.firstdayname=null,this.monthsCombo=null,this.yearsCombo=null,this.hilitedMonth=null,this.activeMonth=null,this.hilitedYear=null,this.activeYear=null,this.dateClicked=!1,"undefined"==typeof Calendar._SDN){"undefined"==typeof Calendar._SDN_len&&(Calendar._SDN_len=3);for(var ar=new Array,i=8;i>0;)ar[--i]=Calendar._DN[i].substr(0,Calendar._SDN_len);Calendar._SDN=ar,"undefined"==typeof Calendar._SMN_len&&(Calendar._SMN_len=3),ar=new Array;for(var i=12;i>0;)ar[--i]=Calendar._MN[i].substr(0,Calendar._SMN_len);Calendar._SMN=ar}},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(el){var SL=0,ST=0,is_div=/^div$/i.test(el.tagName);is_div&&el.scrollLeft&&(SL=el.scrollLeft),is_div&&el.scrollTop&&(ST=el.scrollTop);var r={x:el.offsetLeft-SL,y:el.offsetTop-ST};if(el.offsetParent){var tmp=this.getAbsolutePos(el.offsetParent);r.x+=tmp.x,r.y+=tmp.y}return r},Calendar.isRelated=function(el,evt){var related=evt.relatedTarget;if(!related){var type=evt.type;"mouseover"==type?related=evt.fromElement:"mouseout"==type&&(related=evt.toElement)}for(;related;){if(related==el)return!0;related=related.parentNode}return!1},Calendar.removeClass=function(el,className){if(el&&el.className){for(var cls=el.className.split(" "),ar=new Array,i=cls.length;i>0;)cls[--i]!=className&&(ar[ar.length]=cls[i]);el.className=ar.join(" ")}},Calendar.addClass=function(el,className){Calendar.removeClass(el,className),el.className+=" "+className},Calendar.getElement=function(ev){for(var f=Calendar.is_ie?window.event.srcElement:ev.currentTarget;1!=f.nodeType||/^div$/i.test(f.tagName);)f=f.parentNode;return f},Calendar.getTargetElement=function(ev){for(var f=Calendar.is_ie?window.event.srcElement:ev.target;1!=f.nodeType;)f=f.parentNode;return f},Calendar.stopEvent=function(ev){return ev||(ev=window.event),Calendar.is_ie?(ev.cancelBubble=!0,ev.returnValue=!1):(ev.preventDefault(),ev.stopPropagation()),!1},Calendar.addEvent=function(el,evname,func){el.attachEvent?el.attachEvent("on"+evname,func):el.addEventListener?el.addEventListener(evname,func,!0):el["on"+evname]=func},Calendar.removeEvent=function(el,evname,func){el.detachEvent?el.detachEvent("on"+evname,func):el.removeEventListener?el.removeEventListener(evname,func,!0):el["on"+evname]=null},Calendar.createElement=function(type,parent){var el=null;return el=document.createElementNS?document.createElementNS("http://www.w3.org/1999/xhtml",type):document.createElement(type),"undefined"!=typeof parent&&parent.appendChild(el),el},Calendar._add_evs=function(el){with(Calendar)addEvent(el,"mouseover",dayMouseOver),addEvent(el,"mousedown",dayMouseDown),addEvent(el,"mouseout",dayMouseOut),is_ie&&(addEvent(el,"dblclick",dayMouseDblClick),el.setAttribute("unselectable",!0))},Calendar.findMonth=function(el){return"undefined"!=typeof el.month?el:"undefined"!=typeof el.parentNode.month?el.parentNode:null},Calendar.findYear=function(el){return"undefined"!=typeof el.year?el:"undefined"!=typeof el.parentNode.year?el.parentNode:null},Calendar.showMonthsCombo=function(){var cal=Calendar._C;if(!cal)return!1;var cal=cal,cd=cal.activeDiv,mc=cal.monthsCombo;cal.hilitedMonth&&Calendar.removeClass(cal.hilitedMonth,"hilite"),cal.activeMonth&&Calendar.removeClass(cal.activeMonth,"active");var mon=cal.monthsCombo.getElementsByTagName("div")[cal.date.getMonth()];Calendar.addClass(mon,"active"),cal.activeMonth=mon;var s=mc.style;if(s.display="block",cd.navtype<0)s.left=cd.offsetLeft+"px";else{var mcw=mc.offsetWidth;"undefined"==typeof mcw&&(mcw=50),s.left=cd.offsetLeft+cd.offsetWidth-mcw+"px"}s.top=cd.offsetTop+cd.offsetHeight+"px"},Calendar.showYearsCombo=function(fwd){var cal=Calendar._C;if(!cal)return!1;var cal=cal,cd=cal.activeDiv,yc=cal.yearsCombo;cal.hilitedYear&&Calendar.removeClass(cal.hilitedYear,"hilite"),cal.activeYear&&Calendar.removeClass(cal.activeYear,"active"),cal.activeYear=null;for(var Y=cal.date.getFullYear()+(fwd?1:-1),yr=yc.firstChild,show=!1,i=12;i>0;--i)Y>=cal.minYear&&Y<=cal.maxYear?(yr.innerHTML=Y,yr.year=Y,yr.style.display="block",show=!0):yr.style.display="none",yr=yr.nextSibling,Y+=fwd?cal.yearStep:-cal.yearStep;if(show){var s=yc.style;if(s.display="block",cd.navtype<0)s.left=cd.offsetLeft+"px";else{var ycw=yc.offsetWidth;"undefined"==typeof ycw&&(ycw=50),s.left=cd.offsetLeft+cd.offsetWidth-ycw+"px"}s.top=cd.offsetTop+cd.offsetHeight+"px"}},Calendar.tableMouseUp=function(ev){var cal=Calendar._C;if(!cal)return!1;cal.timeout&&clearTimeout(cal.timeout);var el=cal.activeDiv;if(!el)return!1;var target=Calendar.getTargetElement(ev);ev||(ev=window.event),Calendar.removeClass(el,"active"),(target==el||target.parentNode==el)&&Calendar.cellClick(el,ev);var mon=Calendar.findMonth(target),date=null;if(mon)date=new Date(cal.date),mon.month!=date.getMonth()&&(date.setMonth(mon.month),cal.setDate(date),cal.dateClicked=!1,cal.callHandler());else{var year=Calendar.findYear(target);year&&(date=new Date(cal.date),year.year!=date.getFullYear()&&(date.setFullYear(year.year),cal.setDate(date),cal.dateClicked=!1,cal.callHandler()))}with(Calendar)return removeEvent(document,"mouseup",tableMouseUp),removeEvent(document,"mouseover",tableMouseOver),removeEvent(document,"mousemove",tableMouseOver),cal._hideCombos(),_C=null,stopEvent(ev)},Calendar.tableMouseOver=function(ev){var cal=Calendar._C;if(cal){var el=cal.activeDiv,target=Calendar.getTargetElement(ev);if(target==el||target.parentNode==el?(Calendar.addClass(el,"hilite active"),Calendar.addClass(el.parentNode,"rowhilite")):(("undefined"==typeof el.navtype||50!=el.navtype&&(0==el.navtype||Math.abs(el.navtype)>2))&&Calendar.removeClass(el,"active"),Calendar.removeClass(el,"hilite"),Calendar.removeClass(el.parentNode,"rowhilite")),ev||(ev=window.event),50==el.navtype&&target!=el){var dx,pos=Calendar.getAbsolutePos(el),w=el.offsetWidth,x=ev.clientX,decrease=!0;x>pos.x+w?(dx=x-pos.x-w,decrease=!1):dx=pos.x-x,0>dx&&(dx=0);for(var range=el._range,current=el._current,count=Math.floor(dx/10)%range.length,i=range.length;--i>=0&&range[i]!=current;);for(;count-->0;)decrease?--i<0&&(i=range.length-1):++i>=range.length&&(i=0);var newval=range[i];el.innerHTML=newval,cal.onUpdateTime()}var mon=Calendar.findMonth(target);if(mon)mon.month!=cal.date.getMonth()?(cal.hilitedMonth&&Calendar.removeClass(cal.hilitedMonth,"hilite"),Calendar.addClass(mon,"hilite"),cal.hilitedMonth=mon):cal.hilitedMonth&&Calendar.removeClass(cal.hilitedMonth,"hilite");else{cal.hilitedMonth&&Calendar.removeClass(cal.hilitedMonth,"hilite");var year=Calendar.findYear(target);year&&year.year!=cal.date.getFullYear()?(cal.hilitedYear&&Calendar.removeClass(cal.hilitedYear,"hilite"),Calendar.addClass(year,"hilite"),cal.hilitedYear=year):cal.hilitedYear&&Calendar.removeClass(cal.hilitedYear,"hilite")}return Calendar.stopEvent(ev)}},Calendar.tableMouseDown=function(ev){return Calendar.getTargetElement(ev)==Calendar.getElement(ev)?Calendar.stopEvent(ev):void 0},Calendar.calDragIt=function(ev){var cal=Calendar._C;if(!cal||!cal.dragging)return!1;var posX,posY;Calendar.is_ie?(posY=window.event.clientY+document.body.scrollTop,posX=window.event.clientX+document.body.scrollLeft):(posX=ev.pageX,posY=ev.pageY),cal.hideShowCovered();var st=cal.element.style;return st.left=posX-cal.xOffs+"px",st.top=posY-cal.yOffs+"px",Calendar.stopEvent(ev)},Calendar.calDragEnd=function(ev){var cal=Calendar._C;if(!cal)return!1;with(cal.dragging=!1,Calendar)removeEvent(document,"mousemove",calDragIt),removeEvent(document,"mouseup",calDragEnd),tableMouseUp(ev);cal.hideShowCovered()},Calendar.dayMouseDown=function(ev){var el=Calendar.getElement(ev);if(el.disabled)return!1;var cal=el.calendar;if(cal.activeDiv=el,Calendar._C=cal,300!=el.navtype)with(Calendar)50==el.navtype?(el._current=el.innerHTML,addEvent(document,"mousemove",tableMouseOver)):addEvent(document,Calendar.is_ie5?"mousemove":"mouseover",tableMouseOver),addClass(el,"hilite active"),addEvent(document,"mouseup",tableMouseUp);else cal.isPopup&&cal._dragStart(ev);return-1==el.navtype||1==el.navtype?(cal.timeout&&clearTimeout(cal.timeout),cal.timeout=setTimeout("Calendar.showMonthsCombo()",250)):-2==el.navtype||2==el.navtype?(cal.timeout&&clearTimeout(cal.timeout),cal.timeout=setTimeout(el.navtype>0?"Calendar.showYearsCombo(true)":"Calendar.showYearsCombo(false)",250)):cal.timeout=null,Calendar.stopEvent(ev)},Calendar.dayMouseDblClick=function(ev){Calendar.cellClick(Calendar.getElement(ev),ev||window.event),Calendar.is_ie&&document.selection.empty()},Calendar.dayMouseOver=function(ev){var el=Calendar.getElement(ev);return Calendar.isRelated(el,ev)||Calendar._C||el.disabled?!1:(el.ttip&&("_"==el.ttip.substr(0,1)&&(el.ttip=el.caldate.print(el.calendar.ttDateFormat)+el.ttip.substr(1)),el.calendar.tooltips.innerHTML=el.ttip),300!=el.navtype&&(Calendar.addClass(el,"hilite"),el.caldate&&Calendar.addClass(el.parentNode,"rowhilite")),Calendar.stopEvent(ev))},Calendar.dayMouseOut=function(ev){with(Calendar){var el=getElement(ev);return isRelated(el,ev)||_C||el.disabled?!1:(removeClass(el,"hilite"),el.caldate&&removeClass(el.parentNode,"rowhilite"),el.calendar&&(el.calendar.tooltips.innerHTML=_TT.SEL_DATE),stopEvent(ev))}},Calendar.cellClick=function(el,ev){function setMonth(m){var day=date.getDate(),max=date.getMonthDays(m);day>max&&date.setDate(max),date.setMonth(m)}var cal=el.calendar,closing=!1,newdate=!1,date=null;if("undefined"==typeof el.navtype){cal.currentDateEl&&(Calendar.removeClass(cal.currentDateEl,"selected"),Calendar.addClass(el,"selected"),closing=cal.currentDateEl==el,closing||(cal.currentDateEl=el)),cal.date.setDateOnly(el.caldate),date=cal.date;var other_month=!(cal.dateClicked=!el.otherMonth);other_month||cal.currentDateEl?newdate=!el.disabled:cal._toggleMultipleDate(new Date(date)),other_month&&cal._init(cal.firstDayOfWeek,date)}else{if(200==el.navtype)return Calendar.removeClass(el,"hilite"),void cal.callCloseHandler();date=new Date(cal.date),0==el.navtype&&date.setDateOnly(new Date),cal.dateClicked=!1;var year=date.getFullYear(),mon=date.getMonth();switch(el.navtype){case 400:Calendar.removeClass(el,"hilite");var text=Calendar._TT.ABOUT;return"undefined"!=typeof text?text+=cal.showsTime?Calendar._TT.ABOUT_TIME:"":text='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-en.js\nand send it back to to get it into the distribution ;-)\n\nThank you!\nhttp://dynarch.com/mishoo/calendar.epl\n',void alert(text);case-2:year>cal.minYear&&date.setFullYear(year-1);break;case-1:mon>0?setMonth(mon-1):year-->cal.minYear&&(date.setFullYear(year),setMonth(11));break;case 1:11>mon?setMonth(mon+1):year=0&&range[i]!=current;);ev&&ev.shiftKey?--i<0&&(i=range.length-1):++i>=range.length&&(i=0);var newval=range[i];return el.innerHTML=newval,void cal.onUpdateTime();case 0:if("function"==typeof cal.getDateStatus&&cal.getDateStatus(date,date.getFullYear(),date.getMonth(),date.getDate()))return!1}date.equalsTo(cal.date)?0==el.navtype&&(newdate=closing=!0):(cal.setDate(date),newdate=!0)}newdate&&ev&&cal.callHandler(),closing&&(Calendar.removeClass(el,"hilite"),ev&&cal.callCloseHandler())},Calendar.prototype.create=function(_par){var parent=null;_par?(parent=_par,this.isPopup=!1):(parent=document.getElementsByTagName("body")[0],this.isPopup=!0),this.date=this.dateStr?new Date(this.dateStr):new Date;var table=Calendar.createElement("table");this.table=table,table.cellSpacing=0,table.cellPadding=0,table.calendar=this,Calendar.addEvent(table,"mousedown",Calendar.tableMouseDown);var div=Calendar.createElement("div");this.element=div,div.className="calendar",this.isPopup&&(div.style.position="absolute",div.style.display="none"),div.appendChild(table);var thead=Calendar.createElement("thead",table),cell=null,row=null,cal=this,hh=function(text,cs,navtype){return cell=Calendar.createElement("td",row),cell.colSpan=cs,cell.className="button",0!=navtype&&Math.abs(navtype)<=2&&(cell.className+=" nav"),Calendar._add_evs(cell),cell.calendar=cal,cell.navtype=navtype,cell.innerHTML="
"+text+"
",cell};row=Calendar.createElement("tr",thead);var title_length=6;this.isPopup&&--title_length,this.weekNumbers&&++title_length,hh("?",1,400).ttip=Calendar._TT.INFO,this.title=hh("",title_length,300),this.title.className="title",this.isPopup&&(this.title.ttip=Calendar._TT.DRAG_TO_MOVE,this.title.style.cursor="move",hh("×",1,200).ttip=Calendar._TT.CLOSE),row=Calendar.createElement("tr",thead),row.className="headrow",this._nav_py=hh("«",1,-2),this._nav_py.ttip=Calendar._TT.PREV_YEAR,this._nav_pm=hh("‹",1,-1),this._nav_pm.ttip=Calendar._TT.PREV_MONTH,this._nav_now=hh(Calendar._TT.TODAY,this.weekNumbers?4:3,0),this._nav_now.ttip=Calendar._TT.GO_TODAY,this._nav_nm=hh("›",1,1),this._nav_nm.ttip=Calendar._TT.NEXT_MONTH,this._nav_ny=hh("»",1,2),this._nav_ny.ttip=Calendar._TT.NEXT_YEAR,row=Calendar.createElement("tr",thead),row.className="daynames",this.weekNumbers&&(cell=Calendar.createElement("td",row),cell.className="name wn",cell.innerHTML=Calendar._TT.WK);for(var i=7;i>0;--i)cell=Calendar.createElement("td",row),i||(cell.navtype=100,cell.calendar=this,Calendar._add_evs(cell));this.firstdayname=this.weekNumbers?row.firstChild.nextSibling:row.firstChild,this._displayWeekdays();var tbody=Calendar.createElement("tbody",table);for(this.tbody=tbody,i=6;i>0;--i){row=Calendar.createElement("tr",tbody),this.weekNumbers&&(cell=Calendar.createElement("td",row));for(var j=7;j>0;--j)cell=Calendar.createElement("td",row),cell.calendar=this,Calendar._add_evs(cell)}this.showsTime?(row=Calendar.createElement("tr",tbody),row.className="time",cell=Calendar.createElement("td",row),cell.className="time",cell.colSpan=2,cell.innerHTML=Calendar._TT.TIME||" ",cell=Calendar.createElement("td",row),cell.className="time",cell.colSpan=this.weekNumbers?4:3,function(){function makeTimePart(className,init,range_start,range_end){var part=Calendar.createElement("span",cell);if(part.className=className,part.innerHTML=init,part.calendar=cal,part.ttip=Calendar._TT.TIME_PART,part.navtype=50,part._range=[],"number"!=typeof range_start)part._range=range_start;else for(var i=range_start;range_end>=i;++i){var txt;txt=10>i&&range_end>=10?"0"+i:""+i,part._range[part._range.length]=txt}return Calendar._add_evs(part),part}var hrs=cal.date.getHours(),mins=cal.date.getMinutes(),t12=!cal.time24,pm=hrs>12;t12&&pm&&(hrs-=12);var H=makeTimePart("hour",hrs,t12?1:0,t12?12:23),span=Calendar.createElement("span",cell);span.innerHTML=":",span.className="colon";var M=makeTimePart("minute",mins,0,59),AP=null;cell=Calendar.createElement("td",row),cell.className="time",cell.colSpan=2,t12?AP=makeTimePart("ampm",pm?"pm":"am",["am","pm"]):cell.innerHTML=" ",cal.onSetTime=function(){var pm,hrs=this.date.getHours(),mins=this.date.getMinutes();t12&&(pm=hrs>=12,pm&&(hrs-=12),0==hrs&&(hrs=12),AP.innerHTML=pm?"pm":"am"),H.innerHTML=10>hrs?"0"+hrs:hrs,M.innerHTML=10>mins?"0"+mins:mins},cal.onUpdateTime=function(){var date=this.date,h=parseInt(H.innerHTML,10);t12&&(/pm/i.test(AP.innerHTML)&&12>h?h+=12:/am/i.test(AP.innerHTML)&&12==h&&(h=0));var d=date.getDate(),m=date.getMonth(),y=date.getFullYear();date.setHours(h),date.setMinutes(parseInt(M.innerHTML,10)),date.setFullYear(y),date.setMonth(m),date.setDate(d),this.dateClicked=!1,this.callHandler()}}()):this.onSetTime=this.onUpdateTime=function(){};var tfoot=Calendar.createElement("tfoot",table);for(row=Calendar.createElement("tr",tfoot),row.className="footrow",cell=hh(Calendar._TT.SEL_DATE,this.weekNumbers?8:7,300),cell.className="ttip",this.isPopup&&(cell.ttip=Calendar._TT.DRAG_TO_MOVE,cell.style.cursor="move"),this.tooltips=cell,div=Calendar.createElement("div",this.element),this.monthsCombo=div,div.className="combo",i=0;i0;--i){var yr=Calendar.createElement("div");yr.className=Calendar.is_ie?"label-IEfix":"label",div.appendChild(yr)}this._init(this.firstDayOfWeek,this.date),parent.appendChild(this.element)},Calendar._keyEvent=function(ev){function setVars(){el=cal.currentDateEl;var p=el.pos;x=15&p,y=p>>4,ne=cal.ar_days[y][x]}function prevMonth(){var date=new Date(cal.date);date.setDate(date.getDate()-step),cal.setDate(date)}function nextMonth(){var date=new Date(cal.date);date.setDate(date.getDate()+step),cal.setDate(date)}var cal=window._dynarch_popupCalendar;if(!cal||cal.multiple)return!1;Calendar.is_ie&&(ev=window.event);var act=Calendar.is_ie||"keypress"==ev.type,K=ev.keyCode;if(ev.ctrlKey)switch(K){case 37:act&&Calendar.cellClick(cal._nav_pm);break;case 38:act&&Calendar.cellClick(cal._nav_py);break;case 39:act&&Calendar.cellClick(cal._nav_nm);break;case 40:act&&Calendar.cellClick(cal._nav_ny);break;default:return!1}else switch(K){case 32:Calendar.cellClick(cal._nav_now);break;case 27:act&&cal.callCloseHandler();break;case 37:case 38:case 39:case 40:if(act){var prev,x,y,ne,el,step;for(prev=37==K||38==K,step=37==K||39==K?1:7,setVars();;){switch(K){case 37:if(!(--x>=0)){x=6,K=38;continue}ne=cal.ar_days[y][x];break;case 38:--y>=0?ne=cal.ar_days[y][x]:(prevMonth(),setVars());break;case 39:if(!(++x<7)){x=0,K=40;continue}ne=cal.ar_days[y][x];break;case 40:++ythis.maxYear&&(year=this.maxYear,date.setFullYear(year)),this.firstDayOfWeek=firstDayOfWeek,this.date=new Date(date);{var month=date.getMonth(),mday=date.getDate();date.getMonthDays()}date.setDate(1);var day1=(date.getDay()-this.firstDayOfWeek)%7;0>day1&&(day1+=7),date.setDate(-day1),date.setDate(date.getDate()+1);for(var row=this.tbody.firstChild,ar_days=(Calendar._SMN[month],this.ar_days=new Array),weekend=Calendar._TT.WEEKEND,dates=this.multiple?this.datesCells={}:null,i=0;6>i;++i,row=row.nextSibling){var cell=row.firstChild;this.weekNumbers&&(cell.className="day wn",cell.innerHTML=date.getWeekNumber(),cell=cell.nextSibling),row.className="daysrow";for(var iday,hasdays=!1,dpos=ar_days[i]=[],j=0;7>j;++j,cell=cell.nextSibling,date.setDate(iday+1)){iday=date.getDate();var wday=date.getDay();cell.className="day",cell.pos=i<<4|j,dpos[j]=cell;var current_month=date.getMonth()==month;if(current_month)cell.otherMonth=!1,hasdays=!0;else{if(!this.showsOtherMonths){cell.className="emptycell",cell.innerHTML=" ",cell.disabled=!0;continue}cell.className+=" othermonth",cell.otherMonth=!0}if(cell.disabled=!1,cell.innerHTML=this.getDateText?this.getDateText(date,iday):iday,dates&&(dates[date.print("%Y%m%d")]=cell),this.getDateStatus){var status=this.getDateStatus(date,year,month,iday);if(this.getDateToolTip){var toolTip=this.getDateToolTip(date,year,month,iday);toolTip&&(cell.title=toolTip)}status===!0?(cell.className+=" disabled",cell.disabled=!0):(/disabled/i.test(status)&&(cell.disabled=!0),cell.className+=" "+status)}cell.disabled||(cell.caldate=new Date(date),cell.ttip="_",!this.multiple&¤t_month&&iday==mday&&this.hiliteToday&&(cell.className+=" selected",this.currentDateEl=cell),date.getFullYear()==TY&&date.getMonth()==TM&&iday==TD&&(cell.className+=" today",cell.ttip+=Calendar._TT.PART_TODAY),-1!=weekend.indexOf(wday.toString())&&(cell.className+=cell.otherMonth?" oweekend":" weekend"))}hasdays||this.showsOtherMonths||(row.className="emptyrow")}this.title.innerHTML=Calendar._MN[month]+", "+year,this.onSetTime(),this.table.style.visibility="visible",this._initMultipleDates()},Calendar.prototype._initMultipleDates=function(){if(this.multiple)for(var i in this.multiple){var cell=this.datesCells[i],d=this.multiple[i];d&&cell&&(cell.className+=" selected")}},Calendar.prototype._toggleMultipleDate=function(date){if(this.multiple){var ds=date.print("%Y%m%d"),cell=this.datesCells[ds];if(cell){var d=this.multiple[ds];d?(Calendar.removeClass(cell,"selected"),delete this.multiple[ds]):(Calendar.addClass(cell,"selected"),this.multiple[ds]=date)}}},Calendar.prototype.setDateToolTipHandler=function(unaryFunction){this.getDateToolTip=unaryFunction},Calendar.prototype.setDate=function(date){date.equalsTo(this.date)||this._init(this.firstDayOfWeek,date)},Calendar.prototype.refresh=function(){this._init(this.firstDayOfWeek,this.date)},Calendar.prototype.setFirstDayOfWeek=function(firstDayOfWeek){this._init(firstDayOfWeek,this.date),this._displayWeekdays()},Calendar.prototype.setDateStatusHandler=Calendar.prototype.setDisabledHandler=function(unaryFunction){this.getDateStatus=unaryFunction},Calendar.prototype.setRange=function(a,z){this.minYear=a,this.maxYear=z},Calendar.prototype.callHandler=function(){this.onSelected&&this.onSelected(this,this.date.print(this.dateFormat))},Calendar.prototype.callCloseHandler=function(){this.onClose&&this.onClose(this),this.hideShowCovered()},Calendar.prototype.destroy=function(){var el=this.element.parentNode;el.removeChild(this.element),Calendar._C=null,window._dynarch_popupCalendar=null},Calendar.prototype.reparent=function(new_parent){var el=this.element;el.parentNode.removeChild(el),new_parent.appendChild(el)},Calendar._checkCalendar=function(ev){var calendar=window._dynarch_popupCalendar;if(!calendar)return!1;for(var el=Calendar.is_ie?Calendar.getElement(ev):Calendar.getTargetElement(ev);null!=el&&el!=calendar.element;el=el.parentNode);return null==el?(window._dynarch_popupCalendar.callCloseHandler(),Calendar.stopEvent(ev)):void 0},Calendar.prototype.show=function(){for(var rows=this.table.getElementsByTagName("tr"),i=rows.length;i>0;){var row=rows[--i];Calendar.removeClass(row,"rowhilite");for(var cells=row.getElementsByTagName("td"),j=cells.length;j>0;){var cell=cells[--j];Calendar.removeClass(cell,"hilite"),Calendar.removeClass(cell,"active")}}this.element.style.display="block",this.hidden=!1,this.isPopup&&(window._dynarch_popupCalendar=this,Calendar.addEvent(document,"keydown",Calendar._keyEvent),Calendar.addEvent(document,"keypress",Calendar._keyEvent),Calendar.addEvent(document,"mousedown",Calendar._checkCalendar)),this.hideShowCovered()},Calendar.prototype.hide=function(){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=!0,this.hideShowCovered()},Calendar.prototype.showAt=function(x,y){var s=this.element.style;s.left=x+"px",s.top=y+"px",this.show()},Calendar.prototype.showAtElement=function(el,opts){function fixPosition(box){box.x<0&&(box.x=0),box.y<0&&(box.y=0);var cp=document.createElement("div"),s=cp.style;s.position="absolute",s.right=s.bottom=s.width=s.height="0px",document.body.appendChild(cp);var br=Calendar.getAbsolutePos(cp);document.body.removeChild(cp),Calendar.is_ie?(br.y+=document.body.scrollTop,br.x+=document.body.scrollLeft):(br.y+=window.scrollY,br.x+=window.scrollX);var tmp=box.x+box.width-br.x;tmp>0&&(box.x-=tmp),tmp=box.y+box.height-br.y,tmp>0&&(box.y-=tmp)}var self=this,p=Calendar.getAbsolutePos(el);return opts&&"string"==typeof opts?(this.element.style.display="block",Calendar.continuation_for_the_fucking_khtml_browser=function(){var w=self.element.offsetWidth,h=self.element.offsetHeight;self.element.style.display="none";var valign=opts.substr(0,1),halign="l";switch(opts.length>1&&(halign=opts.substr(1,1)),valign){case"T":p.y-=h;break;case"B":p.y+=el.offsetHeight;break;case"C":p.y+=(el.offsetHeight-h)/2;break;case"t":p.y+=el.offsetHeight-h;break;case"b":}switch(halign){case"L":p.x-=w;break;case"R":p.x+=el.offsetWidth;break;case"C":p.x+=(el.offsetWidth-w)/2;break;case"l":p.x+=el.offsetWidth-w;break;case"r":}p.width=w,p.height=h+40,self.monthsCombo.style.display="none",fixPosition(p),self.showAt(p.x,p.y)},void(Calendar.is_khtml?setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()",10):Calendar.continuation_for_the_fucking_khtml_browser())):(this.showAt(p.x,p.y+el.offsetHeight),!0)},Calendar.prototype.setDateFormat=function(str){this.dateFormat=str},Calendar.prototype.setTtDateFormat=function(str){this.ttDateFormat=str},Calendar.prototype.parseDate=function(str,fmt){fmt||(fmt=this.dateFormat),this.setDate(Date.parseDate(str,fmt))},Calendar.prototype.hideShowCovered=function(){function getVisib(obj){var value=obj.style.visibility;return value||(value=document.defaultView&&"function"==typeof document.defaultView.getComputedStyle?Calendar.is_khtml?"":document.defaultView.getComputedStyle(obj,"").getPropertyValue("visibility"):obj.currentStyle?obj.currentStyle.visibility:""),value}if(Calendar.is_ie||Calendar.is_opera)for(var tags=new Array("applet","iframe","select"),el=this.element,p=Calendar.getAbsolutePos(el),EX1=p.x,EX2=el.offsetWidth+EX1,EY1=p.y,EY2=el.offsetHeight+EY1,k=tags.length;k>0;)for(var ar=document.getElementsByTagName(tags[--k]),cc=null,i=ar.length;i>0;){cc=ar[--i],p=Calendar.getAbsolutePos(cc);var CX1=p.x,CX2=cc.offsetWidth+CX1,CY1=p.y,CY2=cc.offsetHeight+CY1;this.hidden||CX1>EX2||EX1>CX2||CY1>EY2||EY1>CY2?(cc.__msh_save_visibility||(cc.__msh_save_visibility=getVisib(cc)),cc.style.visibility=cc.__msh_save_visibility):(cc.__msh_save_visibility||(cc.__msh_save_visibility=getVisib(cc)),cc.style.visibility="hidden")}},Calendar.prototype._displayWeekdays=function(){for(var fdow=this.firstDayOfWeek,cell=this.firstdayname,weekend=Calendar._TT.WEEKEND,i=0;7>i;++i){cell.className="day name";var realday=(i+fdow)%7;i&&(cell.ttip=Calendar._TT.DAY_FIRST.replace("%s",Calendar._DN[realday]),cell.navtype=100,cell.calendar=this,cell.fdow=realday,Calendar._add_evs(cell)),-1!=weekend.indexOf(realday.toString())&&Calendar.addClass(cell,"weekend"),cell.innerHTML=Calendar._SDN[(i+fdow)%7],cell=cell.nextSibling}},Calendar.prototype._hideCombos=function(){this.monthsCombo.style.display="none",this.yearsCombo.style.display="none"},Calendar.prototype._dragStart=function(ev){if(!this.dragging){this.dragging=!0;var posX,posY;Calendar.is_ie?(posY=window.event.clientY+document.body.scrollTop,posX=window.event.clientX+document.body.scrollLeft):(posY=ev.clientY+window.scrollY,posX=ev.clientX+window.scrollX);var st=this.element.style;with(this.xOffs=posX-parseInt(st.left),this.yOffs=posY-parseInt(st.top),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=1e3,Date.MINUTE=60*Date.SECOND,Date.HOUR=60*Date.MINUTE,Date.DAY=24*Date.HOUR,Date.WEEK=7*Date.DAY,Date.parseDate=function(str,fmt){var today=new Date,y=0,m=-1,d=0,a=str.split(/\W+/),b=fmt.match(/%./g),i=0,j=0,hr=0,min=0;for(i=0;iy&&(y+=y>29?1900:2e3);break;case"%b":case"%B":for(j=0;12>j;++j)if(Calendar._MN[j].substr(0,a[i].length).toLowerCase()==a[i].toLowerCase()){m=j;break}break;case"%H":case"%I":case"%k":case"%l":hr=parseInt(a[i],10);break;case"%P":case"%p":/pm/i.test(a[i])&&12>hr?hr+=12:/am/i.test(a[i])&&hr>=12&&(hr-=12);break;case"%M":min=parseInt(a[i],10);break;case"%r":hr=parseInt(a[i],10),min=parseInt(a[++i],10);{parseInt(a[++i],10)}/pm/i.test(a[++i])&&12>hr?hr+=12:/am/i.test(a[i])&&hr>=12&&(hr-=12)}if(isNaN(y)&&(y=today.getFullYear()),isNaN(m)&&(m=today.getMonth()),isNaN(d)&&(d=today.getDate()),isNaN(hr)&&(hr=today.getHours()),isNaN(min)&&(min=today.getMinutes()),0!=y&&-1!=m&&0!=d)return new Date(y,m,d,hr,min,0);for(y=0,m=-1,d=0,i=0;ij;++j)if(Calendar._MN[j].substr(0,a[i].length).toLowerCase()==a[i].toLowerCase()){t=j;break}-1!=t&&(-1!=m&&(d=m+1),m=t)}else parseInt(a[i],10)<=12&&-1==m?m=a[i]-1:parseInt(a[i],10)>31&&0==y?(y=parseInt(a[i],10),100>y&&(y+=y>29?1900:2e3)):0==d&&(d=a[i]);return 0==y&&(y=today.getFullYear()),-1!=m&&0!=d?new Date(y,m,d,hr,min,0):today},Date.prototype.getMonthDays=function(month){var year=this.getFullYear();return"undefined"==typeof month&&(month=this.getMonth()),0!=year%4||0==year%100&&0!=year%400||1!=month?Date._MD[month]:29},Date.prototype.getDayOfYear=function(){var now=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0),then=new Date(this.getFullYear(),0,0,0,0,0),time=now-then;return Math.floor(time/Date.DAY)},Date.prototype.getWeekNumber=function(){var d=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0),DoW=d.getDay();d.setDate(d.getDate()-(DoW+6)%7+3);var ms=d.valueOf();return d.setMonth(0),d.setDate(4),Math.round((ms-d.valueOf())/6048e5)+1},Date.prototype.equalsTo=function(date){return this.getFullYear()==date.getFullYear()&&this.getMonth()==date.getMonth()&&this.getDate()==date.getDate()&&this.getHours()==date.getHours()&&this.getMinutes()==date.getMinutes()},Date.prototype.setDateOnly=function(date){var tmp=new Date(date);this.setDate(1),this.setFullYear(tmp.getFullYear()),this.setMonth(tmp.getMonth()),this.setDate(tmp.getDate())},Date.prototype.print=function(str){var m=this.getMonth(),d=this.getDate(),y=this.getFullYear(),wn=this.getWeekNumber(),w=this.getDay(),s={},hr=this.getHours(),pm=hr>=12,ir=pm?hr-12:hr,dy=this.getDayOfYear();0==ir&&(ir=12);var min=this.getMinutes(),sec=this.getSeconds();s["%a"]=Calendar._SDN[w],s["%A"]=Calendar._DN[w],s["%b"]=Calendar._SMN[m],s["%B"]=Calendar._MN[m],s["%C"]=1+Math.floor(y/100),s["%d"]=10>d?"0"+d:d,s["%e"]=d,s["%H"]=10>hr?"0"+hr:hr,s["%I"]=10>ir?"0"+ir:ir,s["%j"]=100>dy?10>dy?"00"+dy:"0"+dy:dy,s["%k"]=hr,s["%l"]=ir,s["%m"]=9>m?"0"+(1+m):1+m,s["%M"]=10>min?"0"+min:min,s["%n"]="\n",s["%p"]=pm?"PM":"AM",s["%P"]=pm?"pm":"am",s["%r"]=(10>ir?"0"+ir:ir)+":"+(10>min?"0"+min:min)+":"+(10>sec?"0"+sec:sec)+" "+(pm?"PM":"AM"),s["%s"]=Math.floor(this.getTime()/1e3),s["%S"]=10>sec?"0"+sec:sec,s["%t"]=" ",s["%U"]=s["%W"]=s["%V"]=10>wn?"0"+wn:wn,s["%u"]=w+1,s["%w"]=w,s["%y"]=(""+y).substr(2,2),s["%Y"]=y,s["%%"]="%";var re=/%./g;if(!Calendar.is_ie5&&!Calendar.is_khtml)return str.replace(re,function(par){return s[par]||par});for(var a=str.match(re),i=0;i