(function(a){a.fn.autoResize=function(b){var c=a.extend({onResize:function(){},animate:true,animateDuration:150,animateCallback:function(){},extraSpace:20,limit:1000},b);this.filter("textarea").each(function(){var e=a(this).css({resize:"none","overflow-y":"hidden"}),g=e.height(),h=(function(){var i=["height","width","lineHeight","textDecoration","letterSpacing"],j={};a.each(i,function(k,l){j[l]=e.css(l)});return e.clone().removeAttr("id").removeAttr("name").css({position:"absolute",top:0,left:-9999}).css(j).attr("tabIndex","-1").insertBefore(e)})(),f=null,d=function(){var j=a(this).val().length;h.height(0).val(a(this).val()).scrollTop(10000);var k=Math.max(h.scrollTop(),g)+c.extraSpace,i=a(this).add(h);if(j==0){k=g}if(f===k){return}f=k;if(k>=c.limit){a(this).css("overflow-y","");return}c.onResize.call(this);c.animate&&e.css("display")==="block"?i.stop().animate({height:k},c.animateDuration,c.animateCallback):i.height(k)};e.unbind(".dynSiz").bind("keyup.dynSiz",d).bind("keydown.dynSiz",d).bind("change.dynSiz",d)});return this}})(jQuery);