(function(b,e){b.ObjectRegistry=b.ObjectRegistry||{};b.ObjectRegistry.Slideshow=b.ObjectRegistry.Slideshow||{};b.ObjectRegistry.Slideshow.Register=function(a,d){b.ObjectRegistry.Slideshow.hasOwnProperty(a)&&h("WARNING \x3e Slideshow object is already registered. Rebinding new slideshow "+a+". Old one will fade into darkness.");return b.ObjectRegistry.Slideshow[a]=d};b.Slideshow=function(){this.slideCount=0;this.transitionType;this.slider=null;this.slideViewTime=this.transitionTime=1E3;this.currentSlideIndex= 0;this.uniqueID=this.autoTransition=null;this.liveEditEnabled=!1;return this};b.Slideshow.prototype.DIAGNOSTIC_MODE=!1;var h=function(a){b.Slideshow.prototype.DIAGNOSTIC_MODE&&console.log("Slideshow diagnostic[SlideshowGenerator.js] "+a)};b.Slideshow.prototype.initSlides=function(a){e("img[data-delay-load]",a).each(function(){var a=e(this),g=attrOrProps(a,"data-delay-load");attrOrProps(a,"src",g)})};b.Slideshow.prototype.initSlidePlusAndMinusOneIndex=function(a,d,g){if(0=c?b(d[0],g):b(d[a+1],g);0>a-1?b(d[c-1],g):b(d[a-1],g)}else a=e("img",d),0!==g?a.css("height",g+"px"):a.css("height","auto")};b.Slideshow.prototype.generate= function(a,d,g,c,m,k){h("Generating Slideshow for "+a);b.ObjectRegistry.Slideshow.Register(a,this);var f=this.mapUi(a);this.slider=this.createSlider(f);this.slider.$slider.removeClass("slide");this.initSlidePlusAndMinusOneIndex(0,f.$slider,k);null===d?(this.transitionTime=1E3*f.values.transitionTiming,this.slideViewTime=1E3*f.values.slideTiming):(this.transitionTime=1E3*d,this.slideViewTime=1E3*g);this.transitionType=f.transitionType;this.slideCount=f.$slides.length;this.currentSlideIndex=this.transitionType=== this.TransitionType.Slide?1:0;this.uniqueID=a;this.liveEditEnabled=c;a=100/this.slideCount;1this.slideCount-2?a=1:1>a&&(a=this.slideCount- 2);h("(Slide) Current Slide: "+this.currentSlideIndex+"; Target Slide: "+a);d=this.GetSlideDirectionTransitionType(a,d);k();var f=0,l=0;switch(d){case this.SlideTransitionDirectionType.FirstToLast:f=0;h("First Slide to Last Slide Transition");this.slider.$slider.animate({left:"0%"},this.transitionTime,function(){var a=c.slider.$slides.length-2;/(?:\b(MS)?IE\s+|\bTrident\/7\.0;.*\s+rv:)(\d+)/.test(navigator.userAgent)&&(f=100/c.slider.$slides.length%c.slider.$slides[a].style.width.replace("%","")* a*a);l=100*a-f;c.slider.$slider.css("left","-"+l+"%");c.slider.$slider.find(".showing").removeClass("showing");c.slider.$pager.find(".active").removeClass("active");e(c.slider.$pages[a]).addClass("active");e(c.slider.$slides[a]).addClass("showing");c.currentSlideIndex=a;"function"===typeof b&&b.call(c)});break;case this.SlideTransitionDirectionType.LastToFirst:f=0;/(?:\b(MS)?IE\s+|\bTrident\/7\.0;.*\s+rv:)(\d+)/.test(navigator.userAgent)&&(f=100/c.slider.$slides.length%c.slider.$slides[c.currentSlideIndex].style.width.replace("%", "")*a*a);l=100*(c.currentSlideIndex+1)-f;this.slider.$slider.animate({left:"-"+l+"%"},this.transitionTime,function(){h("Last Slide to First Slide Transition");c.slider.$slider.css("left","-100%");c.slider.$slider.find(".showing").removeClass("showing");c.slider.$pager.find(".active").removeClass("active");e(c.slider.$pages[1]).addClass("active");e(c.slider.$slides[1]).addClass("showing");c.currentSlideIndex=1;"function"===typeof b&&b.call(c)});break;default:f=0,/(?:\b(MS)?IE\s+|\bTrident\/7\.0;.*\s+rv:)(\d+)/.test(navigator.userAgent)&& (f=100/c.slider.$slides.length%c.slider.$slides[c.currentSlideIndex].style.width.replace("%","")*a*a),l=100*a-f,this.slider.$slider.animate({left:"-"+l+"%"},this.transitionTime,function(){h("Inner Slide Transition");c.slider.$slider.find(".showing").removeClass("showing");c.slider.$pager.find(".active").removeClass("active");e(c.slider.$pages[c.currentSlideIndex]).addClass("active");e(c.slider.$slides[c.currentSlideIndex]).addClass("showing");c.currentSlideIndex=a;"function"===typeof b&&b.call(c)})}}else this.transitionType=== this.TransitionType.Fade&&(h("(Fade) Current Slide: "+this.currentSlideIndex+"; Target Slide: "+a),a>this.slideCount-1?a=0:0>a&&(a=this.slideCount-1),e(this.slider.$slides).css("zindex",1),e(this.slider.$slides).animate({opacity:0},this.transitionTime,k),e(this.slider.$slides[a]).stop(!0).css("zindex",2).animate({opacity:1},this.transitionTime,m));c.initSlidePlusAndMinusOneIndex(a,c.slider.$slider)};b.Slideshow.prototype.next=function(a){this.transitionToSlide(this.currentSlideIndex+1,this.DirectionType.Forward, a)};b.Slideshow.prototype.previous=function(a){this.transitionToSlide(this.currentSlideIndex-1,this.DirectionType.Backward,a)};b.Slideshow.prototype.dotClick=function(a){a=this.mapDotClickUi(a);this.transitionToSlide(a.selectedSlideIndex,this.DirectionType.Omni)};b.Slideshow.prototype.TransitionType={Fade:0,Slide:1};b.Slideshow.prototype.DirectionType={Forward:0,Backward:1,Omni:2};b.Slideshow.prototype.SlideTransitionDirectionType={Inside:0,FirstToLast:1,LastToFirst:2};b.Slideshow.prototype.GetSlideDirectionTransitionType= function(a,d){return 1>=this.currentSlideIndex&&a===this.slideCount-2&&d===this.DirectionType.Backward?this.SlideTransitionDirectionType.FirstToLast:1===a&&this.currentSlideIndex>=this.slideCount-2&&d===this.DirectionType.Forward?this.SlideTransitionDirectionType.LastToFirst:this.SlideTransitionDirectionType.Inside};b.Slideshow.prototype.mapUi=function(a){var d={$slideshow:e(".cpSliderJS"+a).closest(".widget.slideShow"),$slider:e(".cpSliderJS"+a),$slides:e(".cpSliderJS"+a).find("li"),$pager:e(".pagerJS"+ a),$pages:e(".pagerJS"+a).find("li"),transitionType:e(".cpSliderJS"+a).hasClass("slide")?this.TransitionType.Slide:this.TransitionType.Fade,NotifySlidesAdded:function(){d.$slides=e(".cpSliderJS"+a).find("li")},values:{}};d.values.transitionTiming=d.$slideshow.children("input.transitionTiming").val();d.values.slideTiming=d.$slideshow.children("input.slideTiming").val();return d};b.Slideshow.prototype.createSlider=function(a){var d={$slider:a.$slider,$slides:a.$slides,$pager:a.$pager,$pages:a.$pages, setSlide:function(d){a.$slider.hasClass("slide")&&a.$slider.css("left","-"+d.toString()+"00%")},getCurrentlyShownSlide:function(){return a.$slider.find(".showing")},createOverlapImagesForFirstAndLastSlides:function(){var b=a.$slider.find("li");b.first().clone().insertAfter(a.$slider.find("li").last());b.last().clone().insertBefore(a.$slider.find("li").first());a.NotifySlidesAdded();d.$slides=a.$slides}};return d};b.Slideshow.prototype.mapDotClickUi=function(a){return{$dots:a.parents(".pager").children("li"), $selectedDot:a.parent("li"),$selectedImage:e("#"+attrOrProps(a,"data-targetImageli")),$images:e("#"+attrOrProps(a,"data-targetImageli")).parent("ol").children("li"),selectedSlideIndex:this.transitionType===this.TransitionType.Slide?parseInt(a.html()):parseInt(a.html()-1)}};b.Slideshow.prototype.bindUx=function(){var a=this;e(".prevJS"+this.uniqueID).unbind("click").click(function(){a.pause();a.previous()});e(".dotJS"+this.uniqueID).unbind("click").click(function(){a.pause();a.dotClick(e(this))}); e(".nextJS"+this.uniqueID).unbind("click").click(function(){a.pause();a.next()});e(".ssPause-btn").unbind("click").click(function(){a.onPause();e(".ssPlay-btn").removeClass("isHidden");e(".ssPause-btn").addClass("isHidden")});e(".ssPlay-btn").unbind("click").click(function(){a.onResume();e(".ssPause-btn").removeClass("isHidden");e(".ssPlay-btn").addClass("isHidden")});a.liveEditEnabled&&(a.slider.$slides.add("p.slideshowOptions.empty.placeholder").unbind("click").click(function(a){a=e(this).closest(".widget.slideShow"); var b=ContentCollectionInstance.PageID,c=ContentCollectionInstance.ModuleID,h=a.data("widgetid"),k=a.find(".hdnSlideshowUniqueID").val();callbackfnSlideshowSave=null;parentID_Slideshow=attrOrProps(a,"id");ContentCollectionInstance.SlideshowWidgetID=h;$popUp_Slideshow=openCpModal({title:"Slideshow",className:"newCP adminWrap cpPopOver admin modalSlideshow",isFrontEnd:!1,useIframe:!1,draggable:!0,url:"/Slideshow/SlideshowConfiguration/"+k+("?pageID\x3d"+b+"\x26moduleID\x3d"+c)})}),e(".widget.slideShow").siblings("a.handle.options").each(function(){var a= e(this);a.data("cpPopover")&&a.data("cpPopover").destroy();var b=attrOrProps(a.parents('[data-cprole$\x3d"ontentContainer"]'),"id"),c=a.parents(".pageContent").filter(":first").data("containerid"),b="/ContentWidgets/SlideshowOptions?widgetID\x3d"+a.data("widgetid")+"\x26pageID\x3d"+ContentCollectionInstance.PageID+"\x26contentContainerExternalID\x3d"+b+"\x26moduleID\x3d"+ContentCollectionInstance.ModuleID+"\x26contentContainerID\x3d"+c;a.cpPopover({url:b,className:"options adminWrap",onClose:function(a, b){a.preventDefault();window.CommonPopoverInstance.hide(b);e(document.activeElement).change()}})}))}})(this,"undefined"==typeof $?window.parent.$:$);