(function(a){a.fn.jCarouselLite=function(b){b=a.extend({btnPrev:null,btnNext:null,btnGo:null,mouseWheel:false,auto:null,hoverPause:false,speed:200,easing:null,vertical:false,circular:true,visible:3,start:0,scroll:1,beforeStart:null,afterEnd:null},b||{});return this.each(function(){var q=false,p=b.vertical?"top":"left",t=b.vertical?"height":"width",i=a(this),g=a("ul",i),r=a("li",g),l=r.size(),j=b.visible;if(b.circular){g.prepend(r.slice(l-j+1).clone()).append(r.slice(0,b.scroll).clone());b.start+=j-1}var f=a("li",g),m=f.size(),e=b.start;i.css("visibility","visible");f.css({overflow:"hidden","float":b.vertical?"none":"left"});g.css({margin:"0",padding:"0",position:"relative","list-style-type":"none","z-index":"1"});i.css({overflow:"hidden",position:"relative","z-index":"2",left:"0px"});var h=b.vertical?c(f):d(f),w=h*m,v=h*j;f.css({width:f.width(),height:f.height()});g.css(t,w+"px").css(p,-(e*h));i.css(t,v+"px");if(b.btnPrev){a(b.btnPrev).click(function(){return k(e-b.scroll)});b.hoverPause&&a(b.btnPrev).hover(function(){o()},function(){n()})}if(b.btnNext){a(b.btnNext).click(function(){return k(e+b.scroll)});b.hoverPause&&a(b.btnNext).hover(function(){o()},function(){n()})}b.btnGo&&a.each(b.btnGo,function(c,d){a(d).click(function(){return k(b.circular?b.visible+c:c)})});b.mouseWheel&&i.mousewheel&&i.mousewheel(function(c,a){return a>0?k(e-b.scroll):k(e+b.scroll)});var s;function n(){o();s=setInterval(function(){k(e+b.scroll)},b.auto+b.speed)}function o(){clearInterval(s)}if(b.auto){b.hoverPause&&i.hover(function(){o()},function(){n()});n()}function u(){return f.slice(e).slice(0,j)}function k(c){if(!q){b.beforeStart&&b.beforeStart.call(this,u());if(b.circular)if(c<0){g.css(p,-((e+l)*h)+"px");e=c+l}else if(c>m-j){g.css(p,-((e-l)*h)+"px");e=c-l}else e=c;else if(c<0||c>m-j)return;else e=c;q=true;g.animate(p=="left"?{left:-(e*h)}:{top:-(e*h)},b.speed,b.easing,function(){b.afterEnd&&b.afterEnd.call(this,u());q=false});if(!b.circular){a(b.btnPrev+","+b.btnNext).removeClass("disabled");a(e-b.scroll<0&&b.btnPrev||e+b.scroll>m-j&&b.btnNext||[]).addClass("disabled")}}return false}})};function b(c,b){return parseInt(a.css(c[0],b))||0}function d(a){return a[0].offsetWidth+b(a,"marginLeft")+b(a,"marginRight")}function c(a){return a[0].offsetHeight+b(a,"marginTop")+b(a,"marginBottom")}})(jQuery);
