$(document).ready(function(){Feature.Init()});var Feature={StatsTime:2e3,StickyHeader:!1,Init:function(){($.each($(".featureSection.gallery"),function(n,t){Feature.BindGalleryActions($(t))}),$(".featureSection.headerContents").length!==0||$(".featureSection.headerVideo").length!==0)&&(Feature.SetupScroll(),Feature.SetupContents($(".featureSection.headerContents")),Feature.SetupScrollTo(),$(window).resize(function(){$(".featureSection.headerContents").css("height",$(".featureSection.headerContents").find("div.image > img:visible").height())}))},SetupScroll:function(){$(window).on("scroll",function(){$.each($(".featureSection.headerContents"),function(n,t){Feature.ScrollContents($(t))});$.each($(".featureSection.chapter"),function(n,t){Feature.ScrollChapter($(t))});$.each($(".featureSection.stats"),function(n,t){Feature.ScrollStats($(t))});$.each($(".featureSection.nav"),function(n,t){Feature.ScrollNav($(t))})})},SetupContents:function(n){if(n.length!==0){$("ul.headerContents").length>0&&($(".featureSection.headerContents .image").append($("ul.headerContents")),$(".featureSection.headerContents").addClass("sticky"),Feature.StickyHeader=!0);n.css("height",n.find("div.image > img:visible").height());n.find("div.image > img:visible").on("load",function(){n.css("height",n.find("div.image > img:visible").height())});$.each(n.find("li"),function(n,t){$(t).css("animation-delay",1+n/5+"s");$(t).css("-webkit-animation-delay",1+n/5+"s");$(t).css("-moz-animation-delay",1+n/5+"s");$(t).css("-o-animation-delay",1+n/5+"s")})}},ScrollContents:function(n){var t=$(window).scrollTop(),r=t+$(window).height(),u=n.offset().top,i=n.offset().top+n.height();t>=u&&t<=i+350&&i<r?n.height()>$(window).height()&&Feature.StickyHeader?(n.addClass("on"),n.addClass("bottom")):Feature.StickyHeader&&n.addClass("on"):(n.removeClass("on"),n.removeClass("bottom"))},ScrollChapter:function(n){var t=$(window).scrollTop()+200,i=n.offset().top;t>=i&&n.find(".line").addClass("on")},ScrollStats:function(n){if(!n.data("animated")){var t=$(window).scrollTop()+1e3,i=n.offset().top;t>=i&&(n.data("animated",!0),Feature.WriteText(n),Feature.CountUp(n))}},ScrollNav:function(n){var t=$(window).scrollTop(),i=$(".navStart").offset().top,r=$(".navEnd").offset().top;t>=i&&t<=r?n.addClass("on"):n.removeClass("on")},ScrollGallery:function(n){if(!n.data("animated")){var t=$(window).scrollTop()+200,i=n.offset().top;t>=i&&(n.data("animated",!0),n.find("ul").addClass("on"))}},BindGalleryActions:function(n){var t=n.find("a").length,i=n.find("a").length<10?"0":"";n.find("div.number").html('<div>01<\/div><div class="line"><\/div><div>'+i+t+"<\/div>");n.find("div.byline").text(n.find("a").first().find("img").attr("alt"));n.find("a").each(function(r,u){$(u).click(function(f){f.preventDefault();n.find(".image").attr("src",$(u).find("img").attr("src"));n.find("div.number").html("<div>"+(r<9?"0":"")+(r+1)+'<\/div><div class="line"><\/div><div>'+i+t+"<\/div>");n.find("div.byline").text("");n.find("div.byline").text($(u).find("img").attr("alt"))})})},CountUp:function(n){n.find(".number").each(function(n,t){var i=$(t).text();$(t).fadeIn();$({countNum:0}).animate({countNum:i},{duration:Feature.StatsTime,easing:"linear",step:function(){$(t).text(this.countNum.toFixed(0))},complete:function(){$(t).text(i)}})})},WriteText:function(n){n.find(".text").each(function(n,t){var i=$(t).text();$(t).text("");$(t).fadeIn();Feature.WriteCharacter($(t),i,0,Feature.StatsTime/i.length)})},WriteCharacter:function(n,t,i,r){i<t.length&&(n.append(t[i++]),setTimeout(function(){Feature.WriteCharacter(n,t,i,r)},r))},SetupScrollTo:function(){$.each($(".featureSection.headerContents a"),function(n,t){$(t).click(function(n){n.preventDefault();$("html, body").animate({scrollTop:$($(this).attr("href")).offset().top},{duration:800,complete:function(){window.location.hash=$(t).attr("href")}})})})}}