(function($){$.fn.YMslider=function(p){var A=$.extend({},$.fn.YMslider.defaults,p);return this.each(function(){var v='overflow-x',w='hidden',B=$(this).css(v,w);if(B.css(v)==w){var C='panel',D=B.children('ul,ol').addClass(C+'s'),E=D.children('li').addClass(C),F=E.length;if(F>1){var y='',x=' class="',G=B.attr('id'),H=B.width(),I=0,J=null,K=F-1,L='',M=Math.ceil(A.init-1),N=A.title.replace(/\$ID/g,G).replace(/\$TOT/g,F),O=A.anim*1000,P=(A.pause*1000)+O,Q='first',R='last',S='active',T='title',Z=false,p=A.start,q=A.stop,r=A.auto,s=A.controls,u='width';function g(h,i){return !i?h!=K?h+1:0:h!=0?h-1:K;};function j(k,l){Z=true;E.eq(k).addClass(S).siblings('.'+S).removeClass(S);if($.isFunction(p))p.call(B);D.animate({marginLeft:-k*H},!l?O:0,function(){Y.eq(k).addClass(S).siblings('.'+S).removeClass(S);if($.isFunction(q))q.call(B);Z=false;});return false;};function m(n){j(n);n=g(n);J=setTimeout(function(){m(n);},P);return false;};D.css(u,F*H+'px');E.css(u,H+'px').eq(0).addClass(Q).nextAll(':'+R).addClass(R);for(I;I'+y+'>'+X+z+'';L+=U'+A.spacer+z:'';}L=$(L);var Y=L.children('a').click(function(e){e.preventDefault();var a=Y.index(this),b=Y.index(Y.siblings('.'+S));if(!Z&&a!=b){if(r){clearTimeout(J);m(a);}else j(a);}});Y.eq(0).addClass(Q+' '+S).nextAll(':'+R).addClass(R);if(s!=false)s!='before'?B.addClass('regular').append(L):B.addClass('inverted').prepend(L);if(A.keyboard){$(document).keydown(function(e){var c=e.keyCode;if(c==39||c==37){var d=Y.index(Y.siblings('.'+S));Y.eq(c==39?g(d):g(d,true)).click();}});}if(M<0||M>K)M=0;j(M,true);if(r){J=setTimeout(function(){m(g(M));},P);if(A.hover){var t='mouse',o=t+'leave';E.bind(t+'enter '+o,function(e){clearTimeout(J);if(e.type==o){var f=g(E.index(this));J=setTimeout(function(){m(f);},P);}});}}}}});};$.fn.YMslider.defaults={init:1,auto:true,anim:1,pause:10,hover:true,keyboard:true,controls:'after',spacer:' ',title:'Move to the $ID panel $NB/$TOT : $TIT',start:null,stop:null};})(jQuery);