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