"use strict";var windowHeight=window.innerHeight,windowHeightExtra=0,safari=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),mobile=/Mobi/.test(navigator.userAgent);safari&&!mobile&&(windowHeightExtra=window.outerHeight-window.innerHeight),mobile&&(windowHeight=window.screen.availHeight,windowHeightExtra=(window.screen.availHeight-window.innerHeight)/2);var positionParallax=function(e,t,a,i){var n=e.top/t-windowHeightExtra;a[i].style.top=n+"px"},animateParallax=function(e,t){for(var a=0;e.length>a;a++){var i=e[a].parentElement.parentElement.getBoundingClientRect();0<=i.top+i.height&&i.top<=windowHeight&&positionParallax(i,t,e,a)}},calculateHeight=function(e,t){for(var a=0;e.length>a;a++){var i=e[a].parentElement.parentElement.getBoundingClientRect(),n=e[a].parentElement.parentElement.offsetTop,o=(windowHeight-i.height)/2,r=windowHeight>i.height+n?i.height+n-n/t:i.height+2*(o-o/t);e[a].style.height=r+2*windowHeightExtra+"px",positionParallax(i,t,e,a)}},universalParallax=function(){this.init=function(e){void 0===e&&(e={}),e={speed:void 0!==e.speed?e.speed:1.5,className:void 0!==e.className?e.className:"parallax"};for(var t=document.getElementsByClassName(e.className),a=0;t.length>a;a++){var i=document.createElement("div");t[a].parentNode.insertBefore(i,t[a]),i.appendChild(t[a]);var n=t[a].parentElement;n.className+="parallax__container","relative"!==window.getComputedStyle(n.parentElement,null).getPropertyValue("position")&&(n.parentElement.style.position="relative");var o=t[a].dataset.parallaxImage;void 0!==o&&(t[a].style.backgroundImage="url("+o+")",1===t[a].classList.length&&"parallax"===t[a].classList[0]&&(t[a].style.backgroundRepeat="no-repeat",t[a].style.backgroundPosition="center",t[a].style.backgroundSize="cover"))}document.addEventListener("readystatechange",(function(a){var i,n;"complete"===a.target.readyState&&(i=t,(n=e.speed)<1&&(n=1),calculateHeight(i,n),mobile||window.addEventListener("resize",(function(){windowHeight=window.innerHeight,calculateHeight(i,n)})),window.addEventListener("scroll",(function(){animateParallax(i,n)})))}))}};