function TextAreaResizer(b,a){this.textarea=b;this.staticOffset;this.iLastMousePos=0;this.iMin=32;this.grip;this.options=a;this.init()}TextAreaResizer.prototype.init=function(){this.textarea.addClassName("processed");this.staticOffset=null;var b=new Element("span");Element.wrap(this.textarea,b);b.wrap(new Element("div",{"class":"resizable-textarea"}));var a=new Element("div",{"class":"grippie"});b.parentNode.insert(a);a.style.marginRight=(a.getWidth()-this.textarea.getWidth())+"px";Event.observe(a,"mousedown",this.startDrag.bindAsEventListener(this))};TextAreaResizer.prototype.startDrag=function(a){var b=$A(arguments);b.shift();this.textarea=$(Event.element(a)).previous().firstDescendant();this.iLastMousePos=a.pointerY();this.staticOffset=this.textarea.getHeight()-this.iLastMousePos;this.textarea.setStyle({opacity:0.25});Event.observe(document,"mousemove",this.performDrag.bindAsEventListener(this));Event.observe(document,"mouseup",this.endDrag.bindAsEventListener(this));return false};TextAreaResizer.prototype.performDrag=function(b){var d=$A(arguments);d.shift();var a=b.pointerY();var c=this.staticOffset+a;if(this.iLastMousePos>=(a)){c-=5}this.iLastMousePos=a;c=Math.max(this.iMin,c);this.textarea.setStyle({height:c+"px"});if(c<this.iMin){this.endDrag(b)}return false};TextAreaResizer.prototype.endDrag=function(a){var b=$A(arguments);b.shift();Event.stopObserving(document,"mousemove");Event.stopObserving(document,"mouseup");this.textarea.setStyle({opacity:1});this.textarea.focus();this.staticOffset=null;this.textarea=null;this.iLastMousePos=0;if(this.options){if(this.options.afterDrag){this.options.afterDrag()}}};
