(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,afterStart: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(),t=e.visible;if(e.circular){p.prepend(i.slice(u-t-1+1).clone()).append(i.slice(0,t).clone());e.start+=t}var s=d("li",p),o=s.size(),w=e.start;var r=d("li:visible",p);f.css("visibility","visible");s.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*t;s.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 s.slice(w).slice(0,t)}function j(v){if(!n){if(e.beforeStart){e.beforeStart.call(this,h())}if(e.circular){if(v<=e.start-t-1){p.css(l,-((o-(t*2))*k)+"px");w=v==e.start-t-1?o-(t*2)-1:o-(t*2)-e.scroll}else{if(v>=o-t+1){p.css(l,-((t)*k)+"px");w=v==o-t+1?t+1:t+e.scroll}else{w=v}}}else{if(v<0||v>o-t){return}else{w=v}}if(e.afterStart){e.afterStart.call(this,h())}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-t&&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);