(function($){var textarea,sticOfst,lstMsPos=0,iMin=32,grip;$.fn.textAreaResizer=function(){return this.each(function(){textarea=$(this).addClass('processed'),sticOfst=null;$(this).wrap('<span></span></div>').parent().append($('<div class="textAreaResize"><div class="textAreaResizeHandle sprite"></div></div>').bind("mousedown",{el:this},startDrag));var grippie=$('div.textAreaResize',$(this).parent())[0];grippie.style.marginRight=(grippie.offsetWidth-$(this)[0].offsetWidth)+'px'})};function startDrag(e){textarea=$(e.data.el);textarea.blur();lstMsPos=mousePosition(e).y;sticOfst=textarea.height()-lstMsPos;textarea.css('opacity',0.8);$(document).mousemove(performDrag).mouseup(endDrag);return false}function performDrag(e){var thisMsPos=mousePosition(e).y,msPos=sticOfst+thisMsPos;if(lstMsPos>=(thisMsPos)){msPos-=5}lstMsPos=thisMsPos;msPos=Math.max(iMin,msPos);textarea.height(msPos+'px');if(msPos<iMin){endDrag(e)}return false}function endDrag(e){$(document).unbind('mousemove',performDrag).unbind('mouseup',endDrag);textarea.css('opacity',1);textarea=null;sticOfst=null;lstMsPos=0}function mousePosition(e){return{x:e.clientX+document.documentElement.scrollLeft,y:e.clientY+document.documentElement.scrollTop}}})(jQuery);
