var Loop=new Class({loopCount:0,isLooping:false,loopMethod:function(){},setLoop:function(B,A){wasLooping=this.isLooping;if(wasLooping){this.stopLoop();}this.loopMethod=B;this.loopDelay=A||3000;if(wasLooping){this.startLoop();}return this;},stopLoop:function(){this.isLooping=false;clearInterval(this.periodical);return this;},startLoop:function(B,A){if(!this.isLooping){this.isLooping=true;if(A){this.looper();}this.periodical=this.looper.periodical(B||this.loopDelay,this);}return this;},resetLoop:function(){this.loopCount=0;return this;},looper:function(){this.loopCount++;this.loopMethod(this.loopCount);return this;}});(function(){var A=this.SlideShow=new Class({Implements:[Options,Events,Loop],options:{delay:7000,transition:"crossFade",duration:500,autoplay:false,dataAttribute:"data-slideshow",selector:"> *",initialSlideIndex:0},transitioning:false,reversed:false,initialize:function(C,B,D){this.element=document.id(C);this.setOptions(B);if(!D){this.setup();}},setup:function(B){if(B){this.setOptions(B);}this.slides=this.element.getElements(this.options.selector);this.setupElement().setupSlides();this.current=this.current||this.slides[this.options.initialSlideIndex];this.index=this.current.retrieve("slideshow-index");this.setLoop(this.show.pass(this.reversed?"previous":"next",this),this.options.delay);if(this.options.autoplay){this.play();}return this;},show:function(C,D){if(C=="next"||C=="previous"){C=this[C+"Slide"]();}if(typeof C=="number"){C=this.slides[C];}if(C==this.current||this.transitioning){return this;}this.transitioning=true;this.current.store("slideshow:oldStyles",this.current.get("style"));var H=(D&&D.transition)?D.transition:C.retrieve("slideshow-transition"),G=(D&&D.duration)?D.duration:C.retrieve("slideshow-duration"),F=this.current.setStyle("z-index",1),E=this.reset(C).setStyle("z-index",0),B=this.index=E.retrieve("slideshow-index");slideData={previous:{element:F,index:F.retrieve("slideshow-index")},next:{element:E,index:B}};this.fireEvent("show",slideData);A.transitions[H]({previous:F,next:E,duration:G,instance:this});(function(){F.setStyle("display","none");this.fireEvent("showComplete",slideData);this.transitioning=false;}).bind(this).delay(G);this.current=E;return this;},play:function(){this.startLoop();this.fireEvent("play");return this;},pause:function(){this.stopLoop();this.fireEvent("pause");return this;},reverse:function(){this.setLoop(this.show.pass(this.reversed?"next":"previous",this),this.options.delay);this.reversed=!this.reversed;this.fireEvent("reverse");return this;},setupElement:function(){this.storeData(this.element);this.options.duration=this.element.retrieve("slideshow-duration");this.options.transition=this.element.retrieve("slideshow-transition");this.options.delay=this.element.retrieve("slideshow-delay");if(this.element.getStyle("position")=="static"){this.element.setStyle("position","relative");}return this;},setupSlides:function(){this.slides.each(function(B,C){B.store("slideshow-index",C).store("slideshow:oldStyles",B.get("style"));this.storeData(B);B.setStyle("display",(this.current||C==this.options.initialSlideIndex)?"":"none");},this);return this;},storeData:function(B){var C=this.options;B.store("slideshow-transition",C.transition);B.store("slideshow-duration",C.duration);if(B==this.element){B.store("slideshow-delay",C.delay);}var D=B.get(this.options.dataAttribute);if(!D){return this;}Slick.parse(D).expressions[0].each(function(E){B.store("slideshow-"+E.tag,E.pseudos[0].key);});return this;},reset:function(B){return B.set("style",B.retrieve("slideshow:oldStyles"));},nextSlide:function(){return this.slides[this.index+1]||this.slides[0];},previousSlide:function(){return this.slides[this.index-1]||this.slides.getLast();},toElement:function(){return this.element;}});A.transitions={};A.defineTransition=function(B,C){A.transitions[B]=C;};A.defineTransitions=function(B){Object.each(B,function(D,C){A.defineTransition(C,D);});};})();Element.Properties.slideshow={set:function(A){this.get("slideshow").setup(A);return this;},get:function(){var A=this.retrieve("slideshow");if(!A){A=new SlideShow(this,{},true);this.store("slideshow",A);}return A;}};Element.implement({playSlideShow:function(A){this.get("slideshow").setup(A).play();return this;},pauseSlideShow:function(){this.get("slideshow").pause();return this;}});SlideShow.defineTransitions({none:function(A){A.previous.setStyle("display","none");return this;},fade:function(A){A.previous.set("tween",{duration:A.duration}).fade("out");return this;},crossFade:function(A){A.previous.set("tween",{duration:A.duration}).fade("out");A.next.set("tween",{duration:A.duration}).fade("in");return this;},fadeThroughBackground:function(B){var A=B.duration/2;B.next.set("tween",{duration:A}).fade("hide");B.previous.set("tween",{duration:A,onComplete:function(){B.next.fade("in");}}).fade("out");return this;}});(function(){function A(C){return{property:(C=="left"||C=="right")?"left":"top",inverted:(C=="left"||C=="up")?1:-1};}function B(C,D,E){var F={duration:E.duration,unit:"%"};if(C=="blind"){E.next.setStyle("z-index",2);}if(C!="slide"){E.next.set("tween",F).setStyle(D.property,100*D.inverted+"%");E.next.tween(D.property,0);}if(C!="blind"){E.previous.set("tween",F).tween(D.property,-(100*D.inverted));}}["left","right","up","down"].each(function(E){var F=E.capitalize(),C="blind"+F,D="slide"+F;[["push"+F,(function(){var G=A(E);return function(H){B("push",G,H);};}())],[C,(function(){var G=A(E);return function(H){B("blind",G,H);};}())],[D,(function(){var G=A(E);return function(H){B("slide",G,H);};}())],[C+"Fade",function(G){this.fade(G)[C](G);return this;}]].each(function(G){SlideShow.defineTransition(G[0],G[1]);});});})();
