(function(h){h.fn.sudoSlider=function(X){var c=!1,e=!c,g=this,X=h.extend({controlsShow:e,controlsFadeSpeed:400,controlsFade:e,insertAfter:e,firstShow:c,lastShow:c,vertical:c,speed:800,ease:"swing",auto:c,pause:2E3,continuous:c,prevNext:e,numeric:c,numericAttr:'class="controls"',numericText:[],clickableAni:c,history:c,speedhistory:400,autoheight:e,customLink:c,fade:c,crossFade:e,fadespeed:1E3,updateBefore:c,ajax:c,preloadAjax:100,startSlide:c,ajaxLoadFunction:c,beforeAniFunc:c,afterAniFunc:c,uncurrentFunc:c,
currentFunc:c,prevHtml:'<a href="#" class="prevBtn"> previous </a>',nextHtml:'<a href="#" class="nextBtn"> next </a>',loadingText:"Loading Content...",firstHtml:'<a href="#" class="firstBtn"> first </a>',controlsAttr:'id="controls"',lastHtml:'<a href="#" class="lastBtn"> last </a>',autowidth:e,slideCount:1,resumePause:c,moveCount:1},X);return this.each(function(){function fa(d,p){l=0;for(b in J)a[l]=J[b],l++;w=c;D=e;n=d.children("ul");k=n.children("li");j=k.length;if(a[25]&&(n.length==0&&d.append(n=
h("<ul></ul>")),a[25].length>j)){for(b=1;b<=a[25].length-j;b++)n.append("<li><p>"+a[35]+"</p></li>");k=n.children("li");j=k.length}t=f=0;o=j-1;q=e;K=r=Y=c;Q=[];w=c;Z=screen.fontSmoothingEnabled;d.css("overflow","hidden");d.css("position")=="static"&&d.css("position","relative");k.css({"float":"left",display:"block"});a[40]=m(a[40]);a[42]--;u=a[40];a[21]||(a[40]+=a[42]);a[40]>j&&(a[40]=j);a[27]=m(a[27])||1;E=a[11]&&(!a[21]||a[40]>1);for(b=0;b<j;b++)a[15][b]=a[15][b]||b+1,a[25][b]=a[25][b]||c;if(E){for(i=
a[40];i>=1;i--)n.prepend(k.eq(-a[40]+i-1).clone()).append(k.eq(a[40]-i).clone());s=n.children("li");if(a[25])for(b=j-a[40];b<j;b++)a[25][b]&&b!=a[27]-1&&z(b,c,0,c)}a[2]=a[2]&&!a[11];n[a[6]?"height":"width"](1E7);s=n.children("li");A=c;if(a[0]){A=h("<span "+a[37]+"></span>");h(d)[a[3]?"after":"before"](A);if(a[13]){ga=A.prepend("<ol "+a[14]+"></ol>").children();l=a[13]=="pages"?u:1;for(b=0;b<j-(a[11]||a[13]=="pages"?1:u)+1;b+=l)Q[b]=h("<li rel='"+(b+1)+"'><a href='#'><span>"+a[15][b]+"</span></a></li>").appendTo(ga).click(function(){F(h(this).attr("rel")-
1,e);return c})}a[4]&&(ha=R(a[36],"first"));a[5]&&(ia=R(a[38],"last"));a[12]&&(ja=R(a[34],"next"),ka=R(a[33],"prev"))}if(a[26]===e)for(i=0;i<=o;i++)a[25][i]&&a[27]-1!=i&&z(i,c,0,c);l=[1,7,10,18,23];for(b in l)a[m(l[b])]=ta(a[m(l[b])]);a[20]&&h(a[20]).live("click",function(){if(b=h(this).attr("rel"))b=="stop"?(a[9]=c,clearTimeout(x),L=c):b=="start"?(x=M(a[10]),a[9]=e):b=="block"?q=c:b=="unblock"?q=e:q&&F(b==m(b)?b-1:b,e);return c});$(s.slice(0,a[40]),e,function(){a[9]&&(x=M(a[10]));p?B(p,c,c,c):a[17]?
(h.address?h.address.change(function(){S()}):h.hashchange?h(window).hashchange(S):h(window).bind("hashchange",S),S()):B(a[27]-1,c,c,c)})}function la(){if(a[25]&&m(a[26]))for(b in a[25])if(a[25][b]){clearTimeout(T);T=setTimeout(function(){z(b,c,0,c)},m(a[26]));break}}function S(){a:{var d=location.hash.substr(1);for(i in a[15])if(a[15][i]==d)break a;i=d?f:0}D?B(i,c,c,c):i!=f&&F(i,c)}function M(a){L=e;return setTimeout(function(){F("next",c)},a)}function ta(a){return m(a)||a==0?m(a):a=="fast"?200:a==
"normal"||a=="medium"?400:a=="slow"?600:400}function R(a,b){return h(a).prependTo(A).click(function(){F(b,e);return c})}function F(d,p){N=c;if(!w){if(a[9]){var v=a[7];r&&a[22]?v=m(v*0.6):r&&(v=0);p?(clearTimeout(x),L=c,a[41]&&(x=M(v+a[41]))):x=M(a[10]+v)}a[21]?ma(d,p):(a[11]&&(d=G(d,f),b=y(d),v=Math.abs(f-d),b<a[40]-u+1&&Math.abs(f-b-j)<v&&(d=b+j,v=Math.abs(f-b-j)),b>o-a[40]&&Math.abs(f-b+j)<v&&(d=b-j)),B(d,p,e,c))}}function na(d,c,b){if(b)var b=ja,e=ia,f="next",g="last",j=a[5];else b=ka,e=ha,f="prev",
g="first",j=a[4];if(a[0]){if(a[12])b[d?"fadeIn":"fadeOut"](c);if(j)e[d?"fadeIn":"fadeOut"](c)}if(a[20])h(a[20]).filter(function(){return h(this).attr("rel")==f||h(this).attr("rel")==g})[d?"fadeIn":"fadeOut"](c)}function oa(a,b){na(a,b,c);na(a<j-u,b,e)}function aa(d){d=m(d>o?0:d<0?j+d:d)+1;for(b in Q)pa(Q[b],d);a[20]&&pa(h(a[20]),d)}function pa(d,p){d&&(d.filter(".current").removeClass("current").each(function(){h.isFunction(a[31])&&a[31].call(this,h(this).attr("rel"))}),d.filter(function(){l=h(this).attr("rel");
if(a[13]=="pages")for(b=0;b<u;b++){if(l==p-b)return e}else return l==p;return c}).addClass("current").each(function(){h.isFunction(a[32])&&a[32].call(this,p)}))}function $(a,b,c){var a=a.add(a.find("img")).filter("img"),e=a.length;e||c();a.load(function(){this.naturalHeight&&!this.clientHeight&&h(this).height(this.naturalHeight).width(this.naturalWidth);b?(e--,e==0&&c()):c()}).each(function(){if((this.complete||this.complete===void 0)&&b){var a=this.src;this.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";
this.src=a}})}function V(d,b){a[19]&&qa(d,b,e);a[39]&&qa(d,b,c)}function qa(a,b,e){O.ready(function(){ra(a,b,e);$(k.eq(a),c,function(){ra(a,b,e)})})}function ra(d,b,e){d=y(d);l=k.eq(d)[e?"height":"width"]();O.animate(e?{height:l}:{width:l},{queue:c,duration:b,easing:a[8]})}function ba(){n.css(a[6]?"margin-top":"margin-left",ca(f))}function ca(d){return-s.eq(d+(E?a[40]:0)).position()[a[6]?"top":"left"]}function ua(){f=y(f);a[24]||aa(f);ba();q=e;if(a[17]&&Y)window.location.hash=a[15][f];!r&&N&&C(f,
e)}function C(d,b){(b?da:ea)(k.eq(d),y(d)+1);if(E&&(d<a[40]&&(b?da:ea)(s.eq(d<0?d+a[40]:d-a[40]),d+1),d>o-a[40]||d==-a[40]))(b?da:ea)(s.eq(d==-a[40]?-1:a[40]+d-o-1),d+1)}function da(d,b){h.isFunction(a[30])&&a[30].call(d,b)}function ea(d,b){h.isFunction(a[29])&&a[29].call(d,b)}function G(d,b){return d=="next"?b>=o?a[11]?f+1+a[42]:f==0?1+a[42]:0:f+1+a[42]:d=="prev"?f<=0?a[11]?f-1-a[42]:f==o?o-1-a[42]:o:f-1-a[42]:d=="first"?0:d=="last"?o:m(d)}function z(d,b,f,g){T&&clearTimeout(T);var U=a[25][d],j=
k.eq(d),l=f===e,f=f===e?0:f;r&&!a[22]&&m(a[23]*0.4);var i=c;h.ajax({url:U,success:function(a,h,U){U.getResponseHeader("Content-Type").substr(0,5)!="image"&&(i=e,j.html(a),sa(d,f,g,b,l,c))},complete:function(){if(!i)image=new Image,j.html("").append(image),image.src=U,sa(d,f,g,b,l,e)}});a[25][d]=c;J.ajax[d]=c}function sa(d,b,f,g,j,l){var i=k.eq(d);E&&(d<a[40]&&s.eq(d<0?d+a[40]:d-a[40]).replaceWith(h(i).clone()),d>o-a[40]&&s.eq(a[40]+d-o-1).replaceWith(h(i).clone()),s=n.children("li"),j===e&&ba());
g&&V(d,b);$(i,e,function(){j===e&&ba();h.isFunction(f)&&f();la()});h.isFunction(a[28])&&a[28].call(i,m(d)+1,l);f==2&&(C(d,c),N||(C(d,e),N=e))}function ma(d,p,g){if(G(d,t)!=f&&!w&&q){K=c;a[24]&&aa(G(d,t));var j=!p&&!a[9]&&a[17]?a[23]*(a[18]/a[7]):a[23],i=y(G(d,t));a[2]&&oa(i,a[1]);if(g)j=W,H&&H--;else if(a[25]){H=0;W=j;for(b=i;b<i+u;b++)a[25][b]&&(z(y(b),c,j,function(){ma(d,p,e)}),H++)}else H=c;if(!H)if(q=!p,V(i,a[23]),C(i,c),a[22]){var l=e,g=0;for(b=i;b<i+u;b++)k.eq(y(b)).clone().prependTo(O).css({"z-index":"100000",
position:"absolute","list-style":"none",top:a[6]?g:0,left:a[6]?0:g}).hide().fadeIn(a[23],function(){Z&&this.style.removeAttribute("filter");r=q=e;if(l){B(i,c,c,c);if(a[17]&&p)window.location.hash=a[15][f];C(i,e);l=c}h(this).remove();r=c}),g+=k.eq(b)[a[6]?"outerHeight":"outerWidth"](e)}else{var n=m(j*0.6),g=j-n,o=k.children();o.stop().fadeTo(g,1.0E-4,function(){r=q=e;B(i,c,c,c);q=!p;o.add(k).stop().fadeTo(n,1,function(){Z&&this.style.removeAttribute("filter");if(a[17]&&p)window.location.hash=a[15][f];
q=e;r=c;C(i,e)})})}}}function B(d,g,j,i){if(q&&!w&&(G(d,t)!=f||D)||i){i||(K=c);q=!g&&!a[9]?e:a[16];Y=g;t=f;f=G(d,t);a[24]&&aa(f);var h=Math.sqrt(Math.abs(t-f)),k=!j?0:!g&&!a[9]?m(h*a[18]):m(h*a[7]),h=y(f);if(i)k=W,P&&P--;else if(a[25]){a[25][h]&&(z(h,e,D||k,2),K=e);if(!r){var i=t>f?f:t,s=t>f?t:f;P=0;W=k;for(b=i;b<=s;b++)b<=o&&b>=0&&a[25][b]&&(z(b,c,k,function(){B(d,g,j,e)}),P++)}for(b=h+1;b<=h+u;b++)a[25][b]&&z(b,c,0,c)}P||(!r&&!K&&(C(h,c),N=e),r||V(f,k),l=ca(f),n.animate(a[6]?{marginTop:l}:{marginLeft:l},
{queue:c,duration:k,easing:a[8],complete:ua}),a[2]&&(k=a[1],!g&&!a[9]&&(k=a[18]/a[7]*a[1]),j||(k=0),r&&(k=m(a[23]*0.6)),oa(f,k)),D&&a[25]&&(a[25][h]||la()),D=c)}}function y(a){return a<0?a+j:a>o?a-j:a}function m(a){return parseInt(a,10)}var D,n,k,s,j,f,t,o,q,Y,r,K,Q,ga,w,Z,A,ha,ia,ja,ka,x,I,W,P,H,L,b,l,i,E,u,N=c,T,O=h(this),J=X,a=[];fa(O,c);g.getOption=function(a){return J[a]};g.setOption=function(a,b){b&&(g.destroy(),J[a]=b,g.init());return g};g.insertSlide=function(b,c,e){if(b){g.destroy();c>j&&
(c=j);b="<li>"+b+"</li>";!c||c==0?n.prepend(b):k.eq(c-1).after(b);(c<=I||!c||c==0)&&I++;if(a[15].length<c)a[15].length=c;a[15].splice(c,0,e||m(c)+1);g.init()}return g};g.removeSlide=function(b){b--;g.destroy();k.eq(b).remove();a[15].splice(b,1);b<I&&I--;g.init();return g};g.goToSlide=function(a){F(a==m(a)?a-1:a,e);return g};g.block=function(){q=c;return g};g.unblock=function(){q=e;return g};g.startAuto=function(){a[9]=e;x=M(a[10]);return g};g.stopAuto=function(){a[9]=c;clearTimeout(x);L=c;return g};
g.destroy=function(){I=f;A&&A.remove();w=e;h(a[20]).die("click");if(E)for(b=1;b<=a[40];b++)s.eq(b-1).add(s.eq(-b)).remove();n.css(a[6]?"margin-top":"margin-left",ca(f));return g};g.init=function(){w&&fa(O,I);return g};g.adjust=function(a){a||(a=0);V(i,a);return g};g.getValue=function(a){return a=="currentSlide"?f+1:a=="totalSlides"?j:a=="clickable"?q:a=="destroyed"?w:a=="autoAnimation"?L:void 0}})}})(jQuery);
