// JavaScript Document
(function($) {
  $.fn.summary = function(options) {
return this.each(function() {
new $.Summary(this, options);
});
};

$.Summary = function(e, o) {
var element = $(e);
var options = o || {};
    var maxHeight = options.maxHeight || 100;
    var textHeight = e.offsetHeight;
	var htmlMore = options.htmlMore || '';
	var htmlLess = options.htmlLess || '';
    
    if (textHeight > maxHeight) {
      element.css({overflow: 'hidden'});
      element.height(maxHeight);

      var moreLink = $("<a href='#' class='summary summore'>"+htmlMore+"</a>").click(expand);
	  var lessLink = $("<a href='#' class='summary sumless'>"+htmlLess+"</a>").click(recolhe);
      element.after(moreLink);
	  element.after(lessLink);
	  lessLink.hide();
    }
    
	function recolhe(){
	element.animate({height: maxHeight}, 'fast');
	lessLink.hide();
	moreLink.show();
	return false;
	};
	
function expand() {
element.animate({height: textHeight}, 'fast');
moreLink.hide();
lessLink.show();
return false;
};
};
})(jQuery);


