/* jQuery.BetterGrow v 1.0 http://tpgblog.com/bettergrow/
compiled by http://yui.2clics.net/ */
(function(b){b.fn.BetterGrow=function(e){var g;var f;if((typeof e=="object")||(e==undefined)){f=b.extend({},b.fn.BetterGrow.settings,e);return this.each(function(){var h=b(this);if(h.parent("div").length==0){h.wrap('<div style="border:0; padding:0; margin:0"></div>')}c(h,f.initial_height);d(h,f);h.keydown()})}return this};b.fn.BetterGrow.settings={initial_height:26,on_enter:null,do_not_enter:true};function c(f,e){f.height(e)}function d(f,g){var e=g.initial_height;f.parent().css("height","auto");f.css("overflow","hidden");f.unbind("keydown");f.unbind("keyup");f.keydown(function(h){a(f,e);if(h.keyCode==13){if(g.on_enter!=null){g.on_enter();if(g.do_not_enter){h.preventDefault();h.stopImmediatePropagation()}}}});f.keyup(function(){a(f,e)})}function a(h,f){var e;var g;if(!a.browser_calc){a.browser_calc=b.browser.msie||b.browser.safari;a.padding_calc=a.browser_calc?(parseInt(h.css("padding-top"))+parseInt(h.css("padding-bottom"))):0}e=h.height();if(e>f){h.parent().css("height",h.height()+"px");h.height(0)}g=h.get(0).scrollHeight-a.padding_calc;if(g>f){h.height(g)}else{if(e>f){h.height(f)}}h.parent().css("height","auto")}})(jQuery);
