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