(function(){function b(a){if(!Static.SQUARESPACE_CONTEXT.authenticatedAccount)if(a)for(var b=0;b=Y.UA.ie;this.bindUI();this.syncUI();this.textShrink(".page-title",".page-title-wrapper");this.textShrink(".page-desc p \x3e strong",".page-desc p");this.textShrink(".collection-type-events.view-list .entry-title-wrapper h1.entry-title",".collection-type-events.view-list .entry-title-wrapper");this.textShrink(".collection-type-blog.view-list.blog-layout-columns .entry-title-wrapper h1.entry-title", ".collection-type-blog.view-list.blog-layout-columns .entry-title-wrapper");Y.one("body.collection-type-index")&&this.handleIndex();this.listenTweaks();Y.one("body").addClass("loaded");Y.UA.ie&&Y.one("html").addClass("ie"+Y.UA.ie);this.isMobile||Y.one("html").removeClass("touch");if(!Y.one(".sqs-edit-mode-active")&&(Y.one(".sqs-block-gallery")||Y.one(".sqs-block-summary-v2"))){var b=this,a=setInterval(function(){Y.one("img.loading")||(b.syncUI(),Y.one("body.collection-type-index")&&b.handleIndex(), clearInterval(a))},100);setTimeout(function(){clearInterval(a)},6E4)}},handleIndex:function(){if(Y.config.win.location.hash)this.onHashChange({newHash:window.location.hash.replace("#",""),quick:!0});else this.updateActivePage();this.positionImages()},bindUI:function(){if(Y.one("body.collection-type-index")){var b=Y.one(".scroll-arrow");b.on("click",function(){var a=b.ancestor(".title-desc-wrapper").next(".content");if(a){var d=new Y.Anim({node:Y.one(Y.UA.gecko||Y.UA.ie||navigator.userAgent.match(/Trident.*rv.11\./)? "html":"body"),to:{scrollTop:a.getY()},duration:0.5,easing:"easeOut"});d.run();d.on("end",function(){d.destroy()})}});new rafscroll(Y.bind(function(){this.positionImages();Y.one("#parallax-nav")&&this.updateActivePage()},this));var a=Y.UA.mobile?"orientationchange":"resize";Y.one(Y.config.win).on("resize",Y.throttle(Y.bind(function(){this.syncUI();this.positionImages()},this),50),this);Y.on("hashchange",Y.bind(this.onHashChange,this),Y.config.win);Y.all("#parallax-nav a").each(function(a){a.on("click", function(){if(a.getAttribute("href")===window.location.hash)this.onHashChange({newHash:a.getAttribute("href").replace("#","")})},this)},this);Y.one(".back-to-top-link a").on("click",function(a){a.halt();this.onHashChange({newHash:Y.one("[data-url-id]").getAttribute("data-url-id")})},this);Y.all("#desktopNav .external-link a[href*\x3d#]").each(function(a){a.on("click",function(b){var e=Y.one(a.getAttribute("href"));if(e){var f=e.getXY()[1];b.preventDefault();this.autoScrolling=!0;this.scrollEl.anim({}, {to:{scroll:[0,f]},duration:this.SCROLL_SPEED,easing:Y.Easing.easeBoth}).run().on("end",function(){this.scrollEl.get("scrollTop")!==f&&this.scrollEl.set("scrollTop",f);this.autoScrolling=!1;this.updateActivePage()},this)}},this)},this)}else Y.one(Y.config.win).on("scroll",Y.bind(function(){this.positionBackgroundImage()},this),this),a=Y.UA.mobile?"orientationchange":"resize",Y.one(Y.config.win).on(a,Y.throttle(Y.bind(function(){this.syncUI();this.positionBackgroundImage()},this),50),this);this.setupMobileNav(); this.setScrollArrowColor()},syncUI:function(){var b=Y.one("body"),a=Y.one("#header").get("clientHeight"),c=b.hasClass("fixed-header"),d=b.hasClass("title--description-position-over-image");this.parallaxOff="false"==Y.Squarespace.Template.getTweakValue("parallax-scrolling");this.viewportH=b.get("winHeight");this.docHeight=b.get("docHeight");if(Y.one("body.collection-type-index")){this.isMobile?(this.setupMobileLayout(),Y.one("#header").setStyle("position","absolute"),Y.one(".sqs-cart-dropzone").setStyle("marginTop", a),Y.one(".parallax-images \x3e .image-container:nth-child(1) \x3e img")&&Y.one(".title-desc-wrapper").setStyle("minHeight","600px"),0=Y.UA.ie?Y.one(".title-desc-wrapper").setStyle("paddingTop",d?80+a:a):Y.one(".title-desc-wrapper").setStyle("paddingTop",a)):(Y.one("#content-wrapper").setStyle("marginTop",c?a:null),Y.all(".title-desc-wrapper").setStyle("paddingTop",c&&d?80+a:null),Y.one(".title-desc-wrapper")&&Y.one(".title-desc-wrapper").setStyle("paddingTop",null));var e=Y.Squarespace.Template.getTweakValue("index-image-height"); this.IMAGE_VIEWPORT="Fullscreen"==e?1:"Half"==e?0.5:0.66;this.firstImageHeight="true"===Y.Squarespace.Template.getTweakValue("first-index-image-fullscreen")?this.viewportH:parseInt(this.viewportH*this.IMAGE_VIEWPORT);this.restImageHeight=parseInt(this.viewportH*this.IMAGE_VIEWPORT);var f=new Y.NodeList;this.parallaxPages.each(function(b,e){if(!this.isMobile){var j=0===e?this.firstImageHeight-Y.one("#header").get("clientHeight"):this.restImageHeight;if(d){var g=c?a+160:160,j=Math.max(j,b.one(".title-desc-inner").height()+ g),g=0===e?j+a:j;this.parallaxImages.item(e).setStyle("height",Math.max(this.viewportH,g)+"px")}if(g=this.parallaxImages.item(e).one("img"))b.one(".title-desc-wrapper").setStyle("height",j+"px"),f.push(g.removeAttribute("data-load"))}this.pageOffsets[b.getAttribute("data-url-id")]=0===e?0:Math.round(b.getXY()[1])},this);Y.Squarespace.GalleryManager.addImageQueue(f);this.parallaxImages.each(function(a){(a=a.one("img"))&&a.getAttribute("src")&&ImageLoader.load(a)},this);this.stickyCart()}else(e=Y.one(".banner-image img"))&& ImageLoader.load(e),Y.one(".sqs-cart-dropzone").setStyle("marginTop",a),this.stickyCart(),this.isMobile||Y.one("#header-wrapper").setStyle("paddingTop",c?a:null);this.isMobile||(Y.one(".collection-type-index.title--description-alignment-center.title--description-position-over-image")&&Y.all(".title-desc-wrapper.has-main-image").each(function(a){a.one(".title-desc-inner").setStyles({top:"50%",left:"50%",transform:"translatex(-50%) translatey(-50%)"})}),Y.one(".collection-type-index.title--description-alignment-left")&& Y.all(".title-desc-wrapper.over-image.has-main-image .title-desc-inner").setStyles({top:null,left:null,transform:"translatex(0) translatey(0)"}),Y.one("#parallax-nav")&&(e=Y.one("#parallax-nav").get("offsetHeight"),Y.one("#parallax-nav").setStyle("marginTop",-1*(e/2))));Y.one(".footer-wrapper .sqs-block")||Y.one(".footer-wrapper").addClass("empty");Y.one(".nav-wrapper")&&b.addClass("has-nav");this.headerBgOnScroll()},textShrink:function(b,a){Y.one(b)&&Y.one(b).ancestor(a)&&Y.all(b).each(function(b){b.plug(Y.Squarespace.TextShrink, {parentEl:b.ancestor(a)})})},setupMobileLayout:function(){var b=Y.config.win.innerHeight>Y.config.win.innerWidth?screen.height:screen.width,a=Y.Squarespace.Template.getTweakValue("index-image-height"),c=Y.one("#header").get("clientHeight"),d;switch(!0){case "Two Thirds"==a:d=0.66666*b;break;case "Fullscreen"==a:d=1*b;break;default:d=0.5*b}Y.all(".parallax-item").each(function(a,b){var h=a.one(".title-desc-wrapper"),i=a.one(".title-desc-inner"),j=a.one(".title-desc-image");if(h.hasClass("has-main-image")){var g; 0===b?(d-=118,g=this.INITIAL_WINDOW_HEIGHT-c):g=d;var k=i.get("clientHeight");k>g&&(g=d=k);h.setStyles({height:g,overflow:"hidden"},this);j.setStyles({height:d})}else h.setStyle({paddingTop:c});Y.one(".title--description-alignment-center")&&h.hasClass("has-main-image")&&(i.get("clientHeight")=Y.UA.ie?(0=Y.UA.ie?Y.one("body").addClass("crappy-ie-no-parallax"):Y.one("body").addClass("mobile-no-parallax"),Y.all(".title-desc-image").each(function(a,b){0===b&&a.setStyles({minHeight:a.ancestor(".title-desc-wrapper").get("clientHeight")+ Y.one("#header").get("clientHeight")});a.one("img").removeAttribute("data-load");ImageLoader.load(a.one("img"),{mode:"fill"})})):(Y.one("body").addClass("mobile-parallax"),Y.all(".title-desc-image").each(function(a){a.setStyle("height",b);a.one("img").removeAttribute("data-load");ImageLoader.load(a.one("img"),{mode:"fill"})}))},setupMobileNav:function(){Y.one("#mobileMenu").on("click",function(){Y.one("body").hasClass("mobile-nav-open")?Y.one("body").removeClass("mobile-nav-open"):Y.one("body").addClass("mobile-nav-open")}); Y.all("li.folder").each(function(b){b.on("click",function(){var a=b.siblings("li.folder.dropdown-open").item(0);a&&a.toggleClass("dropdown-open");b&&b.toggleClass("dropdown-open")})})},positionBackgroundImage:function(){var b=this.scrollEl.get("scrollTop"),a=Y.one(Y.config.win).get("region"),c=Y.one(".banner-image img");!this.parallaxOff&&(!this.isMobile&&c&&!(b>a.height))&&c.setStyle("transform","translate3d(0,"+parseInt(b*this.PARALLAX_FACTOR,10)+"px,0)")},onHashChange:function(b){Y.one(".mobile-nav-open")&& Y.one("body").removeClass("mobile-nav-open");if(Y.one('.parallax-item[data-url-id\x3d"'+b.newHash+'"]')){var a=this.pageOffsets[b.newHash];b.quick?(this.scrollEl.set("scrollTop",a),this.updateActivePage()):(this.autoScrolling=!0,this.scrollEl.anim({},{to:{scroll:[0,a]},duration:this.SCROLL_SPEED,easing:Y.Easing.easeBoth}).run().on("end",function(){this.scrollEl.get("scrollTop")!==a&&this.scrollEl.set("scrollTop",a);this.autoScrolling=!1;this.updateActivePage()},this))}},getPageFromOffset:function(b){if(this.parallaxPages.item(0)){var a= this.parallaxPages.item(0).getAttribute("data-url-id"),c;for(c in this.pageOffsets)b>=this.pageOffsets[c]&&this.pageOffsets[c]>this.pageOffsets[a]&&(a=c);return a}},setScrollArrowColor:function(){var b=Y.one(".scroll-arrow"),a=Y.one(".parallax-item .title-desc-wrapper");a&&(a=a.getAttribute("data-color-suggested"),Y.Lang.isValue(b)&&Y.Lang.isValue(a)&&(a="color-weight-"+this._getLightness(a),b.hasClass(a)||b.removeClass("color-weight-dark").removeClass("color-weight-light").addClass(a)))},updateActivePage:function(){if(!this.autoScrolling){var b= this.scrollEl.get("scrollTop"),a=this.getPageFromOffset(b),c=Y.one("#parallax-nav-item-"+a);c&&!c.hasClass("active")&&(Y.all("#parallax-nav li").removeClass("active"),c.addClass("active"));window.location.hash.replace("#","")!=a&&window.history&&window.history.replaceState&&window.history.replaceState({},"","#"+a);a=this.isMobile?Y.one('.parallax-item[data-url-id\x3d"'+a+'"] .title-desc-wrapper img'):Y.one('#parallax-images .image-container[data-url-id\x3d"'+a+'"] img');Y.Squarespace.GalleryManager.promoteImageQueue(new Y.NodeList(a)); if(!Y.one("body.hide-parallax-nav")){var a=this.getPageFromOffset(b+this.viewportH/2),d;if(b+this.viewportH/2<=this.pageOffsets[a]+(0===this.pageOffsets[a]?this.firstImageHeight:this.viewportH*this.IMAGE_VIEWPORT))d=Y.one('.parallax-item[data-url-id\x3d"'+a+'"] .title-desc-wrapper').getAttribute("data-color-suggested");if(!d||"#"===d)d=Y.Squarespace.Template.getTweakValue("contentBgColor"),(b=d.match(/rgba\((\d+),(\d+),(\d+),(\d+)/))&&(d=this._rgb2hex(b[1],b[2],b[3]));Y.one("#parallax-nav")&&(d="color-weight-"+ this._getLightness(d),Y.one("#parallax-nav").hasClass(d)||Y.one("#parallax-nav").removeClass("color-weight-dark").removeClass("color-weight-light").addClass(d))}}},_rgb2hex:function(b,a,c){b=[b,a,c];for(a=0;2>=a;++a)b[a]=parseInt(b[a],10).toString(16),1==b[a].length&&(b[a]="0"+b[a]);return"#"+b.join("")},_getLightness:function(b){return b&&0=b.length?(b=b.replace("#",""),8388607.5c?Y.one("#header").setStyle("backgroundColor",d):a.setStyle("backgroundColor","transparent")}}},stickyCart:function(){if(this.isMobile)return!1;var b=Y.one(".sqs-cart-dropzone");Y.one("#header").get("clientHeight");var a;b&&b.one(".yui3-widget")&&(a=b.one(".yui3-widget").getY(),Y.one(window).on("resize",function(){a=b.getY()}),Y.one("body.fixed-header")?b.addClass("fixed-cart").setStyles({top:Y.one("#header").get("clientHeight")+ 10}):new rafscroll(function(){b.toggleClass("fixed-cart",Y.config.win.scrollY>=a)}))}})});