(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,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),t=i.size(),s=e.visible;if(e.circular){p.prepend(i.slice(t-s-1+1).clone()).append(i.slice(0,s).clone());e.start+=s}var r=d("li",p),o=r.size(),u=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,-(u*k));f.css(g,m+"px");if(e.btnPrev){d(e.btnPrev).click(function(){return j(u-e.scroll)})}if(e.btnNext){d(e.btnNext).click(function(){return j(u+e.scroll)})}if(e.btnGo){d.each(e.btnGo,function(v,w){d(w).click(function(){return j(e.circular?e.visible+v:v)})})}if(e.mouseWheel&&f.mousewheel){f.mousewheel(function(v,w){return w>0?j(u-e.scroll):j(u+e.scroll)})}if(e.auto){setInterval(function(){j(u+e.scroll)},e.auto+e.speed)}function h(){return r.slice(u).slice(0,s)}function j(v){if(!n){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");u=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");u=v==o-s+1?s+1:s+e.scroll}else{u=v}}}else{if(v<0||v>o-s){return}else{u=v}}n=true;p.animate(l=="left"?{left:-(u*k)}:{top:-(u*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((u-e.scroll<0&&e.btnPrev)||(u+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);