(function(b){b.fn.easySlider=function(a){a=b.extend({prevId:"prevBtn",prevText:"Previous",nextId:"nextBtn",nextText:"Next",controlsShow:!0,controlsBefore:"",controlsAfter:"",controlsFade:!0,firstId:"firstBtn",firstText:"First",firstShow:!1,lastId:"lastBtn",lastText:"Last",lastShow:!1,vertical:!0,speed:400,auto:!1,pause:4E3,continuous:!1},a);this.each(function(){function f(d,k){var g=c;switch(d){case "next":c=g>=h?a.continuous?0:h:c+1;break;case "prev":c=c<=0?a.continuous?h:0:c-1;break;case "first":c=
0;break;case "last":c=h}var g=Math.abs(g-c),l=g*a.speed;a.vertical?(p=c*m*-1,b("ul",e).animate({marginTop:p},l)):(p=c*i*-1,b("ul",e).animate({marginLeft:p},l));!a.continuous&&a.controlsFade&&(c==h?(b("a","#"+a.nextId).hide(),b("a","#"+a.lastId).hide()):(b("a","#"+a.nextId).show(),b("a","#"+a.lastId).show()),c==0?(b("a","#"+a.prevId).hide(),b("a","#"+a.firstId).hide()):(b("a","#"+a.prevId).show(),b("a","#"+a.firstId).show()));k&&clearTimeout(j);a.auto&&d=="next"&&!k&&(j=setTimeout(function(){f("next",
!1)},g*a.speed+a.pause))}var e=b(this),d=b("li",e).length,i=b("li",e).width(),m=b("li",e).height();e.width(i);e.height(m);e.css("overflow","hidden");var h=d-1,c=0;b("ul",e).css("width",d*i);a.vertical||b("li",e).css("float","left");if(a.controlsShow)d=a.controlsBefore,a.firstShow&&(d+='<span id="'+a.firstId+'"><a href="javascript:void(0);">'+a.firstText+"</a></span>"),d+=' <span id="'+a.prevId+'"><a href="javascript:void(0);">'+a.prevText+"</a></span>",d+=' <span id="'+a.nextId+'"><a href="javascript:void(0);">'+
a.nextText+"</a></span>",a.lastShow&&(d+=' <span id="'+a.lastId+'"><a href="javascript:void(0);">'+a.lastText+"</a></span>"),d+=a.controlsAfter,b(e).after(d);b("a","#"+a.nextId).click(function(){f("next",!0)});b("a","#"+a.prevId).click(function(){f("prev",!0)});b("a","#"+a.firstId).click(function(){f("first",!0)});b("a","#"+a.lastId).click(function(){f("last",!0)});var j;a.auto&&(j=setTimeout(function(){f("next",!1)},a.pause));!a.continuous&&a.controlsFade&&(b("a","#"+a.prevId).hide(),b("a","#"+a.firstId).hide())})}})(jQuery);
