(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:!1,speed:800,auto:!1,pause:2E3,continuous:!1},a);this.each(function(){function f(c,k){var g=d;switch(c){case "next":d=g>=h?a.continuous?0:h:d+1;break;case "prev":d=0>=d?a.continuous?h:0:d-1;break;case "first":d=
0;break;case "last":d=h}var g=Math.abs(g-d),l=g*a.speed;a.vertical?(p=-1*d*m,b("ul",e).animate({marginTop:p},l)):(p=-1*d*i,b("ul",e).animate({marginLeft:p},l));!a.continuous&&a.controlsFade&&(d==h?(b("a","#"+a.nextId).hide(),b("a","#"+a.lastId).hide()):(b("a","#"+a.nextId).show(),b("a","#"+a.lastId).show()),0==d?(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&&"next"==c&&!k&&(j=setTimeout(function(){f("next",
!1)},g*a.speed+a.pause))}var e=b(this),c=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=c-1,d=0;b("ul",e).css("width",c*i);a.vertical||b("li",e).css("float","left");if(a.controlsShow)c=a.controlsBefore,a.firstShow&&(c+='<span id="'+a.firstId+'"><a href="javascript:void(0);">'+a.firstText+"</a></span>"),c+=' <span id="'+a.prevId+'"><a href="javascript:void(0);">'+a.prevText+"</a></span>",c+=' <span id="'+a.nextId+'"><a href="javascript:void(0);">'+
a.nextText+"</a></span>",a.lastShow&&(c+=' <span id="'+a.lastId+'"><a href="javascript:void(0);">'+a.lastText+"</a></span>"),c+=a.controlsAfter,b(e).after(c);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);
