(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 o=false,m=e.vertical?"top":"left",g=e.vertical?"height":"width";var f=d(this),q=d("ul",f),i=d("li",q),u=i.size(),t=e.visible;if(e.circular){q.prepend(i.slice(u-t-1+1).clone()).append(i.slice(0,t).clone());e.start+=t}var s=d("li",q),p=s.size(),w=e.start;f.css("visibility","visible");s.css({overflow:"hidden","float":e.vertical?"none":"left"});q.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 l=e.vertical?a(s):c(s);var r=l*p;var n=l*t;var k=0;s.each(function(){var v=d(this).outerHeight();k=v>k?v:k});k=undefined;s.css({width:s.width(),height:k});q.css(g,r+"px").css(m,-(w*l));f.css(g,n+"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(!o){if(e.beforeStart){e.beforeStart.call(this,h())}if(e.circular){if(v<=e.start-t-1){q.css(m,-((p-(t*2))*l)+"px");w=v==e.start-t-1?p-(t*2)-1:p-(t*2)-e.scroll}else{if(v>=p-t+1){q.css(m,-((t)*l)+"px");w=v==p-t+1?t+1:t+e.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)},e.speed,e.easing,function(){if(e.afterEnd){e.afterEnd.call(this,h())}o=false});if(!e.circular){d(e.btnPrev+","+e.btnNext).removeClass("disabled");d((w-e.scroll<0&&e.btnPrev)||(w+e.scroll>p-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);
