/** * ____ _____ * dynarch calendar -- jscal2, version 1.9 \ /_ / / * built at 2011/03/13 10:28 gmt \ / / / * \/ /_ / * (c) dynarch.com 2009 \ / / * all rights reserved. / / * visit www.dynarch.com/projects/calendar for details \/ * */ calendar=function(){function bm(a){typeof a=="string"&&(a=document.getelementbyid(a));return a}function bk(a,b,c){for(c=0;c=0;)$(a,b[d],c);else y(b,c,a?c:null);return a}function z(a,b){return y(a,b,b)}function y(a,b,c){if(a){var d=a.classname.replace(/^\s+|\s+$/,"").split(/\x20/),e=[],f;for(f=d.length;f>0;)d[--f]!=b&&e.push(d[f]);c&&e.push(c),a.classname=e.join(" ")}return c}function x(a){a=a||window.event,e?(a.cancelbubble=!0,a.returnvalue=!1):(a.preventdefault(),a.stoppropagation());return!1}function w(a,b,c,d){if(a instanceof array)for(var f=a.length;--f>=0;)w(a[f],b,c);else if(typeof b=="object")for(var f in b)b.hasownproperty(f)&&w(a,f,b[f],c);else a.removeeventlistener?a.removeeventlistener(b,c,e?!0:!!d):a.detachevent?a.detachevent("on"+b,c):a["on"+b]=null}function v(a,b,c,d){if(a instanceof array)for(var f=a.length;--f>=0;)v(a[f],b,c,d);else if(typeof b=="object")for(var f in b)b.hasownproperty(f)&&v(a,f,b[f],c);else a.addeventlistener?a.addeventlistener(b,c,e?!0:!!d):a.attachevent?a.attachevent("on"+b,c):a["on"+b]=c}function u(a,b,c,d){d={};for(c in b)b.hasownproperty(c)&&(d[c]=b[c]);for(c in a)a.hasownproperty(c)&&(d[c]=a[c]);return d}function t(a){if(/\s/.test(a)){a=a.tolowercase();function b(b){for(var c=b.length;--c>=0;)if(b[c].tolowercase().indexof(a)==0)return c+1}return b(l("smn"))||b(l("mn"))}}function s(a){if(a){if(typeof a=="number")return p(a);if(!(a instanceof date)){var b=a.split(/-/);return new date(parseint(b[0],10),parseint(b[1],10)-1,parseint(b[2],10),12,0,0,0)}}return a}function r(a,b){var c=a.getmonth(),d=a.getdate(),e=a.getfullyear(),f=m(a),g=a.getday(),h=a.gethours(),i=h>=12,j=i?h-12:h,k=n(a),l=a.getminutes(),m=a.getseconds(),n=/%./g,o;j===0&&(j=12),o={"%a":l("sdn")[g],"%a":l("dn")[g],"%b":l("smn")[c],"%b":l("mn")[c],"%c":1+math.floor(e/100),"%d":d<10?"0"+d:d,"%e":d,"%h":h<10?"0"+h:h,"%i":j<10?"0"+j:j,"%j":k<10?"00"+k:k<100?"0"+k:k,"%k":h,"%l":j,"%m":c<9?"0"+(1+c):1+c,"%o":1+c,"%m":l<10?"0"+l:l,"%n":"\n","%p":i?"pm":"am","%p":i?"pm":"am","%s":math.floor(a.gettime()/1e3),"%s":m<10?"0"+m:m,"%t":"\t","%u":f<10?"0"+f:f,"%w":f<10?"0"+f:f,"%v":f<10?"0"+f:f,"%u":g+1,"%w":g,"%y":(""+e).substr(2,2),"%y":e,"%%":"%"};return b.replace(n,function(a){return o.hasownproperty(a)?o[a]:a})}function q(a,b,c){var d=a.getfullyear(),e=a.getmonth(),f=a.getdate(),g=b.getfullyear(),h=b.getmonth(),i=b.getdate();return dg?3:eh?2:c?0:fi?1:0}function p(a,b,c,d,e){if(!(a instanceof date)){a=parseint(a,10);var f=math.floor(a/1e4);a=a%1e4;var g=math.floor(a/100);a=a%100,a=new date(f,g-1,a,b==null?12:b,c==null?0:c,d==null?0:d,e==null?0:e)}return a}function o(a){if(a instanceof date)return 1e4*a.getfullyear()+100*(a.getmonth()+1)+a.getdate();if(typeof a=="string")return parseint(a,10);return a}function n(a){a=new date(a.getfullyear(),a.getmonth(),a.getdate(),12,0,0);var b=new date(a.getfullyear(),0,1,12,0,0),c=a-b;return math.floor(c/864e5)}function m(a){a=new date(a.getfullyear(),a.getmonth(),a.getdate(),12,0,0);var b=a.getday();a.setdate(a.getdate()-(b+6)%7+3);var c=a.valueof();a.setmonth(0),a.setdate(4);return math.round((c-a.valueof())/6048e5)+1}function l(a,b){var c=i.__.data[a];b&&typeof c=="string"&&(c=k(c,b));return c}function k(a,b){return a.replace(/\$\{([^:\}]+)(:[^\}]+)?\}/g,function(a,c,d){var e=b[c],f;d&&(f=d.substr(1).split(/\s*\|\s*/),e=(e>=f.length?f[f.length-1]:f[e]).replace(/##?/g,function(a){return a.length==2?"#":e}));return e})}function j(b){if(!this._menuanim){b=b||window.event;var c=b.target||b.srcelement,d=c.getattribute("dyc-btn"),e=b.keycode,f=b.charcode||e,g=h[e];if("year"==d&&e==13){var h=new date(this.date);h.setdate(1),h.setfullyear(this._getinputyear()),this.moveto(h,!0),z(this,!1);return x(b)}if(this._menuvisible){if(e==27){z(this,!1);return x(b)}}else{b.ctrlkey||(g=null),g==null&&!b.ctrlkey&&(g=i[e]),e==36&&(g=0);if(g!=null){y(this,g);return x(b)}f=string.fromcharcode(f).tolowercase();var i=this.els.yearinput,j=this.selection;if(f==" "){z(this,!0),this.focus(),i.focus(),i.select();return x(b)}if(f>="0"&&f<="9"){z(this,!0),this.focus(),i.value=f,i.focus();return x(b)}var k=l("mn"),l=b.shiftkey?-1:this.date.getmonth(),m=0,n;while(++m<12){n=k[(l+m)%12].tolowercase();if(n.indexof(f)==0){var h=new date(this.date);h.setdate(1),h.setmonth((l+m)%12),this.moveto(h,!0);return x(b)}}if(e>=37&&e<=40){var h=this._lasthoverdate;if(!h&&!j.isempty()){h=e<39?j.getfirstdate():j.getlastdate();if(hthis._lastdatevisible)h=null}if(!h)h=e<39?this._lastdatevisible:this._firstdatevisible;else{var o=h;h=p(h);var l=100;while(l-->0){switch(e){case 37:h.setdate(h.getdate()-1);break;case 38:h.setdate(h.getdate()-7);break;case 39:h.setdate(h.getdate()+1);break;case 40:h.setdate(h.getdate()+7)}if(!this.isdisabled(h))break}h=o(h),(hthis._lastdatevisible)&&this.moveto(h)}y(this._getdatediv(o),z(this._getdatediv(h),"dynarchcalendar-hover-date")),this._lasthoverdate=h;return x(b)}if(e==13&&this._lasthoverdate){j.type==a.sel_multiple&&(b.shiftkey||b.ctrlkey)?(b.shiftkey&&this._selrangestart&&(j.clear(!0),j.selectrange(this._selrangestart,this._lasthoverdate)),b.ctrlkey&&j.set(this._selrangestart=this._lasthoverdate,!0)):j.reset(this._selrangestart=this._lasthoverdate);return x(b)}e==27&&!this.args.cont&&this.hide()}}}function g(){this.refresh();var a=this.inputfield,b=this.selection;if(a){var c=b.print(this.dateformat);/input|textarea/i.test(a.tagname)?a.value=c:a.innerhtml=c}this.callhooks("onselect",this,b)}function f(a){a=a||window.event;var b=c(a);if(b){var c=b.getattribute("dyc-btn"),d=b.getattribute("dyc-type"),e=a.wheeldelta?a.wheeldelta/120:-a.detail/3;e=e<0?-1:e>0?1:0,this.args.reversewheel&&(e=-e);if(/^(time-(hour|min))/.test(d)){switch(regexp.$1){case"time-hour":this.sethours(this.gethours()+e);break;case"time-min":this.setminutes(this.getminutes()+this.args.minutestep*e)}x(a)}else/y/i.test(c)&&(e*=2),y(this,-e),x(a)}}function e(a,b){b=b||window.event;var c=c(b);if(c){var d=c.getattribute("dyc-type");if(d&&!c.getattribute("disabled"))if(!a||!this._bodyanim||d!="date"){var e=c.getattribute("dyc-cls");e=e?d(e,0):"dynarchcalendar-hover-"+d,(d!="date"||this.selection.type)&&$(a,c,e),d=="date"&&($(a,c.parentnode.parentnode,"dynarchcalendar-hover-week"),this._showtooltip(c.getattribute("dyc-date"))),/^time-hour/.test(d)&&$(a,this.els.timehour,"dynarchcalendar-hover-time"),/^time-min/.test(d)&&$(a,this.els.timeminute,"dynarchcalendar-hover-time"),y(this._getdatediv(this._lasthoverdate),"dynarchcalendar-hover-date"),this._lasthoverdate=null}}a||this._showtooltip()}function d(a,b){return"dynarchcalendar-"+a.split(/,/)[b]}function c(a){var b=a.target||a.srcelement,c=b;while(b&&b.getattribute&&!b.getattribute("dyc-type"))b=b.parentnode;return b.getattribute&&b||c}function b(a){a=a||window.event;var b=this.els.topcont.style,c=bh(a,this._mousediff);b.left=c.x+"px",b.top=c.y+"px"}function a(b,c){c=c||window.event;var d=c(c);if(d&&!d.getattribute("disabled")){var f=d.getattribute("dyc-btn"),g=d.getattribute("dyc-type"),h=d.getattribute("dyc-date"),i=this.selection,j,k={mouseover:x,mousemove:x,mouseup:function(a){var b=d.getattribute("dyc-cls");b&&y(d,d(b,1)),cleartimeout(j),w(document,k,!0),k=null}};if(b){settimeout(bb(this.focus,this),1);var l=d.getattribute("dyc-cls");l&&z(d,d(l,1));if("menu"==f)this.togglemenu();else if(d&&/^[+-][my]$/.test(f))if(y(this,f)){var m=bb(function(){y(this,f,!0)?j=settimeout(m,40):(k.mouseup(),y(this,f))},this);j=settimeout(m,350),v(document,k,!0)}else k.mouseup();else if("year"==f)this.els.yearinput.focus(),this.els.yearinput.select();else if(g=="time-am")v(document,k,!0);else if(/^time/.test(g)){var m=bb(function(a){w.call(this,a),j=settimeout(m,100)},this,g);w.call(this,g),j=settimeout(m,350),v(document,k,!0)}else h&&i.type&&(i.type==a.sel_multiple?c.shiftkey&&this._selrangestart?i.selectrange(this._selrangestart,h):(!c.ctrlkey&&!i.isselected(h)&&i.clear(!0),i.set(h,!0),this._selrangestart=h):(i.set(h),this.moveto(p(h),2)),d=this._getdatediv(h),e.call(this,!0,{target:d})),v(document,k,!0);e&&k&&/dbl/i.test(c.type)&&k.mouseup(),!this.args.fixed&&/^(dynarchcalendar-(topbar|bottombar|weekend|weeknumber|menu(-sep)?))?$/.test(d.classname)&&!this.args.cont&&(k.mousemove=bb(b,this),this._mousediff=bh(c,bi(this.els.topcont)),v(document,k,!0))}else if("today"==f)!this._menuvisible&&i.type==a.sel_single&&i.set(new date),this.moveto(new date,!0),z(this,!1);else if(/^m([0-9]+)/.test(f)){var h=new date(this.date);h.setdate(1),h.setmonth(regexp.$1),h.setfullyear(this._getinputyear()),this.moveto(h,!0),z(this,!1)}else g=="time-am"&&this.sethours(this.gethours()+12);e||x(c)}}function z(a,b){a._menuvisible=b,$(b,a.els.title,"dynarchcalendar-pressed-title");var c=a.els.menu;f&&(c.style.height=a.els.main.offsetheight+"px");if(!a.args.animation)bg(c,b),a.focused&&a.focus();else{a._menuanim&&a._menuanim.stop();var d=a.els.main.offsetheight;f&&(c.style.width=a.els.topbar.offsetwidth+"px"),b&&(c.firstchild.style.margintop=-d+"px",a.args.opacity>0&&bf(c,0),bg(c,!0)),a._menuanim=bd({onupdate:function(e,f){c.firstchild.style.margintop=f(be.accel_b(e),-d,0,!b)+"px",a.args.opacity>0&&bf(c,f(be.accel_b(e),0,.85,!b))},onstop:function(){a.args.opacity>0&&bf(c,.85),c.firstchild.style.margintop="",a._menuanim=null,b||(bg(c,!1),a.focused&&a.focus())}})}}function y(a,b,c){this._bodyanim&&this._bodyanim.stop();var d;if(b!=0){d=new date(a.date),d.setdate(1);switch(b){case"-y":case-2:d.setfullyear(d.getfullyear()-1);break;case"+y":case 2:d.setfullyear(d.getfullyear()+1);break;case"-m":case-1:d.setmonth(d.getmonth()-1);break;case"+m":case 1:d.setmonth(d.getmonth()+1)}}else d=new date;return a.moveto(d,!c)}function w(a){switch(a){case"time-hour+":this.sethours(this.gethours()+1);break;case"time-hour-":this.sethours(this.gethours()-1);break;case"time-min+":this.setminutes(this.getminutes()+this.args.minutestep);break;case"time-min-":this.setminutes(this.getminutes()-this.args.minutestep);break;default:return}}function v(){this._bluringtimeout=settimeout(bb(u,this),50)}function u(){this.focused=!1,y(this.els.main,"dynarchcalendar-focused"),this._menuvisible&&z(this,!1),this.args.cont||this.hide(),this.callhooks("onblur",this)}function t(){this._bluringtimeout&&cleartimeout(this._bluringtimeout),this.focused=!0,z(this.els.main,"dynarchcalendar-focused"),this.callhooks("onfocus",this)}function s(a){var b=_("div"),c=a.els={},d={mousedown:bb(a,a,!0),mouseup:bb(a,a,!1),mouseover:bb(e,a,!0),mouseout:bb(e,a,!1),keypress:bb(j,a)};a.args.noscroll||(d[g?"dommousescroll":"mousewheel"]=bb(f,a)),e&&(d.dblclick=d.mousedown,d.keydown=d.keypress),b.innerhtml=m(a),bc(b.firstchild,function(a){var b=r[a.classname];b&&(c[b]=a),e&&a.setattribute("unselectable","on")}),v(c.main,d),v([c.focuslink,c.yearinput],a._focusevents={focus:bb(t,a),blur:bb(v,a)}),a.moveto(a.date,!1),a.settime(null,!0);return c.topcont}function q(a){function d(){c.showtime&&(b.push(""),p(a,b),b.push(""))}var b=[],c=a.args;b.push(""),c.timepos=="left"&&d(),c.bottombar&&(b.push(""),b.push("","
",l("today"),"
",""),b.push("")),c.timepos=="right"&&d(),b.push("");return b.join("")}function p(a,b){b.push("","","","","",""),a.args.showtime==12&&b.push("",""),b.push("","","","
")}function o(a){var b=["
","","","","
",l("gotoday"),"
","

 

",""],c=l("smn"),d=0,e=b.length,f;while(d<12){b[e++]="";for(f=4;--f>0;)b[e++]="";b[e++]=""}b[e++]="
"+c[d++]+"
";return b.join("")}function n(a){return"
"+r(a.date,a.args.titleformat)+"
"}function m(a){var b=["
","
",e?"":"","
","
","
","
","
","
","
",n(a),"
","
",k(a),"
","
","
"];(a.args.bottombar||a.args.showtime)&&b.push("
",q(a),"
"),b.push("","
","
","
");return b.join("")}function l(a,b,c){b=b||a.date,c=c||a.fdow,b=new date(b.getfullyear(),b.getmonth(),b.getdate(),12,0,0,0);var d=b.getmonth(),e=[],f=0,g=a.args.weeknumbers;b.setdate(1);var h=(b.getday()-c)%7;h<0&&(h+=7),b.setdate(0-h),b.setdate(b.getdate()+1);var i=new date,k=i.getdate(),l=i.getmonth(),m=i.getfullyear();e[f++]="";for(var n=0;n<6;++n){e[f++]="",g&&(e[f++]="");for(var o=0;o<7;++o){var p=b.getdate(),q=b.getmonth(),r=b.getfullyear(),s=1e4*r+100*(q+1)+p,t=a.selection.isselected(s),u=a.isdisabled(b);e[f++]="",b=new date(r,q,p+1,12,0,0,0)}e[f++]=""}e[f++]="
"+m(b)+"
=0&&(e[f++]=" dynarchcalendar-weekend"),q!=d&&(e[f++]=" dynarchcalendar-day-othermonth"),p==k&&q==l&&r==m&&(e[f++]=" dynarchcalendar-day-today"),u&&(e[f++]=" dynarchcalendar-day-disabled"),t&&(e[f++]=" dynarchcalendar-day-selected"),u=a.args.dateinfo(b),u&&u.klass&&(e[f++]=" "+u.klass),e[f++]="'>"+p+"
";return e.join("")}function k(a){var b=[""],c=0;a.args.weeknumbers&&b.push("
",l("wk"),"
");while(c<7){var d=(c++ +a.fdow)%7;b.push("=0?" class='dynarchcalendar-weekend'>":">",l("sdn")[d],"")}b.push("");return b.join("")}function a(b){b=b||{},this.args=b=u(b,{animation:!f,cont:null,bottombar:!0,date:!0,fdow:l("fdow"),min:null,max:null,reversewheel:!1,selection:[],selectiontype:a.sel_single,weeknumbers:!1,align:"bl/ / /t/r",inputfield:null,trigger:null,dateformat:"%y-%m-%d",fixed:!1,opacity:e?1:3,titleformat:"%b %y",showtime:!1,timepos:"right",time:!0,minutestep:5,noscroll:!1,disabled:bl,checkrange:!1,dateinfo:bl,onchange:bl,onselect:bl,ontimechange:bl,onfocus:bl,onblur:bl}),this.handlers={};var c=this,d=new date;b.min=s(b.min),b.max=s(b.max),b.date===!0&&(b.date=d),b.time===!0&&(b.time=d.gethours()*100+math.floor(d.getminutes()/b.minutestep)*b.minutestep),this.date=s(b.date),this.time=b.time,this.fdow=b.fdow,bk("onchange onselect ontimechange onfocus onblur".split(/\s+/),function(a){var d=b[a];d instanceof array||(d=[d]),c.handlers[a]=d}),this.selection=new a.selection(b.selection,b.selectiontype,g,this);var g=s(this);b.cont&&bm(b.cont).appendchild(g),b.trigger&&this.managefields(b.trigger,b.inputfield,b.dateformat)}var b=navigator.useragent,c=/opera/i.test(b),d=/konqueror|safari|khtml/i.test(b),e=/msie/i.test(b)&&!c&&!/mac_powerpc/i.test(b),f=e&&/msie 6/i.test(b),g=/gecko/i.test(b)&&!d&&!c&&!e,h=a.prototype,i=a.i18n={};a.sel_none=0,a.sel_single=1,a.sel_multiple=2,a.sel_week=3,a.datetoint=o,a.inttodate=p,a.printdate=r,a.formatstring=k,a.i18n=l,a.lang=function(a,b,c){i.__=i[a]={name:b,data:c}},a.setup=function(b){return new a(b)},h.moveto=function(a,b){var c=this;a=s(a);var d=q(a,c.date,!0),e,f=c.args,g=f.min&&q(a,f.min),h=f.max&&q(a,f.max);f.animation||(b=!1),$(g!=null&&g<=1,[c.els.navprevmonth,c.els.navprevyear],"dynarchcalendar-navdisabled"),$(h!=null&&h>=-1,[c.els.navnextmonth,c.els.navnextyear],"dynarchcalendar-navdisabled"),g<-1&&(a=f.min,e=1,d=0),h>1&&(a=f.max,e=2,d=0),c.date=a,c.refresh(!!b),c.callhooks("onchange",c,a,b);if(b&&(d!=0||b!=2)){c._bodyanim&&c._bodyanim.stop();var i=c.els.body,j=_("div","dynarchcalendar-animbody-"+x[d],i),k=i.firstchild,m=bf(k)||.7,n=e?be.brakes:d==0?be.shake:be.accel_ab2,o=d*d>4,p=o?k.offsettop:k.offsetleft,q=j.style,r=o?i.offsetheight:i.offsetwidth;d<0?r+=p:d>0?r=p-r:(r=math.round(r/7),e==2&&(r=-r));if(!e&&d!=0){var s=j.clonenode(!0),t=s.style,u=2*r;s.appendchild(k.clonenode(!0)),t[o?"margintop":"marginleft"]=r+"px",i.appendchild(s)}k.style.visibility="hidden",j.innerhtml=l(c),c._bodyanim=bd({onupdate:function(a,b){var f=n(a);if(s)var g=b(f,r,u)+"px";if(e)q[o?"margintop":"marginleft"]=b(f,r,0)+"px";else{if(o||d==0)q.margintop=b(d==0?n(a*a):f,0,r)+"px",d!=0&&(t.margintop=g);if(!o||d==0)q.marginleft=b(f,0,r)+"px",d!=0&&(t.marginleft=g)}c.args.opacity>2&&s&&(bf(s,1-f),bf(j,f))},onstop:function(b){i.innerhtml=l(c,a),c._bodyanim=null}})}c._lasthoverdate=null;return g>=-1&&h<=1},h.isdisabled=function(a){var b=this.args;return b.min&&q(a,b.min)<0||b.max&&q(a,b.max)>0||b.disabled(a)},h.togglemenu=function(){z(this,!this._menuvisible)},h.refresh=function(a){var b=this.els;a||(b.body.innerhtml=l(this)),b.title.innerhtml=n(this),b.yearinput.value=this.date.getfullyear()},h.redraw=function(){var a=this,b=a.els;a.refresh(),b.daynames.innerhtml=k(a),b.menu.innerhtml=o(a),b.bottombar&&(b.bottombar.innerhtml=q(a)),bc(b.topcont,function(c){var d=r[c.classname];d&&(b[d]=c),c.classname=="dynarchcalendar-menu-year"?(v(c,a._focusevents),b.yearinput=c):e&&c.setattribute("unselectable","on")}),a.settime(null,!0)},h.setlanguage=function(b){var c=a.setlanguage(b);c&&(this.fdow=c.data.fdow,this.redraw())},a.setlanguage=function(a){var b=i[a];b&&(i.__=b);return b},h.focus=function(){try{this.els[this._menuvisible?"yearinput":"focuslink"].focus()}catch(a){}t.call(this)},h.blur=function(){this.els.focuslink.blur(),this.els.yearinput.blur(),u.call(this)},h.showat=function(a,b,c){this._showanim&&this._showanim.stop(),c=c&&this.args.animation;var d=this.els.topcont,e=this,f=this.els.body.firstchild,g=f.offsetheight,h=d.style;h.position="absolute",h.left=a+"px",h.top=b+"px",h.zindex=1e4,h.display="",c&&(f.style.margintop=-g+"px",this.args.opacity>1&&bf(d,0),this._showanim=bd({onupdate:function(a,b){f.style.margintop=-b(be.accel_b(a),g,0)+"px",e.args.opacity>1&&bf(d,a)},onstop:function(){e.args.opacity>1&&bf(d,""),e._showanim=null}}))},h.hide=function(){var a=this.els.topcont,b=this,c=this.els.body.firstchild,d=c.offsetheight,e=bi(a).y;this.args.animation?(this._showanim&&this._showanim.stop(),this._showanim=bd({onupdate:function(f,g){b.args.opacity>1&&bf(a,1-f),c.style.margintop=-g(be.accel_b(f),0,d)+"px",a.style.top=g(be.accel_ab(f),e,e-10)+"px"},onstop:function(){a.style.display="none",c.style.margintop="",b.args.opacity>1&&bf(a,""),b._showanim=null}})):a.style.display="none",this.inputfield=null},h.popup=function(a,b){function h(b){var c={x:i.x,y:i.y};if(!b)return c;/b/.test(b)&&(c.y+=a.offsetheight),/b/.test(b)&&(c.y+=a.offsetheight-f.y),/t/.test(b)&&(c.y-=f.y),/l/.test(b)&&(c.x-=f.x-a.offsetwidth),/l/.test(b)&&(c.x-=f.x),/r/.test(b)&&(c.x+=a.offsetwidth),/c/i.test(b)&&(c.x+=(a.offsetwidth-f.x)/2),/m/i.test(b)&&(c.y+=(a.offsetheight-f.y)/2);return c}a=bm(a),b||(b=this.args.align),b=b.split(/\x2f/);var c=bi(a),d=this.els.topcont,e=d.style,f,g=bj();e.visibility="hidden",e.display="",this.showat(0,0),document.body.appendchild(d),f={x:d.offsetwidth,y:d.offsetheight};var i=c;i=h(b[0]),i.yg.x+g.w&&(i.x=c.x,i=h(b[2])),i.y+f.y>g.y+g.h&&(i.y=c.y,i=h(b[3])),i.x=0)c[d]===b&&c.splice(d,1)},h.gettime=function(){return this.time},h.settime=function(a,b){if(this.args.showtime){a=a!=null?a:this.time,this.time=a;var c=this.gethours(),d=this.getminutes(),e=c<12;this.args.showtime==12&&(c==0&&(c=12),c>12&&(c-=12),this.els.timeam.innerhtml=l(e?"am":"pm")),c<10&&(c="0"+c),d<10&&(d="0"+d),this.els.timehour.innerhtml=c,this.els.timeminute.innerhtml=d,b||this.callhooks("ontimechange",this,a)}},h.gethours=function(){return math.floor(this.time/100)},h.getminutes=function(){return this.time%100},h.sethours=function(a){a<0&&(a+=24),this.settime(100*(a%24)+this.time%100)},h.setminutes=function(a){a<0&&(a+=60),a=math.floor(a/this.args.minutestep)*this.args.minutestep,this.settime(100*this.gethours()+a%60)},h._getinputyear=function(){var a=parseint(this.els.yearinput.value,10);isnan(a)&&(a=this.date.getfullyear());return a},h._showtooltip=function(a){var b="",c,d=this.els.tooltip;a&&(a=p(a),c=this.args.dateinfo(a),c&&c.tooltip&&(b="
"+r(a,c.tooltip)+"
")),d.innerhtml=b};var j=" align='center' cellspacing='0' cellpadding='0'",r={"dynarchcalendar-topcont":"topcont","dynarchcalendar-focuslink":"focuslink",dynarchcalendar:"main","dynarchcalendar-topbar":"topbar","dynarchcalendar-title":"title","dynarchcalendar-daynames":"daynames","dynarchcalendar-body":"body","dynarchcalendar-menu":"menu","dynarchcalendar-menu-year":"yearinput","dynarchcalendar-bottombar":"bottombar","dynarchcalendar-tooltip":"tooltip","dynarchcalendar-time-hour":"timehour","dynarchcalendar-time-minute":"timeminute","dynarchcalendar-time-am":"timeam","dynarchcalendar-navbtn dynarchcalendar-prevyear":"navprevyear","dynarchcalendar-navbtn dynarchcalendar-nextyear":"navnextyear","dynarchcalendar-navbtn dynarchcalendar-prevmonth":"navprevmonth","dynarchcalendar-navbtn dynarchcalendar-nextmonth":"navnextmonth"},x={"-3":"backyear","-2":"back",0:"now",2:"fwd",3:"fwdyear"},h={37:-1,38:-2,39:1,40:2},i={33:-1,34:1};h._getdatediv=function(a){var b=null;if(a)try{bc(this.els.body,function(c){if(c.getattribute("dyc-date")==a)throw b=c})}catch(c){}return b},(a.selection=function(a,b,c,d){this.type=b,this.sel=a instanceof array?a:[a],this.onchange=bb(c,d),this.cal=d}).prototype={get:function(){return this.type==a.sel_single?this.sel[0]:this.sel},isempty:function(){return this.sel.length==0},set:function(b,c,d){var e=this.type==a.sel_single;b instanceof array?(this.sel=b,this.normalize(),d||this.onchange(this)):(b=o(b),e||!this.isselected(b)?(e?this.sel=[b]:this.sel.splice(this.findinsertpos(b),0,b),this.normalize(),d||this.onchange(this)):c&&this.unselect(b,d))},reset:function(){this.sel=[],this.set.apply(this,arguments)},countdays:function(){var a=0,b=this.sel,c=b.length,d,e,f;while(--c>=0)d=b[c],d instanceof array&&(e=p(d[0]),f=p(d[1]),a+=math.round(math.abs(f.gettime()-e.gettime())/864e5)),++a;return a},unselect:function(a,b){a=o(a);var c=!1;for(var d=this.sel,e=d.length,f;--e>=0;){f=d[e];if(f instanceof array){if(a>=f[0]&&a<=f[1]){var g=p(a),h=g.getdate();if(a==f[0])g.setdate(h+1),f[0]=o(g),c=!0;else if(a==f[1])g.setdate(h-1),f[1]=o(g),c=!0;else{var i=new date(g);i.setdate(h+1),g.setdate(h-1),d.splice(e+1,0,[o(i),f[1]]),f[1]=o(g),c=!0}}}else a==f&&(d.splice(e,1),c=!0)}c&&(this.normalize(),b||this.onchange(this))},normalize:function(){this.sel=this.sel.sort(function(a,b){a instanceof array&&(a=a[0]),b instanceof array&&(b=b[0]);return a-b});for(var a=this.sel,b=a.length,c,d;--b>=0;){c=a[b];if(c instanceof array){if(c[0]>c[1]){a.splice(b,1);continue}c[0]==c[1]&&(c=a[b]=c[0])}if(d){var e=d,f=c instanceof array?c[1]:c;f=p(f),f.setdate(f.getdate()+1),f=o(f);if(f>=e){var g=a[b+1];c instanceof array&&g instanceof array?(c[1]=g[1],a.splice(b+1,1)):c instanceof array?(c[1]=d,a.splice(b+1,1)):g instanceof array?(g[0]=c,a.splice(b,1)):(a[b]=[c,g],a.splice(b+1,1))}}d=c instanceof array?c[0]:c}},findinsertpos:function(a){for(var b=this.sel,c=b.length,d;--c>=0;){d=b[c],d instanceof array&&(d=d[0]);if(d<=a)break}return c+1},clear:function(a){this.sel=[],a||this.onchange(this)},selectrange:function(b,c){b=o(b),c=o(c);if(b>c){var d=b;b=c,c=d}var e=this.cal.args.checkrange;if(!e)return this._do_selectrange(b,c);try{bk((new a.selection([[b,c]],a.sel_multiple,bl)).getdates(),bb(function(a){if(this.isdisabled(a)){e instanceof function&&e(a,this);throw"out"}},this.cal)),this._do_selectrange(b,c)}catch(f){}},_do_selectrange:function(a,b){this.sel.push([a,b]),this.normalize(),this.onchange(this)},isselected:function(a){for(var b=this.sel.length,c;--b>=0;){c=this.sel[b];if(c instanceof array&&a>=c[0]&&a<=c[1]||a==c)return!0}return!1},getfirstdate:function(){var a=this.sel[0];a&&a instanceof array&&(a=a[0]);return a},getlastdate:function(){if(this.sel.length>0){var a=this.sel[this.sel.length-1];a&&a instanceof array&&(a=a[1]);return a}},print:function(a,b){var c=[],d=0,e,f=this.cal.gethours(),g=this.cal.getminutes();b||(b=" -> ");while(d=12&&(h-=12)));var l=function(){function k(a){d.push(a)}function j(){var a="";while(g()&&/[0-9]/.test(g()))a+=f();if(h(g()))return i(a);return parseint(a,10)}function i(a){while(g()&&h(g()))a+=f();return a}function g(){return b.charat(c)}function f(){return b.charat(c++)}var c=0,d=[],e,h=a.isunicodeletter;while(c12?o>=1&&o<=31&&(g=o):m.push(o):e=o):f==null&&(f=t(o))}m.length<2?m.length==1&&(g==null?g=m.shift():f==null&&(f=m.shift())):c?(f==null&&(f=m.shift()),g==null&&(g=m.shift())):(g==null&&(g=m.shift()),f==null&&(f=m.shift())),e==null&&(e=m.length>0?m.shift():d.getfullyear()),e<30?e+=2e3:e<99&&(e+=1900),f==null&&(f=d.getmonth()+1);return e!=null&&f!=null&&g!=null?new date(e,f-1,g,h,i,j):null};var be={elastic_b:function(a){return 1-math.cos(-a*5.5*math.pi)/math.pow(2,7*a)},magnetic:function(a){return 1-math.cos(a*a*a*10.5*math.pi)/math.exp(4*a)},accel_b:function(a){a=1-a;return 1-a*a*a*a},accel_a:function(a){return a*a*a},accel_ab:function(a){a=1-a;return 1-math.sin(a*a*math.pi/2)},accel_ab2:function(a){return(a/=.5)<1?.5*a*a:-0.5*(--a*(a-2)-1)},brakes:function(a){a=1-a;return 1-math.sin(a*a*math.pi)},shake:function(a){return a<.5?-math.cos(a*11*math.pi)*a*a:(a=1-a,math.cos(a*11*math.pi)*a*a)}},bl=new function;return a}()