((function(){var a;a=function(){function b(b,c,d){this.viewport=b,this.viewportControls=c;if(!c.length)return;this.options=$.extend({},a,d),this.currentSlide=null,this.slideCount=null,this.currentSlideIndex=0,this.nextDisabled=!1,this.previousDisabled=!1,this.controlsLocked=!1,this.slideCount=$(".last",this.viewport).index()+1,this.currentSlide=$(".image-"+this.currentSlideIndex,this.viewport);if(this.slideCount===1){this.hideControls();return}this.options.numbers&&this.buildNumbers(),this.bindEvents(),this.checkControls()}var a;return a={orientation:"horizontal",prev_next:!0,numbers:!1,hotkeys:!1},b.prototype.bindEvents=function(){var a=this;if(this.options.hotkeys)return $(document).unbind("keydown","pagedown").bind("keydown","pagedown",function(b){b.preventDefault();if(!a.nextDisabled)return a.next()}).unbind("keydown","pageup").bind("keydown","pageup",function(b){b.preventDefault();if(!a.previousDisabled)return a.previous()})},b.prototype.hideControls=function(){return this.viewportControls.hide()},b.prototype.checkControls=function(){this.currentSlide.hasClass("last")?this.disableNext():this.enableNext(),this.currentSlide.hasClass("first")?this.disablePrevious():this.enablePrevious();if(this.options.numbers)return $(".number.current",this.viewportControls).removeClass("current"),$(".number-"+this.currentSlideIndex,this.viewportControls).addClass("current")},b.prototype.buildNumbers=function(){var a,b,c;c=[];for(a=0,b=this.slideCount;0<=b?a<b:a>b;0<=b?a++:a--)c.push(this.addNumber(a));return c},b.prototype.addNumber=function(a){var b,c=this;return b=$("<a class='number number-"+a+"'>"+(a+1)+"</a>").data({index:a}),b.click(function(b){return c.goTo(a)}),$(".next",this.viewportControls).before(b)},b.prototype.next=function(){if(this.controlsLocked||this.currentSlideIndex+1>=this.slideCount)return;return this.goTo(this.currentSlideIndex+1)},b.prototype.previous=function(){if(this.controlsLocked||this.currentSlideIndex-1<0)return;return this.goTo(this.currentSlideIndex-1)},b.prototype.goTo=function(a){if(this.controlsLocked)return;return this.currentSlideIndex=a,this.scroll()},b.prototype.scroll=function(){var a=this;return this.lockControls(),this.currentSlide=$(".image-"+this.currentSlideIndex,this.viewport),this.checkControls(),$(".tray",this.viewport).animate({marginLeft:this.options.orientation==="horizontal"?-(this.viewport.width()*this.currentSlideIndex):void 0,marginTop:this.options.orientation==="vertical"?-(this.viewport.width()*this.currentSlideIndex):void 0},function(){return a.unlockControls()})},b.prototype.unlockControls=function(){return this.controlsLocked=!1},b.prototype.lockControls=function(){return this.controlsLocked=!0},b.prototype.enableNext=function(){var a=this;return this.nextDisabled=!1,$(".next",this.viewportControls).not("[href]").removeClass("disabled").click(function(){return a.next(),!1})},b.prototype.disableNext=function(){return this.nextDisabled=!0,$(".next",this.viewportControls).not("[href]").addClass("disabled").unbind("click")},b.prototype.enablePrevious=function(){var a=this;return this.previousDisabled=!1,$(".prev",this.viewportControls).not("[href]").removeClass("disabled").click(function(){return a.previous(),!1})},b.prototype.disablePrevious=function(){return this.previousDisabled=!0,$(".prev",this.viewportControls).not("[href]").addClass("disabled").unbind("click")},b}(),this.Slider=a})).call(this);
