(function(){var s,m,o,A,p,B,C,w,D,E,t,u,x,F,q=Array.prototype.slice,n=Object.prototype.hasOwnProperty,y=function(b,a){function c(){this.constructor=b}for(var d in a)if(n.call(a,d))b[d]=a[d];c.prototype=a.prototype;b.prototype=new c;b.__super__=a.prototype;return b};p=function(){return function(b,a){this.x=b;this.y=a}}();B=function(){function b(a,c,d,f){this.x=a;this.y=c;this.w=d;this.h=f}b.prototype.translated=function(a){return new b(this.x+a.x,this.y+a.y,this.w,this.h)};b.prototype.scaled=function(a){return new b(this.x,
this.y,this.w*a,this.h*a)};b.prototype.center=function(){return new p(this.x+this.w/2,this.y+this.h/2)};b.prototype.centeredAt=function(a){return new b(a.x-this.w/2,a.y-this.h/2,this.w,this.h)};b.prototype.centeredIn=function(a){return this.centeredAt(a.center())};return b}();E=function(b,a,c){return new B(b.x+(a.x-b.x)*c,b.y+(a.y-b.y)*c,b.w+(a.w-b.w)*c,b.h+(a.h-b.h)*c)};D=function(b,a,c){return new p(b.x+(a.x-b.x)*c,b.y+(a.y-b.y)*c)};A=function(){function b(a){this.e=a}b.prototype.getKeycode=function(){return this.e.charCode||
this.e.keyCode};b.prototype.isRightButton=function(){if(this.e.which)return this.e.which===3;else if(e.button)return this.e.button===2};b.prototype.getPos=function(){if(this.e.pageX||this.e.pageY)return new p(this.e.pageX,this.e.pageY);else if(this.e.clientX||this.e.clientY)return new p(this.e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,this.e.clientY+document.body.scrollTop+document.documentElement.scrollTop)};b.prototype.controlDown=function(){return this.e.ctrlKey};b.prototype.altDown=
function(){return this.e.altKey};b.prototype.shiftDown=function(){return this.e.shiftKey};b.prototype.metaDown=function(){return this.e.metaKey};b.prototype.stop=function(){if(this.e.stopPropagation)this.e.stopPropagation();else this.e.cancelBubble=true;return this.e.preventDefault?this.e.preventDefault():(this.e.returnValue=false)};return b}();o=function(){function b(){var a,c,d,f,g,h,j,i,k;a=arguments[0];c=2<=arguments.length?q.call(arguments,1):[];this._=g=document.createElement(a);h=0;for(i=c.length;h<
i;h++){a=c[h];if(typeof a==="string")g.className=a;else if(a instanceof Array){j=0;for(k=a.length;j<k;j++){f=a[j];typeof f==="string"?g.appendChild(document.createTextNode(f)):g.appendChild(f._)}}else for(d in a)if(n.call(a,d))g[d]=""+a[d]}}b.prototype.appendChildren=function(a){var c,d,f,g;g=[];d=0;for(f=a.length;d<f;d++){c=a[d];g.push(this.appendChild(c))}return g};b.prototype.appendChild=function(a){return this._.appendChild(a._)};b.prototype.removeChildren=function(){var a,c;a=this._.lastChild;
for(c=[];a;){this._.removeChild(a);c.push(a=this._.lastChild)}return c};b.prototype.setChildren=function(a){var c,d,f,g;this.removeChildren();g=[];d=0;for(f=a.length;d<f;d++){c=a[d];g.push(this.appendChild(c))}return g};b.prototype.setChild=function(a){return this.setChildren([a])};b.prototype.prependChild=function(a){this._.childNodes.length===0&&this._.appendChild(a._);return this._.insertBefore(a._,this._.firstChild)};b.prototype.insertBefore=function(a,c){return this._.insertBefore(a._,c._)};
b.prototype.appendToBody=function(){return document.body.appendChild(this._)};b.prototype.appendToHead=function(){return document.getElementsByTagName("head")[0].appendChild(this._)};b.prototype.appendTo=function(a){return a._.appendChild(this._)};b.prototype.prependTo=function(a){return a.prependChild(this)};b.prototype.remove=function(){var a;return(a=this._.parentNode)!=null?a.removeChild(this._):void 0};b.prototype.setTextChild=function(a){this.removeChildren();return this._.appendChild(document.createTextNode(a))};
b.prototype.setOpacity=function(a){var c;c=Math.round(100*a);return this.setStyles({opacity:a,filter:"alpha(opacity="+c+")","-ms-filter":"progid:DXImageTransform.Microsoft.Alpha(opacity="+c+")"})};b.prototype.setStyles=function(a){var c,d,f;f=[];for(c in a)if(n.call(a,c)){d=a[c];f.push(this._.style[c]=d)}return f};b.prototype.setPos=function(a){return this.setStyles({left:Math.round(a.x),top:Math.round(a.y)})};b.prototype.setRect=function(a){return this.setStyles({left:Math.round(a.x)+"px",top:Math.round(a.y)+
"px",width:Math.round(a.w)+"px",height:Math.round(a.h)+"px"})};b.prototype.on=function(a,c){return this._["on"+a]=function(d){return c(new A(d))}};b.prototype.setClasses=function(a){return this._.className=a.join(" ")};b.prototype.getClasses=function(){return this._.className?this._.className.split(" "):[]};b.prototype.addClass=function(a){var c;c=this.getClasses();if(c.indexOf(a)===-1){c.push(a);return this.setClasses(c)}};b.prototype.removeClass=function(a){var c;c=this.getClasses();a=c.indexOf(a);
if(a!==-1){c.splice(a,1);return this.setClasses(c)}};b.prototype.getValue=function(){return this._.value};b.prototype.setValue=function(a){return this._.value=a};b.prototype.scrollToBottom=function(){return this._.scrollTop=this._.scrollHeight-this._.clientHeight};return b}();m=function(){var b;b=1<=arguments.length?q.call(arguments,0):[];return function(a,c,d){d.prototype=a.prototype;d=new d;a=a.apply(d,c);return typeof a==="object"?a:d}(o,b,function(){})};s=function(){var b;b=1<=arguments.length?
q.call(arguments,0):[];return function(a,c,d){d.prototype=a.prototype;d=new d;a=a.apply(d,c);return typeof a==="object"?a:d}(o,["div"].concat(q.call(b)),function(){})};(function(){function b(){var a,c,d,f,g,h,j,i=this;g=arguments[0];a=2<=arguments.length?q.call(arguments,1):[];if(typeof g==="string"){d="whole";c="Button "+g}else if(g.lmr){d="lmr";c="Button "+g.lmr}b.__super__.constructor.call(this,"a",c,[this.overlay=m("div","Boverlay")]);d==="lmr"&&this.appendChildren([m("table",[m("tr",[m("td",
"BLR BL"),m("td","BM",[" "]),m("td","BLR BR")])])]);this.on("click",function(k){return i.click(k)});f=null;c={};h=0;for(j=a.length;h<j;h++){g=a[h];d=typeof g;if(d==="string")f=g;else if(d==="function")this.onclick=g;else _.extend(c,g)}if(c.id)this._.id=c.id;if(f)this.overlay.appendChild(this.label=s("Blabel",[f]))}y(b,o);b.prototype.setText=function(a){return this.label.setTextChild(a)};b.prototype.click=function(a){a&&a.stop();if(this.onclick)return this.onclick(a)};b.prototype.showLoader=function(){};
b.prototype.hideLoader=function(){};return b})();u=function(b){return b<16?"0"+b.toString(16):b.toString(16)};x=function(b){return[parseInt(b.substr(1,2),16),parseInt(b.substr(3,2),16),parseInt(b.substr(5,2),16)]};F=function(b,a,c){return"#"+u(b)+u(a)+u(c)};w=function(b,a,c){var d,f,g,h;d=x(b);g=d[0];b=d[1];d=d[2];f=x(a);h=f[0];a=f[1];f=f[2];return F(Math.round(g+(h-g)*c),Math.round(b+(a-b)*c),Math.round(d+(f-d)*c))};C=function(){function b(a,c,d){var f=this;this.duration=a;this.transition=c;this.f=
d;this.start=(new Date).getTime();this.f(0);setTimeout(function(){return f.step()},0)}b.prototype.step=function(){var a,c=this;a=((new Date).getTime()-this.start)/this.duration;if(a>1)a=1;this.f(this.transition(a));if(a<1)return setTimeout(function(){return c.step()},0)};return b}();(function(){return function(b,a){var c,d,f,g,h,j,i,k;d=a.duration;k=a.transition;g=a.oncomplete;h=a.opacity;i=a.rect;j=a.pos;c=a.background;b instanceof Array||(b=[b]);f=0;new C(d,k,function(l){var r,v,G;f++;v=0;for(G=
b.length;v<G;v++){r=b[v];h&&r.setOpacity(h[0]+(h[1]-h[0])*l);i&&r.setRect(E(i[0],i[1],l));j&&r.setPos(D(j[0],j[1],l));if(c)r._.style.background=w(c[0],c[1],l)}if(l===1&&g)return g({numFrames:f,info:a})})}})();t=function(b){var a,c,d,f;a=typeof b;if(b===null||a==="undefined")return"null";else if(a==="boolean"||a==="number")return b.valueOf();else if(a==="string")return'"'+b.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/,"\\n")+'"';else if(b instanceof Array){a=[];d=0;for(f=b.length;d<f;d++){c=
b[d];a.push(t(c))}return"["+a.join(",")+"]"}else{a=[];for(c in b)if(n.call(b,c)){d=b[c];a.push(t(c)+":"+t(d))}return"{"+a.join(",")+"}"}};var H,I,z,J;n=Object.prototype.hasOwnProperty;y=function(b,a){function c(){this.constructor=b}for(var d in a)if(n.call(a,d))b[d]=a[d];c.prototype=a.prototype;b.prototype=new c;b.__super__=a.prototype;return b};I=function(b,a,c,d){return function(f){return w(b,a,c===d?0.5:(f-c)/(d-c))}};z=function(b){return b.length===1?"0"+b:b};J=function(b){var a,c;a=1900+b.getYear();
c=z(""+(b.getMonth()+1));b=z(""+b.getDate());return""+a+"-"+c+"-"+b};H=function(){function b(a){var c,d,f,g,h,j,i,k,l;c=a.color;f=a.data;j=a.day_size;k=a.num_weeks;a=a.append_to;b.__super__.constructor.call(this,"div","Calendar");a&&document.getElementById(a).appendChild(this._);i=a=0;for(d=f.length;i<d;i++){h=f[i];h=h[1];if(h>a)a=h}c=I("#FFFFFF",c,0,a);i=j*k+1*(k+1);a=j*7+8;h=s();h.setStyles({width:i+"px",height:a+"px",position:"relative",background:"#999999"});this.appendChild(h);a={};i=new Date;
g=i.getDay();d=6-(7+g-1)%7;i=new Date(i.getTime()+864E5*d);for(d=g=k-1;g<=0?d<=0:d>=0;g<=0?d++:d--)for(l=6;l>=0;l--){a[J(i)]=""+d+":"+l;i=new Date(i.getTime()-864E5)}i={};for(d=0;0<=k?d<k:d>k;0<=k?d++:d--)for(l=0;l<7;l++){g=s();g.setStyles({width:j+"px",height:j+"px",background:"#FFFFFF",position:"absolute",left:1+(j+1)*d+"px",top:1+(j+1)*l+"px",zIndex:2});i[""+d+":"+l]=g;h.appendChild(g)}j=0;for(k=f.length;j<k;j++){h=f[j];d=h[0];h=h[1];(d=a[d])&&i[d].setStyles({background:c(h)})}}y(b,o);return b}();
window.Calendar=H})();
