/* 
 * showmore plugin for jQuery
 * v0.07
 * author: Carl Hughes
*/
(function($){$.fn.showmore=function(options){var settings={'maxHeight':200,'btnHeight':30,'duration':300,'moreHtml':'<span class="showtext">Show More</span><span class="icon"></span>','lessHtml':'<span class="showtext">Show Less</span><span class="icon"></span>','showmoreBefore':function(){},'showmoreAfter':function(){},'showLessBefore':function(){},'showLessAfter':function(){}};return this.each(function(){if(options){$.extend(settings,options);}
var $this=$(this);var staticHeight=$this.height();$this.css({'height':'auto','overflow':'hidden'});var origHeight=$this.height();if(origHeight>settings.maxHeight){$smWrapper=$('<div class="sm_wrapper"><div>');$smWrapper.css({'height':(settings.maxHeight-settings.btnHeight)+'px','overflow':'hidden'});$this.wrapInner($smWrapper);$showmoreLink=$('<a href="#" class="showmore more">'+settings.moreHtml+'</a>');$showmoreLink.css({'position':'absolute','bottom':'0'});$this.append($showmoreLink).css({'position':'relative','padding-bottom':settings.btnHeight+'px'});$this.children('.showmore').toggle(function(){settings.showmoreBefore.call(this);$this=$(this);$this.html(settings.lessHtml).addClass('less').removeClass('more');$this.siblings().stop(true,true).animate({height:origHeight},settings.duration,function(){settings.showmoreAfter.call(this);});},function(){settings.showLessBefore.call(this);$this=$(this);$this.html(settings.moreHtml).removeClass('less').addClass('more');$this.siblings().stop(true,true).animate({height:(settings.maxHeight-settings.btnHeight)},settings.duration,function(){settings.showLessAfter.call(this);});});}else{$this.css({'height':staticHeight+'px'});}});};})(jQuery);

