/*******************************************
	jQuery Plugin Text Plus
	(c) 2009 Drew Robinson (drewrobinson.com)
	::For use with jQuery 1.3*
********************************************/
(function(jQuery) {
	jQuery.fn.textPlus = function(options){
		var opts = $.extend(jQuery.fn.textPlus.defaults, options);
		return this.each(function(i){
			var t = jQuery(this);
			t.css({'overflow':'hidden','overflow-x':'hidden','overflow-y':'hidden','scroll':'no-scroll'});
			var w = t.width() || opts.minWidth;
			var h = "";
	
			t.focus(function(e){
				$("body").append("<div class='temp' style='display:block;float:left;position:absolute;left:-9999px;'></div>");
				$(".temp").css('width',w+"px");
			});
			
			t.keyup(function(e){
				var val = t.val().replace(/\n/g,'<br/>');							
				$(".temp").html(val);
				h = $(".temp").height();
				if (h<opts.minHeight) h = opts.minHeight;
				t.css('height',(parseInt(h)+25)+"px");
			});
			
			t.blur(function(e){
				$(".temp").remove();
			});
			
		}); 
	};
	//SET DEFAULTS
	$.fn.textPlus.defaults = {minHeight: '20',minWidth:'390'}; 
})(jQuery);