function init(){popupGallery=new Swiper(".js-trail_popup__gallery",{loop:!1,queueStartCallbacks:!1,speed:500,spaceBetween:10,observer:!0,preloadImages:!1,lazy:!0,navigation:{nextEl:".js-trail_popup__nav_next",prevEl:".js-trail_popup__nav_prev"}})}function trailPopup(n,t){var c=$(t),l=$(".js-trail_popup__images"),r=$(".js-trail_popup"),u=document.getElementsByClassName("js-trail_explorer")[0].offsetTop,f="",e="",o=window.scrollY,i,s="",h;(breakpoint.value=="sm"||breakpoint.value=="md")&&(u-=30);n==="open"&&t!==null&&(f=t.name,e=t.description,popupGallery.slideTo(0,0,!1),t.hasOwnProperty("images")&&(t.images!==undefined?(i=t.images,s=buildImages(i)):(i=null,$(".js-trail_popup__nav").hide())),populatePopup(f,e,s),showGalleryNav(),h=new TimelineMax,r.hasClass("is-open")||(breakpoint.value=="base"||breakpoint.value=="sm"||(window.scrollTo(0,u),$("body").css({"overflow-y":"hidden"})),h.to($(".js-header"),.25,{autoAlpha:0}).to($(".js__floating_title"),.25,{autoAlpha:0},"-=0.25"),r.addClass("is-open")));n==="close"&&(resetPopup(),resetMarkers(allMarkers),console.log(o),window.scrollTo(0,o))}function resetPopup(){var n=new TimelineMax;$(".js-trail_popup").hasClass("is-open")&&($("body").css({"overflow-y":""}),n.to($(".js-header"),.25,{autoAlpha:1}).to($(".js__floating_title"),.25,{autoAlpha:1}),$(".js-trail_popup").removeClass("is-open"))}function populatePopup(n,t,i){var r=$(".js-trail_popup__title"),u=$(".js-trail_popup__descr"),f=$(".js-trail_popup__image_wrapper");r.empty().html(n);u.empty().html(t);f.empty().html(i)}function showGalleryNav(){$(".c-trail_popup__gallery_img").length>1?$(".js-trail_popup__nav").css({display:"block"}):$(".js-trail_popup__nav").css({display:"none"})}function buildImages(n){var i="",r,t;if(n!==undefined){for(r=Object.keys(n).length,t=0;t<r;t++)i+='<li class="swiper-slide"><img src="'+n[t].url+'" class="c-trail_popup__gallery_img  swiper-lazy"/><div class="c-trail_popup__gallery_caption">'+n[t].caption+"<div><\/li>";return i}return}function resetMarkers(n){for(var t=0;t<n.length;t++)n[t].setIcon({path:google.maps.SymbolPath.CIRCLE,scale:8,strokeColor:"#000000",fillColor:"#951c1a",fillOpacity:1})}var popupGallery;$(function(){function o(){f.css("opacity")<=.2?n.play():(n.reverse(),n.progress()===0&&t.removeAttr("style"))}var i=$(window),f=$(".c-hero__pre_title"),t=$(".js__floating_title"),e=$(".js__floating_title__title"),r=$(".js-trail_popup"),u=t.outerHeight(),n;i.resize(function(){u=t.outerHeight();t.css({height:"auto"})});n=new TimelineMax;n.fromTo(t,.3,{height:0,opacity:0},{height:u,opacity:1}).to(e,.4,{opacity:1,left:0},"-=0.25");n.pause();i.on("scroll",_.debounce(function(){o()},200));init();$(document).on("click",".js-trail_popup__close",function(){trailPopup("close",$(this))});i.on("resize",_.throttle(function(){r.hasClass("is-open")&&i.scrollTop(r.offset().top)},200));$(document).on("touchmove",function(n){$(".js-trail_popup").hasClass("is-open")&&($(n.target).parents(".js-trail_popup")[0]||n.preventDefault())})})