(function($) {
	
	$.fn.cropByHeight = function( replacement ) {
		var self = this;
		self.each(function(){
			
			var html = $(this).html();
			
			var cur_height = $(this).height();
			var max_height = $(this).parent().height();
			
			if ( cur_height > max_height ){
				while (html.length > 0 && cur_height > max_height ) {
					html = html.substr(0, html.length - 1);
					$(this).html( html + replacement );
					cur_height = $(this).height();
				}
			}
		});
	};
	
})(jQuery);

