/*
 MuseSprySlideshow.js - version 0.17 - Spry Pre-Release 1.7

 Copyright (c) 2010. Adobe Systems Incorporated.
 All rights reserved.

 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:

 Redistributions of source code must retain the above copyright notice,
 this list of conditions and the following disclaimer.
 Redistributions in binary form must reproduce the above copyright notice,
 this list of conditions and the following disclaimer in the documentation
 and/or other materials provided with the distribution.
 Neither the name of Adobe Systems Incorporated nor the names of its
 contributors may be used to endorse or promote products derived from this
 software without specific prior written permission.

 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 POSSIBILITY OF SUCH DAMAGE.
*/
(function(){typeof Spry=="undefined"||!Spry.Widget||!Spry.Widget.Base?alert("MuseSprySlideshow.js requires MuseSpryCommon.js!"):(Spry.Widget.ContentSlideShow=function(a,b){Spry.Widget.Base.call(this);this.element=Spry.$$(a)[0];this.lightboxInitialized=this.isPlaying=!1;this.setOptions(this,Spry.Widget.ContentSlideShow.config);this.setOptions(this,b);var c=this;this.firstFunc=function(){return c.showFirstSlide()};this.prevFunc=function(){return c.showPreviousSlide()};this.playFunc=function(){return c.togglePlayMode()};
this.nextFunc=function(){return c.showNextSlide()};this.lastFunc=function(){return c.showLastSlide()};this.initializePlugIns(Spry.Widget.ContentSlideShow.config.plugIns,b);this.lazyInitFn=function(){var a=new Spry.Widget.Event(this);this.notifyObservers("onPreInitialize",a);a.performDefaultAction&&(this.transformMarkup(),this.attachBehaviors(),this.updateSlideCountLabel(),this.autoPlay&&this.triggerCallbackAfterOnLoad(this.play,this),this.notifyObservers("onPostInitialize",a),b.lightboxEnabled_runtime&&
$.browser.msie&&$.browser.version<9&&(a=$(c.lightboxContent).prev().children(".SlideShowContentPanel")[0],Muse.Utils.needPIE(),PIE.detach(a),PIE.attach(a)))};var d=$(this.element).parent(":visible").length==0;if(b.lightboxEnabled_runtime){var e=$(c.element);$thumbs=e.find(".SSSlideLink");this.setupLBThumbnailLinks=function(){$thumbs.bind("click",function(){c.lightboxInitialized||(e.children().not(c.$thumbGroup.parent()).show(),c.lazyInitFn());var a=e.find(".SSClip");$(c.lightboxContent).museOverlay("open");
a.length>0&&widget.panelSet.scrollToPage($(c).index())})};d?(this.setupLBThumbnailLinks(),this.$thumbGroup=e.find(".SSSlideLinks"),e.children().not(this.$thumbGroup.parent()).hide()):(this.lazyInitFn(),this.setupLBThumbnailLinks())}else this.lazyInitFn()},Spry.Widget.ContentSlideShow.prototype=new Spry.Widget.Base,Spry.Widget.ContentSlideShow.prototype.constructor=Spry.Widget.ContentSlideShow,Spry.Widget.ContentSlideShow.config={plugIns:[],injectionType:"inside",extractionType:"element",repeatingElementSelector:null,
useButtonControls:!1,dropFrames:!0,autoPlay:!0,transitionDuration:2E3,displayInterval:6E3,slideLinkStopsSlideShow:!1,slideLinkEvent:"click",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.prototype.showSlide=function(a){var b=this.panelSet;b&&b.showPanel&&b.showPanel(a)},Spry.Widget.ContentSlideShow.prototype.hideSlide=
function(a){var b=this.panelSet;b&&b.hidePanel&&b.hidePanel(a)},Spry.Widget.ContentSlideShow.prototype.showFirstSlide=function(){var a=new Spry.Widget.Event(this);this.notifyObservers("onPreShowFirstSlide",a);if(!a.performDefaultAction)return!1;this.panelSet&&this.panelSet.showFirstPanel();this.notifyObservers("onPostShowFirstSlide",a);return!1},Spry.Widget.ContentSlideShow.prototype.showPreviousSlide=function(){var a=new Spry.Widget.Event(this);this.notifyObservers("onPreShowPreviousSlide",a);if(!a.performDefaultAction)return!1;
this.panelSet&&this.panelSet.showPreviousPanel();this.notifyObservers("onPostShowPreviousSlide",a);return!1},Spry.Widget.ContentSlideShow.prototype.showNextSlide=function(){var a=new Spry.Widget.Event(this);this.notifyObservers("onPreShowNextSlide",a);if(!a.performDefaultAction)return!1;this.panelSet&&this.panelSet.showNextPanel();this.notifyObservers("onPostShowNextSlide",a);return!1},Spry.Widget.ContentSlideShow.prototype.showLastSlide=function(){var a=new Spry.Widget.Event(this);this.notifyObservers("onPreShowLastSlide",
a);if(!a.performDefaultAction)return!1;this.panelSet&&this.panelSet.showLastPanel();this.notifyObservers("onPostShowLastSlide",a);return!1},Spry.Widget.ContentSlideShow.prototype.play=function(){var a=new Spry.Widget.Event(this);this.notifyObservers("onPreStartSlideShow",a);if(!a.performDefaultAction)return!1;this.panelSet&&this.panelSet.play();this.notifyObservers("onPostStartSlideShow",a);return!1},Spry.Widget.ContentSlideShow.prototype.stop=function(){var a=new Spry.Widget.Event(this);this.notifyObservers("onPreStopSlideShow",
a);if(!a.performDefaultAction)return!1;this.panelSet&&this.panelSet.stop();this.notifyObservers("onPostStopSlideShow",a);return!1},Spry.Widget.ContentSlideShow.prototype.togglePlayMode=function(){this.element&&(Spry.Utils.hasClassName(this.element,this.playingClass)?this.stop():this.play());return!1},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(a){var b=this.panelSet;return b&&b.getPanelIndex?b.getPanelIndex(a):-1},Spry.Widget.ContentSlideShow.prototype.getSlides=function(){var a=Spry.$$("."+this.clipClass,this.element)[0];if(a)return Spry.$$("."+this.slideClass,a);return[]},Spry.Widget.ContentSlideShow.prototype.isInPlayMode=function(){return this.isPlaying},Spry.Widget.ContentSlideShow.prototype.handlePanelSetStart=
function(){this.isPlaying=!0;this.addClassName(this.element,this.playingClass);return!1},Spry.Widget.ContentSlideShow.prototype.handlePanelSetStop=function(){this.isPlaying=!1;this.removeClassName(this.element,this.playingClass);return!1},Spry.Widget.ContentSlideShow.prototype.handlePanelSetPreShowPanel=function(a){var b=new Spry.Widget.Event(this,{target:a.panelElement});this.notifyObservers("onPreShowSlide",b);b.performDefaultAction||a.preventDefault();return!1},Spry.Widget.ContentSlideShow.prototype.handlePanelSetPostShowPanel=
function(a){this.updateSlideCountLabel();this.notifyObservers("onPostShowSlide",new Spry.Widget.Event(this,{target:a.target,slideIndex:a.targetIndex}));return!1},Spry.Widget.ContentSlideShow.prototype.updateSlideCountLabel=function(){var a=this.panelSet;if(a){var b=a.getPanelCount(),c=b?a.getCurrentPanelIndex()+1:0,d=[c,b];Spry.$$("."+this.countClass,this.element).forEach(function(a){if(a.contentContainer){var f=0;Spry.Utils.preorderTraversal(a.contentContainer,function(a){if(a.nodeType==3){var b=
a.nodeValue.replace(/\d+/g,function(a){if(f<d.length)return d[f++];return a});if(b!=a.nodeValue)a.nodeValue=b;if(f==d.length)return!0}return!1});if(f==0)a.contentContainer.innerHTML=c+" of "+b}})}},Spry.Widget.ContentSlideShow.prototype.createButtonElement=function(a,b,c,d){c=this.createOptionalSlicedStructure(null,d?"a":"button",b,null,"span");d?c.href="#":c.setAttribute("type","button");this.addClassName(c,b);c.contentContainer.appendChild(document.createTextNode(a));return c},Spry.Widget.ContentSlideShow.prototype.transformMarkup=
function(){var a=new Spry.Widget.Event(this);this.notifyObservers("onPreTransformMarkup",a);if(a.performDefaultAction){var b=[],b=this.repeatingElementSelector?Spry.$$(this.repeatingElementSelector,this.element):this.getElementChildren(this.element),c=this.createOptionalSlicedStructure(null,"div",this.widgetClass),d=c.contentContainer;if(this.widgetID)c.id=this.widgetID;for(var e=this.createElement("div",this.clipClass,null),f=this.createElement("div",this.viewClass,e),g=0;g<this.componentOrder.length;g++)switch(this.componentOrder[g]){case "view":for(var i=
this.extractionType=="element",h=0;h<b.length;h++){var j=this.createOptionalSlicedStructure(null,"div",this.slideClass);f.appendChild(j);i?j.contentContainer.appendChild(b[h]):this.appendChildNodes(j.contentContainer,this.extractChildNodes(b[h]))}d.appendChild(e);break;case "controls":h=this.createOptionalSlicedStructure(null,"div",this.controlsClass);i=h.contentContainer;i.appendChild(this.firstBtn=this.createButtonElement("First",this.firstBtnClass,this.firstFunc));i.appendChild(this.prevBtn=this.createButtonElement("Previous",
this.prevBtnClass,this.prevFunc));i.appendChild(this.playBtn=this.createButtonElement("",this.playBtnClass,this.playFunc));i.appendChild(this.nextBtn=this.createButtonElement("Next",this.nextBtnClass,this.nextFunc));i.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>';d.appendChild(h);break;case "links":i=this.createOptionalSlicedStructure(null,
"div",this.slideLinksClass);j=i.contentContainer;for(h=0;h<b.length;h++)j.appendChild(this.createButtonElement(h+1+"",this.slideLinkClass,null,!0));d.appendChild(i);break;case "title":d.appendChild(this.createOptionalSlicedStructure(null,"div",this.slideTitleClass));break;case "description":d.appendChild(this.createOptionalSlicedStructure(null,"div",this.slideDescriptionClass));break;case "count":d.appendChild(this.createOptionalSlicedStructure(null,"div",this.countClass))}this.injectionType=="replace"?
(this.element.parentNode.replaceChild(c,this.element),this.element=c):(this.element.innerHTML="",this.element.appendChild(c));this.notifyObservers("onPostTransformMarkup",a)}},Spry.Widget.ContentSlideShow.prototype.attachViewBehaviors=function(){var a=new Spry.Widget.Event(this);this.notifyObservers("onPreAttachViewBehaviors",a);if(a.performDefaultAction){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,exitSlideShowModeOnPanelChange:this.slideLinkStopsSlideShow});var b=this;this.panelSet.addObserver({onPreStartSlideShowMode:function(a,d){b.handlePanelSetStart(d)},onPreStopSlideShowMode:function(a,d){b.handlePanelSetStop(d)},onPreShowPanel:function(a,d){b.handlePanelSetPreShowPanel(d)},onPostShowPanel:function(a,d){b.handlePanelSetPostShowPanel(d)}});this.notifyObservers("onPostAttachViewBehaviors",
a)}},Spry.Widget.ContentSlideShow.prototype.attachButtonBehavior=function(a,b,c){new Spry.Widget.Button(a,{downClass:b+"Down",hoverClass:b+"Hover",disabledClass:b+"Disabled",onclick:c})},Spry.Widget.ContentSlideShow.prototype.attachControlBehaviors=function(){var a=new Spry.Widget.Event(this);this.notifyObservers("onPreAttachControlBehaviors",a);if(a.performDefaultAction){var b=this;Spry.$$("."+this.firstBtnClass,this.element).forEach(function(a){b.attachButtonBehavior(a,b.firstBtnClass,b.firstFunc)});
Spry.$$("."+this.prevBtnClass,this.element).forEach(function(a){b.attachButtonBehavior(a,b.prevBtnClass,b.prevFunc)});Spry.$$("."+this.playBtnClass,this.element).forEach(function(a){b.attachButtonBehavior(a,b.playBtnClass,b.playFunc)});Spry.$$("."+this.nextBtnClass,this.element).forEach(function(a){b.attachButtonBehavior(a,b.nextBtnClass,b.nextFunc)});Spry.$$("."+this.lastBtnClass,this.element).forEach(function(a){b.attachButtonBehavior(a,b.lastBtnClass,b.lastFunc)});this.notifyObservers("onPostAttachControlBehaviors",
a)}},Spry.Widget.ContentSlideShow.prototype.attachLinkBehaviors=function(){var a=Spry.$$("."+this.slideLinkClass,this.element);if(a.length>0){var b=new Spry.Widget.Event(this);this.notifyObservers("onPreAttachLinkBehaviors",b);if(b.performDefaultAction)this.panelSelector=new Spry.Widget.PanelSelector(a,this.panelSet,{event:this.slideLinkEvent,selectedClass:this.slideLinkClass+"Selected",unselectedClass:this.slideLinkClass+"Unselected",hoverClass:this.slideLinkClass+"Hover"}),this.notifyObservers("onPostAttachLinkBehaviors",
b)}},Spry.Widget.ContentSlideShow.prototype.attachBehaviors=function(){var a=new Spry.Widget.Event(this);this.notifyObservers("onPreAttachBehaviors",a);a.performDefaultAction&&(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.CarouselPanels(Spry.$$("."+a.clipClass,
a.element),{dimension:a.transitionStyle||"horizontal",panelsSelector:"."+a.slideClass,duration:a.transitionDuration,displayInterval:a.displayInterval,visibleClass:a.slideVisibleClass,hiddenClass:a.slideHiddenClass});a.panelSet.addObserver({onPreStartSlideShowMode:function(b,d){a.handlePanelSetStart(d)},onStop:function(b,d){a.handlePanelSetStop(d)},onPreShowPanel:function(b,d){a.handlePanelSetPreShowPanel(d)},onPostShowPanel:function(b,d){a.handlePanelSetPostShowPanel(d)}});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(a,b,c){var d=document.createElement("img");a.ilpLoader?a.ilpLoader.load(b,function(){d.src=b}):d.src=b;d.title=c},onPostTransformMarkup:function(a){Spry.$$("."+a.slideClass+" a",a.element).forEach(function(a){var c=document.createElement("img");
c.src=a.href;c.title=a.title;a.parentNode.replaceChild(c,a)})}},Spry.Widget.ContentSlideShow.slideLoadingStatePlugin={widget:null,imageQueue:{},initialize:function(a){a.addObserver(this);this.widget=a},getImagesFromSlide:function(a){return Spry.$$("img",a)},handleImageEventChange:function(a,b){a&&(this.toggleImageVisibility(a,!0),this.updateImageCompleteState(a),this.handleSlideLoadingState(b))},handleSlideLoadingState:function(a){this.isSlideLoaded(a)&&this.removeSlideLoadingState(a)},updateImageCompleteState:function(a){this.imageQueue[a.src].complete=
!0},toggleImageVisibility:function(a,b){a.style.visibility=a&&b?"visible":"hidden"},isSlideLoaded:function(a){var a=this.getImagesFromSlide(a),b=a.length;if(a&&b)for(var c=0;c<b;c++){var d=this.imageQueue[a[c].src];if(d&&d.complete!=!0)return!1}return!0},addSlideLoadingState:function(a){Spry.$$(a).addClassName(this.widget.slideLoading)},removeSlideLoadingState:function(a){Spry.$$(a).removeClassName(this.widget.slideLoading)},attachImageStateListeners:function(a,b){var c=this;if(a&&!a.complete&&(this.toggleImageVisibility(a,
!1),this.addImageToQueue(a,b),this.addSlideLoadingState(b),Spry.$$(a).addEventListener("load",function(a){c.handleImageEventChange(a.target||a.srcElement,b)},!1),Spry.$$(a).addEventListener("error",function(a){c.handleImageEventChange(a.target||a.srcElement,b)},!1),$.browser.msie&&$.browser.version==9))a.src=a.getAttribute("src")},addImageToQueue:function(a,b){a&&a.src&&(this.imageQueue[a.src]={src:a.src,slide:b})},onPreAttachViewBehaviors:function(a){var b=this;Spry.$$("."+this.widget.slideClass,
a.element).forEach(function(a){var d=b.getImagesFromSlide(a);d&&d.length&&d.forEach(function(d){b.attachImageStateListeners(d,a)})})}},Spry.Widget.ContentSlideShow.config.plugIns.push(Spry.Widget.ContentSlideShow.slideLoadingStatePlugin))})();Muse.Plugins.SlideShow=function(){};Muse.Plugins.SlideShow.prototype.initialize=function(a){a.observers.push(this)};
Muse.Plugins.SlideShow.prototype.onPreTransformMarkup=function(a,b){if(Spry.Utils.hasClassName(a.element,"SlideShowWidget")){b.preventDefault();Spry.$$("."+a.countClass,a.element).forEach(function(a){a.contentContainer=Muse.Utils.firstDescendant(a,Muse.Utils.Match.byNodeName("p"));if(!a.contentContainer)a.contentContainer=Muse.Utils.firstDescendant(a,Muse.Utils.Match.byNodeName("span"))});var c=Spry.$$("."+a.slideClass,a.element);if(a.plugIns.indexOf(Spry.Widget.ContentSlideShow.slideTransitionPlugin)!=
-1){var d=Spry.$$(".SlideShowContentPanel",a.element),e=document.createElement("div");e.className=a.clipClass;Muse.Utils.wrapElement(d[0],e);var e=Spry.$$(e),f=void 0;if(Muse.Utils.getStyleValue(d[0],"position")=="absolute")var f=Muse.Utils.getStyleValue(d[0],"top"),g=Muse.Utils.getStyleValue(d[0],"left"),f="position:absolute; top:"+f+"px; left:"+g+"px;";var g=Muse.Utils.getStyleValue(c[0],"width"),i=Muse.Utils.getStyleValue(c[0],"height"),h=Muse.Utils.getStyleValue(c[0],"borderStyle");h&&h!="none"&&
(g=g+Muse.Utils.getStyleValue(c[0],"border-left-width")+Muse.Utils.getStyleValue(c[0],"border-right-width"),i=i+Muse.Utils.getStyleValue(c[0],"border-top-width")+Muse.Utils.getStyleValue(c[0],"border-bottom-width"));e.setStyle((f!=void 0?f:"")+"overflow:hidden; width:"+g+"px; height:"+i+"px;");d.setStyle("position:relative; left:0px; top:0px; margin:0px; overflow:hidden; width: "+g+"px; height: "+i+"px;")}a.element.parentNode.className.match(/mu-query/)&&Muse.Plugins.SlideShow.layoutThumbnails(a)}};
Muse.Plugins.SlideShow.layoutThumbnails=function(a){Spry.$$("."+a.slideLinksClass,a.element).forEach(function(b){var c=Muse.Utils.descendants(b,Muse.Utils.Match.byClass(a.slideLinkClass)),d=c[0],e=Muse.Utils.getStyleValue(d,"width"),f=Muse.Utils.getStyleValue(d,"height"),g=Muse.Utils.getStyleValue(d,"margin-right"),i=Muse.Utils.getStyleValue(d,"margin-bottom"),h=Muse.Utils.getStyleValue(d,"border-left-width"),j=Muse.Utils.getStyleValue(d,"border-right-width"),k=Muse.Utils.getStyleValue(d,"border-top-width"),
l=Muse.Utils.getStyleValue(d,"border-bottom-width"),d=Muse.Utils.getStyleValue(b,"width"),q=Muse.Utils.getStyleValue(b,"padding-left"),n=Muse.Utils.getStyleValue(b,"padding-top"),r=Math.floor((d+g)/(e+h+j+g)),o=Math.ceil(c.length/r);(b.runtimeStyle?b.runtimeStyle:b.style).height=(f+k+l)*o+i*(o-1)+"px";var m=c.length<r?c.length:r,p=Muse.Utils.pixelRound((d-(e+h+j)*m-g*(m-1))/2)+q,v=p,t=n,s=1;c.forEach(function(a){s>m&&(s=1,v=p,t+=f+k+l+i);s++>1&&(v+=e+h+j+g);a=a.runtimeStyle?a.runtimeStyle:a.style;
a.marginRight="0px";a.marginBottom="0px";a.left=v+"px";a.top=t+"px"})})};
Muse.Plugins.SlideShow.positionImage=function(a,b,c){var b=a.width,d=a.height,e=Muse.Utils.getNaturalWidth(a),f=Muse.Utils.getNaturalHeight(a);if(!(b==e&&d==f)){var g=e,i=f;if(c=="fillFrameProportionally")e>b&&f>d&&(c=e/b,g=f/d,c<g?(i=f/c,g=b):(i=d,g=e/g));else if(c=="fitContentProportionally"&&(e>b||f>d))c=e/b,g=f/d,c>g?(i=f/c,g=e/c):(i=f/g,g=e/g);a=a.runtimeStyle?a.runtimeStyle:a.style;a.width=Muse.Utils.pixelRound(g)+"px";a.height=Muse.Utils.pixelRound(i)+"px";a.marginTop=Muse.Utils.pixelRound((d-
i)/2)+"px";a.marginLeft=Muse.Utils.pixelRound((b-g)/2)+"px"}};Muse.Plugins.SlideShow.handleImageEventChange=function(a,b,c){a&&Muse.Plugins.SlideShow.positionImage(a,b,c)};
Muse.Plugins.SlideShow.handleImagePositioning=function(a,b,c){Spry.$$("."+b,a.element).forEach(function(a){Spry.$$("img",a).forEach(function(b){b&&!b.complete?(Spry.$$(b).addEventListener("load",function(b){Muse.Plugins.SlideShow.handleImageEventChange(b.target||b.srcElement,a,c)},!1),Spry.$$(b).addEventListener("error",function(b){Muse.Plugins.SlideShow.handleImageEventChange(b.target||b.srcElement,a,c)},!1)):Muse.Plugins.SlideShow.positionImage(b,a,c)})})};
Muse.Plugins.SlideShow.prototype.onPreAttachViewBehaviors=function(a){a.element.parentNode.className.match(/mu-query/)&&(Muse.Plugins.SlideShow.handleImagePositioning(a,a.slideClass,a.heroFitting),Muse.Plugins.SlideShow.handleImagePositioning(a,a.slideLinkClass,a.thumbFitting))};
Muse.Plugins.SlideShow.prototype.onPostAttachBehaviors=function(a){a.captionsSet=new Spry.Widget.PanelSet(Spry.$$(".SSSlideCaption",a.element),{dropFrames:a.dropFrames,displayInterval:a.displayInterval});for(var b=a.captionsSet.getPanels(),c=0;c<b.length;c++){var d=b[c];d.style.display=d!=a.captionsSet.getCurrentPanel()?"none":""}a.panelSet.addObserver({onPostShowPanel:function(b,c){Muse.Plugins.SlideShow.handlePostShowSlide(a,c)},onPostHidePanel:function(b,c){Muse.Plugins.SlideShow.handlePostHideSlide(a,
c)}});if(a.transitionStyle=="fading"){b=a.panelSet.getPanels();for(c=0;c<b.length;c++)d=b[c],d.style.display=d!=a.panelSet.getCurrentPanel()?"none":"block";a.panelSet.addObserver({onPreShowPanel:function(b,c){Muse.Plugins.SlideShow.handlePreShowSlide(a,c)},onPostHidePanelEffect:function(b,c){Muse.Plugins.SlideShow.handleHideEffectComplete(a,c)}})}};Muse.Plugins.SlideShow.handlePostShowSlide=function(a,b){var c=a.captionsSet.getPanel(b.targetIndex);if(c)c.style.display="block",a.captionsSet.showPanel(c)};
Muse.Plugins.SlideShow.handleHideEffectComplete=function(a,b){var c=a.panelSet.getPanel(b.targetIndex);if(c)c.style.display="none"};Muse.Plugins.SlideShow.handlePreShowSlide=function(a,b){var c=a.panelSet.getPanel(b.targetIndex);if(c)c.style.display="block"};Muse.Plugins.SlideShow.handlePostHideSlide=function(a,b){var c=a.captionsSet.getPanel(b.targetIndex);if(c)c.style.display="none"};Muse.Plugins.SlideShow.prototype.onPostStartSlideShow=function(a){Spry.Utils.removeClassName(a.element,a.stoppedClass)};
Muse.Plugins.SlideShow.prototype.onPostStop=function(a){Spry.Utils.addClassName(a.element,a.stoppedClass)};Spry.Widget.ContentSlideShow.config.plugIns.push(new Muse.Plugins.SlideShow);Spry.Widget.ContentSlideShow.config.transitionDuration=1E3;Muse.Plugins.SlideShowLightbox=function(){};Muse.Plugins.SlideShowLightbox.prototype.initialize=function(a){a.lightboxEnabled_runtime===!0&&a.observers.push(this)};
Muse.Plugins.SlideShowLightbox.prototype.onPreInitialize=function(a){a.lightboxInitialized=!0;var a=$(a.element),b=a.find(".SlideShowCaptionPanel, .SSFirstButton, .SSPreviousButton, .SSNextButton, .SSLastButton, .SlideShowLabel, .SSCloseButton"),c=a.find(".SSSlide").offset();b.each(function(a,b){var f=$(b),g=f.offset();f.css({left:g.left-c.left,top:g.top-c.top})})};
Muse.Plugins.SlideShowLightbox.prototype.onPostAttachBehaviors=function(a){if(Spry.Utils.hasClassName(a.element,"SlideShowWidget")){var b=$(a.element),c=b.find(".SSClip"),d=b.find(".SlideShowContentPanel"),e=c.length>0?c:d,f=e.find(".SSSlide"),g=b.find(".SlideShowCaptionPanel, .SSFirstButton, .SSPreviousButton, .SSNextButton, .SSLastButton, .SlideShowLabel, .SSCloseButton"),b=b.find(".SSCloseButton"),i=f.outerWidth(),h=f.outerHeight(),j=d.clone().css({position:"absolute",left:0,top:0,width:"auto",
height:"auto",padding:0,margin:0,zIndex:"auto"}),k=$("<div class='overlayWedge'></div>"),l=j.find(".SSSlide").parent();l.append(k);l.css({height:"auto"});j.find(".SSSlide").remove();d.removeAttr("id");j.css({visibility:"hidden"}).appendTo("body");d=j.outerWidth();l=j.outerHeight();j.detach().css({visibility:""});e.css({padding:0,left:0,top:0,width:i,height:h});c.length==0&&(f.css({left:0,top:0,position:"absolute"}),e.append(f).children(":not(.SSSlide)").remove());var q=$("<div class='LightboxContent'></div>").css({position:"absolute"}).append(e).append(g.addClass("popup_element")).museOverlay({autoOpen:!1,
offsetLeft:-i/2,offsetTop:-h/2,overlayExtraWidth:d,overlayExtraHeight:l,$overlaySlice:j,$overlayWedge:k});a.lightboxContent=q.get(0);b.bind("click",function(){q.museOverlay("close")})}};
Muse.Plugins.SlideShowLightbox.prototype.onPostShowSlide=function(a){var b=a.panelSet;if(b){var c=b.getPanelCount(),d=c?b.getCurrentPanelIndex()+1:0,e=[d,c];Spry.$$("."+a.countClass,a.lightboxContent).forEach(function(a){if(a.contentContainer){var b=0;Spry.Utils.preorderTraversal(a.contentContainer,function(a){if(a.nodeType==3){var c=a.nodeValue.replace(/\d+/g,function(a){if(b<e.length)return e[b++];return a});if(c!=a.nodeValue)a.nodeValue=c;if(b==e.length)return!0}return!1});if(b==0)a.contentContainer.innerHTML=
d+" of "+c}})}};Spry.Widget.ContentSlideShow.config.plugIns.push(new Muse.Plugins.SlideShowLightbox);

