// Generated by CoffeeScript 1.3.3 (function(){var e,t,n;e=jQuery,t=function(){function t(e,t){this.show=e,this.options=t,this.slides=this.show.find(this.options.slideSelector),this.slides.length>0&&this.initialize()}return t.prototype.version="0.0.1",t.prototype.initialize=function(){var t=this;return this.plugins=e.map(this.options.use_plugins,function(n){return new e.fn.cavendish.plugins[n](t)}),this.last=e(),this.length=this.slides.length,this.show.data("cavendish",this).addClass(this.options.class_names.show),e.each(this.plugins,function(){return this.setup()}),this.goto(0),this.slides.not(this.current).addClass(this.options.class_names.slide.before)},t.prototype.next=function(){var e;return e=this.index+1,e>=this.length&&this.options.loop&&(e=0),this.goto(e)},t.prototype.prev=function(){var e;return e=this.index-1,e<0&&this.options.loop&&(e=this.length-1),this.goto(e)},t.prototype.goto=function(t){var n,r,i,s=this;if(this.slides[t]==null)return;return this.index=t,this.current!=null&&(this.last=this.current),this.current=this.slides.eq(this.index),n=this.options.class_names.slide,this.slides.removeClass(function(){var e;e=[];for(r in n)i=n[r],e.push(i);return e}().join(" ")),this.last.addClass(n.after),this.current.addClass(n.on),this.slides.each(function(t,r){if(ts.index)return e(r).addClass(n.right)}),this.slides.not(this.last).not(this.current).addClass(n.before),e.each(this.plugins,function(){return this.transition()})},t}(),e.fn.cavendish=function(r){var i;if(typeof r!="string")return r=e.extend(!0,{},n,r),this.each(function(){return new t(e(this),r)});i=e(this).data("cavendish");if(i!=null)switch(r){case"next":i.next();break;case"prev":i.prev();break;case"cavendish":return i}return this},n=e.fn.cavendish.defaults={loop:!0,slideSelector:"> ol > li",use_plugins:[],class_names:{show:"cavendish-slideshow",slide:{left:"cavendish-left",right:"cavendish-right",on:"cavendish-onstage",before:"cavendish-before",after:"cavendish-after"}}},e.fn.cavendish.plugins={}}).call(this),function(){var e,t,n,r,i,s,o,u=function(e,t){return function(){return e.apply(t,arguments)}},a={}.hasOwnProperty,f=function(e,t){function r(){this.constructor=e}for(var n in t)a.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e};e=jQuery,o=function(){function t(t){this.cavendish=t,this.options=this.cavendish.options=e.extend(!0,{},this.defaults(),this.cavendish.options)}return t.prototype.setup=function(){},t.prototype.transition=function(){},t.prototype.extensions=function(){return[]},t.prototype.defaults=function(){return{class_names:{active:"active",disabled:"disabled"}}},t}(),s=function(t){function n(){return this.defaults=u(this.defaults,this),n.__super__.constructor.apply(this,arguments)}return f(n,t),n.prototype.setup=function(){var e=this;this.show=this.cavendish.show,this.options.player_pause&&this.show.hover(function(){return e.stop()},function(){return e.start()});if(this.options.player_start)return this.start()},n.prototype.start=function(){var e=this;return this.show.addClass(this.options.class_names.playing),this.timeout=setInterval(function(){return e.cavendish.next()},this.options.slideTimeout)},n.prototype.stop=function(){return this.show.removeClass(this.options.class_names.playing),clearInterval(this.timeout)},n.prototype.defaults=function(){return e.extend(!0,{},n.__super__.defaults.apply(this,arguments),{player_start:!0,player_pause:!0,slideTimeout:2e3,class_names:{playing:"cavendish-playing"}})},n}(o),n=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return f(t,e),t.prototype.setup=function(){return this.cavendish.show.trigger("cavendish-setup",[this.cavendish])},t.prototype.transition=function(){return this.cavendish.show.trigger("cavendish-transition",[this.cavendish])},t}(o),r=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return f(n,t),n.prototype.setup=function(){var t=this;return this.pager=e(this.cavendish.options.pagerSelector,this.cavendish.show),this.pager.find(this.cavendish.options.pagerItemSelector).each(function(n,r){return e(r).click(function(){return t.cavendish.goto(n),!1})})},n.prototype.transition=function(){return this.pager.find(this.cavendish.options.pagerItemSelector).removeClass(this.cavendish.options.class_names.active).eq(this.cavendish.index).addClass(this.cavendish.options.class_names.active)},n.prototype.defaults=function(){return e.extend(!0,{},n.__super__.defaults.apply(this,arguments),{pagerSelector:".cavendish-pager",pagerItemSelector:"li"})},n}(o),t=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return f(n,t),n.prototype.setup=function(){var t=this;return this.next=e(".cavendish-next").click(function(){return t.cavendish.next(),!1}),this.prev=e(".cavendish-prev").click(function(){return t.cavendish.prev(),!1})},n.prototype.transition=function(){var e;if(!this.cavendish.options.loop)return e=this.cavendish.index+1===this.cavendish.length,this.next.toggleClass(this.cavendish.options.class_names.disabled,e),this.prev.toggleClass(this.cavendish.options.class_names.disabled,this.cavendish.index===0)},n}(o),i=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return f(n,t),n.prototype.setup=function(){var t=this;return this.background=this.cavendish.show.find(this.cavendish.options.panSelector),this.background.find(this.cavendish.options.panChildSelector).each(function(t,n){return e(n).css("left",t*100+"%")})},n.prototype.transition=function(){return this.background.css("left",this.cavendish.index*-100*this.cavendish.options.panFactor+"%")},n.prototype.defaults=function(){return e.extend(!0,{},n.__super__.defaults.apply(this,arguments),{panFactor:1,panSelector:".cavendish-pan",panChildSelector:"> li"})},n}(o),e.fn.cavendish.plugins={player:s,events:n,pager:r,arrows:t,pan:i}}.call(this);