var DE={};DE.TextAreaControl=new Class({initialize:function(a){this.text=$(a);this.text.addClass("fg-grow");this.conditionalUpdate();var b=this.conditionalUpdate.bind(this);this.text.addEvents({focus:this.focus.bind(this),blur:this.blur.bind(this),keypress:b,keyup:b,keydown:b,change:b})},focus:function(){this.interval=this.conditionalUpdate.periodical(150,this)},blur:function(){$clear(this.interval)},conditionalUpdate:function(){var a=this.text.get("value").length;if(this.len==a){return}this.len=a;this.update()},update:function(){this.updateAutoGrow()},updateAutoGrow:function(){var a=this.text.getStyles("font-size","font-family","width","line-height");var b=this.getGhost().setStyles($merge(a,{height:this.origHeight})).set("value",this.text.get("value"));this.text.setStyle("height",Math.max(this.origHeight,b.getScrollSize().y))},getGhost:function(){if(!this.ghost){this.ghost=this.text.clone().addClass("fg-ghost").inject(document.body);this.ghost.removeAttribute("id");this.ghost.removeAttribute("name");this.origHeight=this.text.getStyle("height").toInt()}return this.ghost}});