Object.extend=function (destination,source){for(property in source){destination[property]=source[property];}return destination;};Object.extend(Array.prototype,{shift:function (){var result=this[0];for(var i=0;i<this.length-1;i++)this[i]=this[i+1];if(this.length>0)this.length--;return result;}});Function.prototype.bind=function (){var __method=this,args=$A(arguments),object=args.shift();return function (){return __method.apply(object,args.concat($A(arguments)));}};var $A=Array.from=function (iterable){if(!iterable)return [];else {var results=[];for(var i=0;i<iterable.length;i++)results.push(iterable[i]);return results;}};var Classes={};Classes.Base=function (){};Classes.Base.prototype={Set:function (property,value){this[property]=value;return this;},GetAtt:function (attribute,value){if(attribute==null||attribute==''||value==null||value=='')return '';return ' '+attribute+'="'+value+'" ';},GetAttDef:function (attribute,value,defaultValue){if(attribute==null||attribute=='')return '';if((value==null||value=='')&&(defaultValue==null||defaultValue==''))return '';if(value==null||value=='')return ' '+attribute+'="'+defaultValue+'" ';else return ' '+attribute+'="'+value+'" ';}};Object.extend(Date.prototype,{Clone:function (){return new Date(this);},AddDay:function (days){this.setDate(this.getDate()+days);return this;},AddMonth:function (months){this.setMonth(this.getMonth()+months);return this;},AddYear:function (years){this.setFullYear(this.getFullYear()+years);return this;},GetDaysInMonth:function (){var firstDayDate=new Date(this.getFullYear(),this.getMonth(),1);firstDayDate.AddMonth(1).AddDay(-1);return firstDayDate.getDate();},Equals:function (date){if(date==null)return false;return this.getFullYear()==date.getFullYear()&&this.getMonth()==date.getMonth()&&this.getDate()==date.getDate();}});;if(!Zen){var Zen={Web:{UI:{WebControls:{}}}}}else Zen.Web={UI:{WebControls:{}}};Zen.Web.UI.WebControls.ZenControl=function (){};Zen.Web.UI.WebControls.ZenControl.prototype=new Classes.Base;Zen.Web.UI.WebControls.Position=function (x,y){this.X=x;this.Y=y;};Zen.Web.UI.WebControls.Position.prototype={Add:function (position){return new Zen.Web.UI.WebControls.Position(this.X+position.X,this.Y+position.Y);},Sub:function (position){return new Zen.Web.UI.WebControls.Position(this.X-position.X,this.Y-position.Y);},ToString:function (){return '[X : '+this.X+', Y : '+this.Y+']';}};Zen.Web.UI.WebControls.Dimension=function (w,h){this.Width=w;this.Height=h;};Zen.Web.UI.WebControls.Dimension.prototype={Add:function (width,height){return new Zen.Web.UI.WebControls.Dimension(this.Width+width,this.Height+height);},ToString:function (){return '[Width : '+this.Width+', Height : '+this.Height+']';}};Zen.Web.UI.WebControls.Rectangle=function (l,t,w,h){this.Left=l;this.Top=t;this.Width=w;this.Height=h;};Zen.Web.UI.WebControls.Rectangle.prototype={Right:function (){return this.Left+this.Width;},Bottom:function (){return this.Top+this.Height;},ToString:function (){return '[Left : '+this.Left+', Top : '+this.Top+', Width : '+this.Width+', Height : '+this.Height+']';},Contains:function (position){if(position==null)return false;if(position.X==-1&&position.Y==-1)return true;return this.Left<position.X&&position.X<this.Right()&&this.Top<position.Y&&position.Y<this.Bottom();}};Zen.Web.UI.WebControls.Element=function (id){this.Id=id;this.HtmlElement=document.getElementById(id);this.IsNull=this.HtmlElement==null;};Zen.Web.UI.WebControls.Element.prototype={Display:function (){return this.HtmlElement.style.display!='none';},SetDisplay:function (display){this.HtmlElement.style.display=display?'':'none';},GetPosition:function (){var result=new Zen.Web.UI.WebControls.Position(0,0);var element=this.HtmlElement;while(element!=null){result=result.Add(new Zen.Web.UI.WebControls.Position(element.offsetLeft,element.offsetTop));element=element.offsetParent;}return result;},SetPosition:function (position){if(position.X!=null)this.HtmlElement.style.left=position.X+"px";if(position.Y!=null)this.HtmlElement.style.top=position.Y+"px";},SetVisibility:function (visible){this.HtmlElement.style.visibility=visible?'visible':'hidden';},MoveTo:function (x,y){this.SetPosition(new Zen.Web.UI.WebControls.Position(x,y));},GetDimension:function (){if(!this.Display()){var els=this.HtmlElement.style;var originalVisibility=els.visibility;var originalPosition=els.position;els.visibility='hidden';els.display='';var originalWidth=this.HtmlElement.offsetWidth;var originalHeight=this.HtmlElement.offsetHeight;els.display='none';els.position=originalPosition;els.visibility=originalVisibility;return new Zen.Web.UI.WebControls.Dimension(originalWidth,originalHeight);}return new Zen.Web.UI.WebControls.Dimension(this.HtmlElement.offsetWidth,this.HtmlElement.offsetHeight);},KeepDimension:function (){this._dimension=this.GetDimension();return this._dimension;},GetKeptDimension:function (){return this._dimension;},SetDimension:function (dimension){if(dimension.Width!=null)this.HtmlElement.style.width=dimension.Width+"px";if(dimension.Height!=null)this.HtmlElement.style.height=dimension.Height+"px";},SetOverflow:function (overflow){this.HtmlElement.style.overflow=overflow;},GetRectangle:function (){var position=this.GetPosition();var dimension=this.GetDimension();return new Zen.Web.UI.WebControls.Rectangle(position.X,position.Y,dimension.Width,dimension.Height);},Right:function (){return this.GetPosition().X+this.GetDimension().Width;},Bottom:function (){return this.GetPosition().Y+this.GetDimension().Height;}};Zen.Web.UI.WebControls.ZenLook=function (){};Zen.Web.UI.WebControls.ZenLook.prototype=new Classes.Base;Object.extend(Zen.Web.UI.WebControls.ZenLook.prototype,{});
