(function(c){function h(a){for(var b=Array("&","<",">",'"'),e=Array("&amp;","&lt;","&gt;","&quot;"),d=0;d<b.length;d++){var f=new RegExp(b[d],"gi");if(f.test(a))a=a.replace(f,e[d])}return a}function g(a,b){a=a;var e="jgrow-"+a.attr("name"),d=a.css("height");d=parseInt(d=="auto"?"50px":d);d=a.css("line-height");d=parseInt(d=="normal"?"16px":d);var f=h(a.val()).replace(/\n/g,"<br />");c("#"+e).length?c("#"+e).html(f):c("<div/>").attr("id",e).css({border:a.css("border"),"font-family":a.css("font-family"),
"font-size":a.css("font-size"),"font-weight":a.css("font-weight"),left:"-999px",overflow:"auto",padding:a.css("padding"),position:"absolute",top:0,width:a.css("width")}).html(f).appendTo("body");e=c.browser.msie?parseInt(c("#"+e).innerHeight()):parseInt(c("#"+e).css("height"))+d;if(e>parseInt(b.max_height))a.css({overflow:"auto",height:parseInt(b.max_height)+d+"px"});else if(e>b.cache_height)a.css("height",e+"px");else{b=isNaN(b.cache_height)?0:b.cache_height+"px";a.css("height",b)}}c.fn.jGrow=function(a){a=
c.extend({},c.fn.jGrow.defaults,a);this.each(function(){var b=c(this);b.css(a);b=c.browser.msie?b.innerHeight():b.css("height");b=parseInt(b);a.cache_height=b;new g(c(this),a)}).keyup(function(){new g(c(this),a)})};c.fn.jGrow.defaults={max_height:"700px",resize:"none",overflow:"hidden",cache_height:0};c.fn.jGrow.version="0.3.2"})(jQuery);
