/* 
 * showmore plugin for jQuery
 * v0.07
 * author: Carl Hughes
 */
 
 /* Copyright 2011, Ben Lin (http://dreamerslab.com/)
* Licensed under the MIT License (LICENSE.txt).
*
* Version: 1.0.3
*
* Requires: jQuery 1.2.3+
*/
;(function(a){a.fn.extend({actual:function(b,k){var c,d,h,g,f,j,e,i;if(!this[b]){throw'$.actual => The jQuery method "'+b+'" you called does not exist';}h=a.extend({absolute:false,clone:false},k);d=this;if(h.clone===true){e=function(){d=d.filter(":first").clone().css({position:"absolute",top:-1000}).appendTo("body");};i=function(){d.remove();};}else{e=function(){c=d.parents().andSelf().filter(":hidden");g=h.absolute===true?{position:"absolute",visibility:"hidden",display:"block"}:{visibility:"hidden",display:"block"};f=[];c.each(function(){var m={},l;for(l in g){m[l]=this.style[l];this.style[l]=g[l];}f.push(m);});};i=function(){c.each(function(m){var n=f[m],l;for(l in g){this.style[l]=n[l];}});};}e();j=d[b]();i();return j;}});})(jQuery);


(function($){$.fn.showmore=function(options){var settings={'maxHeight':250,'btnHeight':30,'duration':300,'moreHtml':'','lessHtml':'','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);
