﻿(function(){if(typeof Spry=="undefined"||!Spry.Widget||!Spry.Widget.Base){alert("SpryContentSlideShow.js requires SpryWidget.js!");return}var a={plugIns:[],injectionType:"inside",extractionType:"element",repeatingElementSelector:null,useButtonControls:false,dropFrames:true,autoPlay:true,transitionDuration:2e3,displayInterval:6e3,widgetID:null,widgetClass:"SlideShow",playingClass:"SSPlaying",clipClass:"SSClip",viewClass:"SSView",slideClass:"SSSlide",slideVisibleClass:"SSSlideVisible",slideHiddenClass:"SSSlideHidden",slideTitleClass:"SSSlideTitle",slideDescriptionClass:"SSSlideDescription",countClass:"SSSlideCount",slideLinksClass:"SSSlideLinks",slideLinkClass:"SSSlideLink",controlsClass:"SSControls",firstBtnClass:"SSFirstButton",prevBtnClass:"SSPreviousButton",playBtnClass:"SSPlayButton",nextBtnClass:"SSNextButton",lastBtnClass:"SSLastButton",playLabelClass:"SSPlayLabel",pauseLabelClass:"SSPauseLabel",slideShowBusy:"SSBusy",slideLoading:"SSSlideLoading",sliceMap:{},componentOrder:["view","controls","links","title","description","count"]};Spry.Widget.ContentSlideShow=function(d,c){Spry.Widget.Base.call(this);this.element=Spry.$$(d)[0];this.isPlaying=false;this.setOptions(this,Spry.Widget.ContentSlideShow.config);this.setOptions(this,c);var a=this;this.firstFunc=function(){return a.showFirstSlide()};this.prevFunc=function(){return a.showPreviousSlide()};this.playFunc=function(){return a.togglePlayMode()};this.nextFunc=function(){return a.showNextSlide()};this.lastFunc=function(){return a.showLastSlide()};this.initializePlugIns(Spry.Widget.ContentSlideShow.config.plugIns,c);var b=new Spry.Widget.Event(this);this.notifyObservers("onPreInitialize",b);if(!b.performDefaultAction)return;this.transformMarkup();this.attachBehaviors();this.updateSlideCountLabel();if(this.autoPlay)this.triggerCallbackAfterOnLoad(this.play,this);this.notifyObservers("onPostInitialize",b)};Spry.Widget.ContentSlideShow.prototype=new Spry.Widget.Base;Spry.Widget.ContentSlideShow.prototype.constructor=Spry.Widget.ContentSlideShow;Spry.Widget.ContentSlideShow.config=a;Spry.Widget.ContentSlideShow.prototype.showSlide=function(b){var a=this.panelSet;if(a&&a.showPanel)a.showPanel(b)};Spry.Widget.ContentSlideShow.prototype.hideSlide=function(b){var a=this.panelSet;if(a&&a.hidePanel)a.hidePanel(b)};Spry.Widget.ContentSlideShow.prototype.showFirstSlide=function(){var a=new Spry.Widget.Event(this);this.notifyObservers("onPreShowFirstSlide",a);if(!a.performDefaultAction)return false;if(this.panelSet)this.panelSet.showFirstPanel();this.notifyObservers("onPostShowFirstSlide",a);return false};Spry.Widget.ContentSlideShow.prototype.showPreviousSlide=function(){var a=new Spry.Widget.Event(this);this.notifyObservers("onPreShowPreviousSlide",a);if(!a.performDefaultAction)return false;if(this.panelSet)this.panelSet.showPreviousPanel();this.notifyObservers("onPostShowPreviousSlide",a);return false};Spry.Widget.ContentSlideShow.prototype.showNextSlide=function(){var a=new Spry.Widget.Event(this);this.notifyObservers("onPreShowNextSlide",a);if(!a.performDefaultAction)return false;if(this.panelSet)this.panelSet.showNextPanel();this.notifyObservers("onPostShowNextSlide",a);return false};Spry.Widget.ContentSlideShow.prototype.showLastSlide=function(){var a=new Spry.Widget.Event(this);this.notifyObservers("onPreShowLastSlide",a);if(!a.performDefaultAction)return false;if(this.panelSet)this.panelSet.showLastPanel();this.notifyObservers("onPostShowLastSlide",a);return false};Spry.Widget.ContentSlideShow.prototype.play=function(){var a=new Spry.Widget.Event(this);this.notifyObservers("onPreStartSlideShow",a);if(!a.performDefaultAction)return false;if(this.panelSet)this.panelSet.play();this.notifyObservers("onPostStartSlideShow",a);return false};Spry.Widget.ContentSlideShow.prototype.stop=function(){var a=new Spry.Widget.Event(this);this.notifyObservers("onPreStopSlideShow",a);if(!a.performDefaultAction)return false;if(this.panelSet)this.panelSet.stop();this.notifyObservers("onPostStopSlideShow",a);return false};Spry.Widget.ContentSlideShow.prototype.togglePlayMode=function(){if(this.element)if(Spry.Utils.hasClassName(this.element,this.playingClass))this.stop();else this.play();return false};Spry.Widget.ContentSlideShow.prototype.getCurrentSlide=function(){return this.panelSet?this.panelSet.getCurrentPanel():null};Spry.Widget.ContentSlideShow.prototype.getCurrentSlideIndex=function(){var a=this.panelSet;return a&&a.getCurrentPanelIndex?a.getCurrentPanelIndex():-1};Spry.Widget.ContentSlideShow.prototype.getSlideIndex=function(b){var a=this.panelSet;return a&&a.getPanelIndex?a.getPanelIndex(b):-1};Spry.Widget.ContentSlideShow.prototype.getSlides=function(){var b=[],a=Spry.$$("."+this.clipClass,this.element)[0];if(a)return Spry.$$("."+this.slideClass,a);return b};Spry.Widget.ContentSlideShow.prototype.isInPlayMode=function(){return this.isPlaying};Spry.Widget.ContentSlideShow.prototype.handlePanelSetStart=function(){this.isPlaying=true;this.addClassName(this.element,this.playingClass);return false};Spry.Widget.ContentSlideShow.prototype.handlePanelSetStop=function(){this.isPlaying=false;this.removeClassName(this.element,this.playingClass);return false};Spry.Widget.ContentSlideShow.prototype.handlePanelSetPreShowPanel=function(b){var a=new Spry.Widget.Event(this,{target:b.panelElement});this.notifyObservers("onPreShowSlide",a);if(!a.performDefaultAction){b.preventDefault();return false}return false};Spry.Widget.ContentSlideShow.prototype.handlePanelSetPostShowPanel=function(a){this.updateSlideCountLabel();var b=new Spry.Widget.Event(this,{target:a.target,slideIndex:a.targetIndex});this.notifyObservers("onPostShowSlide",b);return false};Spry.Widget.ContentSlideShow.prototype.updateSlideCountLabel=function(){var a=this;Spry.$$("."+this.countClass).forEach(function(b){if(b.contentContainer)b.contentContainer.innerHTML=a.getSlideCountLabel()})};Spry.Widget.ContentSlideShow.prototype.getSlideCountLabel=function(){var b="",a=this.panelSet;if(a)b+=a.getCurrentPanelIndex()+1+" of "+a.getPanelCount();return b};Spry.Widget.ContentSlideShow.prototype.createButtonElement=function(d,b,e,c){var a=this.createOptionalSlicedStructure(null,c?"a":"button",b,null,"span");if(c)a.href="#";else a.setAttribute("type","button");this.addClassName(a,b);a.contentContainer.appendChild(document.createTextNode(d));return a};Spry.Widget.ContentSlideShow.prototype.transformMarkup=function(){var f=new Spry.Widget.Event(this);this.notifyObservers("onPreTransformMarkup",f);if(!f.performDefaultAction)return;var b=[];if(!this.repeatingElementSelector)b=this.getElementChildren(this.element);else b=Spry.$$(this.repeatingElementSelector,this.element);var e=this.createOptionalSlicedStructure(null,"div",this.widgetClass),c=e.contentContainer;if(this.widgetID)e.id=this.widgetID;var k=this.createElement("div",this.clipClass,null),p=this.createElement("div",this.viewClass,k);for(var g=0;g<this.componentOrder.length;g++){var m=this.componentOrder[g];switch(m){case "view":var l=this.extractionType=="element";for(var a=0;a<b.length;a++){var h=this.createOptionalSlicedStructure(null,"div",this.slideClass);p.appendChild(h);if(l)h.contentContainer.appendChild(b[a]);else this.appendChildNodes(h.contentContainer,this.extractChildNodes(b[a]))}c.appendChild(k);break;case "controls":var i=this.createOptionalSlicedStructure(null,"div",this.controlsClass),d=i.contentContainer;d.appendChild(this.firstBtn=this.createButtonElement("First",this.firstBtnClass,this.firstFunc));d.appendChild(this.prevBtn=this.createButtonElement("Previous",this.prevBtnClass,this.prevFunc));d.appendChild(this.playBtn=this.createButtonElement("",this.playBtnClass,this.playFunc));d.appendChild(this.nextBtn=this.createButtonElement("Next",this.nextBtnClass,this.nextFunc));d.appendChild(this.lastBtn=this.createButtonElement("Last",this.lastBtnClass,this.lastFunc));this.playBtn.contentContainer.innerHTML='<span class="'+this.playLabelClass+'">Play</span><span class="'+this.pauseLabelClass+'">Pause</span>';c.appendChild(i);break;case "links":var j=this.createOptionalSlicedStructure(null,"div",this.slideLinksClass),n=j.contentContainer;for(var a=0;a<b.length;a++)n.appendChild(this.createButtonElement(a+1+"",this.slideLinkClass,null,true));c.appendChild(j);break;case "title":c.appendChild(this.createOptionalSlicedStructure(null,"div",this.slideTitleClass));break;case "description":c.appendChild(this.createOptionalSlicedStructure(null,"div",this.slideDescriptionClass));break;case "count":c.appendChild(this.createOptionalSlicedStructure(null,"div",this.countClass))}}if(this.injectionType=="replace"){var o=this.element.parentNode;o.replaceChild(e,this.element);this.element=e}else{this.element.innerHTML="";this.element.appendChild(e)}this.notifyObservers("onPostTransformMarkup",f)};Spry.Widget.ContentSlideShow.prototype.attachViewBehaviors=function(){var b=new Spry.Widget.Event(this);this.notifyObservers("onPreAttachViewBehaviors",b);if(!b.performDefaultAction)return;this.panelSet=new Spry.Widget.FadingPanels(Spry.$$("."+this.slideClass,this.element),{dropFrames:this.dropFrames,minDuration:this.transitionDuration,maxDuration:this.transitionDuration,displayInterval:this.displayInterval,visibleClass:this.slideVisibleClass,hiddenClass:this.slideHiddenClass});var a=this;this.panelSet.addObserver({onPreStartSlideShowMode:function(c,b){a.handlePanelSetStart(b)},onPreStopSlideShowMode:function(c,b){a.handlePanelSetStop(b)},onPreShowPanel:function(c,b){a.handlePanelSetPreShowPanel(b)},onPostShowPanel:function(c,b){a.handlePanelSetPostShowPanel(b)}});this.notifyObservers("onPostAttachViewBehaviors",b)};Spry.Widget.ContentSlideShow.prototype.attachButtonBehavior=function(c,a,b){var d=new Spry.Widget.Button(c,{downClass:a+"Down",hoverClass:a+"Hover",disabledClass:a+"Disabled",onclick:b})};Spry.Widget.ContentSlideShow.prototype.attachControlBehaviors=function(){var b=new Spry.Widget.Event(this);this.notifyObservers("onPreAttachControlBehaviors",b);if(!b.performDefaultAction)return;var a=this;Spry.$$("."+this.firstBtnClass,this.element).forEach(function(b){a.attachButtonBehavior(b,a.firstBtnClass,a.firstFunc)});Spry.$$("."+this.prevBtnClass,this.element).forEach(function(b){a.attachButtonBehavior(b,a.prevBtnClass,a.prevFunc)});Spry.$$("."+this.playBtnClass,this.element).forEach(function(b){a.attachButtonBehavior(b,a.playBtnClass,a.playFunc)});Spry.$$("."+this.nextBtnClass,this.element).forEach(function(b){a.attachButtonBehavior(b,a.nextBtnClass,a.nextFunc)});Spry.$$("."+this.lastBtnClass,this.element).forEach(function(b){a.attachButtonBehavior(b,a.lastBtnClass,a.lastFunc)});this.notifyObservers("onPostAttachControlBehaviors",b)};Spry.Widget.ContentSlideShow.prototype.attachLinkBehaviors=function(){var b=Spry.$$("."+this.slideLinkClass,this.element);if(b.length>0){var a=new Spry.Widget.Event(this);this.notifyObservers("onPreAttachLinkBehaviors",a);if(!a.performDefaultAction)return;this.panelSelector=new Spry.Widget.PanelSelector(b,this.panelSet,{selectedClass:this.slideLinkClass+"Selected",unselectedClass:this.slideLinkClass+"Unselected",hoverClass:this.slideLinkClass+"Hover"});this.notifyObservers("onPostAttachLinkBehaviors",a)}};Spry.Widget.ContentSlideShow.prototype.attachBehaviors=function(){var a=new Spry.Widget.Event(this);this.notifyObservers("onPreAttachBehaviors",a);if(!a.performDefaultAction)return;this.attachViewBehaviors();this.attachLinkBehaviors();this.attachControlBehaviors();this.notifyObservers("onPostAttachBehaviors",a)};Spry.Widget.ContentSlideShow.slideTransitionPlugin={initialize:function(a){a.addObserver(this)},onPreAttachViewBehaviors:function(a,b){a.panelSet=new Spry.Widget.SliderPanels(Spry.$$("."+a.clipClass,a.element),{displayInterval:a.displayInterval,visibleClass:a.slideVisibleClass,hiddenClass:a.slideHiddenClass});a.panelSet.addObserver({onPreStartSlideShowMode:function(c,b){a.handlePanelSetStart(b)},onStop:function(c,b){a.handlePanelSetStop(b)},onPreShowPanel:function(c,b){a.handlePanelSetPreShowPanel(b)},onPostShowPanel:function(c,b){a.handlePanelSetPostShowPanel(b)}});b.preventDefault()}};Spry.Widget.ContentSlideShow.imageListPlugin={slideLoadingClass:"SlideLoading",initialize:function(a){a.injectionType="replace";a.extractionType="element";a.repeatingElementSelector="a";if(typeof Spry.Utils.ImageLoader!="undefined")a.ilpLoader=new Spry.Utils.ImageLoader;a.addObserver(this)},createImage:function(c,b,d){var a=document.createElement("img");if(c.ilpLoader)c.ilpLoader.load(b,function(){a.src=b});else a.src=b;a.title=d},onPostTransformMarkup:function(a){var b=Spry.$$("."+a.slideClass+" a",a.element).forEach(function(a){var b=document.createElement("img");b.src=a.href;b.title=a.title;a.parentNode.replaceChild(b,a)})}}})()
