(function(c){var a=0;c.fn.rotator=function(d){c(this).each(function(e){if(e>0){a++}c(this).data("rotator",new b(this,d,a))});a++};var b=function(e,u,d){var h=c.extend({arrows:{left:".leftarrow"+d,right:".rightarrow"+d},tranSpeed:800,delay:4000,auto:true,loop:true,backwards:false,onChange:function(n){},endChange:function(n){}},u||{});var u=h;function r(){D(0)}function D(n){if(x){return}if(n===1){u.backwards=false}else{if(n===-1){u.backwards=true}}if(j){return}if(!u.backwards){f++;if(f===v){f=0}}else{f--;if(f<0){f=v-1}}j=true;if(u.backwards){m=(f===l)?-l:f-l;m=m+l}else{m=(f-l===l)?0:f-l}if(m>=l){m-=l}u.onChange(m);z();q.animate({marginLeft:-f*t},u.tranSpeed,C)}function y(n){if(n===undefined||n>l||n<0){this.onError({target:"goToIndex",error:"The passed index is out of the range of available children to rotate to"});return false}if(j){return false}c(p).removeClass("active");c(p).eq(n).addClass("active");f=l+n;if(u.backwards){f-=l}j=true;q.animate({marginLeft:-f*t},u.tranSpeed,C);m=n;u.onChange(m);if(u.auto){clearInterval(B);B=setInterval(r,u.delay)}}function g(w){if(x){return}var n=l;p="<ul class='slider-numbers slider-numbers-"+w+"'>";var o=0;for(;o<n;o++){p+="<li><a href=''>"+(o+1)+"</a></li>"}p+="</ul>";c(e).after(p);p=".slider-numbers-"+w+" a";c(p).each(function(F){if(F===0){c(this).addClass("active")}c(this).click(function(){y(F);return false})})}function C(){j=false;if((f===0||f===v-l)){f=l;c(e).css({"margin-left":-f*t})}u.endChange(m)}function z(){c(p).removeClass("active");c(p).eq(m).addClass("active")}function k(){if(u.auto){clearInterval(B)}}function i(){B=setInterval(r,u.delay);u.auto=true}this.goNext=D;this.goToIndex=y;this.onError=function(n){};this.pause=k;this.start=i;var x=false;if(!c(e)){this.onError({target:"init",error:"An element must be defined to rotate. ex: $('.slider').rotator();"});return false}if(c(e).children().length<=1){x=true;this.onError({target:"init",error:e+" has one or fewer children to rotate through"})}var s=false;if(u.backwards){s=true}var q=c(e);var p="";var l=0;var E="";var m=0;if(u.loop){var A=0;l=c(e).children().length;E=c(e).html();c(e).children(":first").before(E);c(e).children(":last").after(E)}var t=c(e).children().width();var v=c(e).children().length;var f=l;var j=false;g(d);c(e).css({"margin-left":-f*t});c(e).css({width:t*v});c(u.arrows.right).bind("click",function(){if(u.auto){clearInterval(B);B=setInterval(r,u.delay)}u.backwards=false;D();return false});c(u.arrows.left).bind("click",function(){if(u.auto){clearInterval(B);B=setInterval(r,u.delay)}u.backwards=true;D();return false});if(u.auto&&!x){var B=setInterval(r,u.delay)}}}(jQuery));
