(function($) {
	
	// Function to automatically expand a textare based on content
	$.fn.autoexpand = function(options) {
			
		var	settings = $.extend({
			defaultHeight: 100,
			resizeOnDelete: true,
			maxHeight: 0
		}, options);
		
		var current_height = $(this).height();
		
		return $(this).keyup(function() {
			$(this).css({ overflow: 'hidden' });
			// Work out how many rows there are:
			var num_lines = $(this).val().split("\n");
			
			var new_height = num_lines.length * 17;
			if(new_height > settings.defaultHeight)
			{
				$(this).height(new_height);
			}
			
			
		});
	};
	
})( jQuery );
