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