',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var c=b.st.gallery,e=".mfp-gallery",g=Boolean(a.fn.mfpFastClick);return b.direction=!0,c&&c.enabled?(f+=" mfp-gallery",w(m+e,function(){c.navigateByImgClick&&b.wrap.on("click"+e,".mfp-img",function(){return b.items.length>1?(b.next(),!1):void 0}),d.on("keydown"+e,function(a){37===a.keyCode?b.prev():39===a.keyCode&&b.next()})}),w("UpdateStatus"+e,function(a,c){c.text&&(c.text=T(c.text,b.currItem.index,b.items.length))}),w(l+e,function(a,d,e,f){var g=b.items.length;e.counter=g>1?T(c.tCounter,f.index,g):""}),w("BuildControls"+e,function(){if(b.items.length>1&&c.arrows&&!b.arrowLeft){var d=c.arrowMarkup,e=b.arrowLeft=a(d.replace(/%title%/gi,c.tPrev).replace(/%dir%/gi,"left")).addClass(s),f=b.arrowRight=a(d.replace(/%title%/gi,c.tNext).replace(/%dir%/gi,"right")).addClass(s),h=g?"mfpFastClick":"click";e[h](function(){b.prev()}),f[h](function(){b.next()}),b.isIE7&&(x("b",e[0],!1,!0),x("a",e[0],!1,!0),x("b",f[0],!1,!0),x("a",f[0],!1,!0)),b.container.append(e.add(f))}}),w(n+e,function(){b._preloadTimeout&&clearTimeout(b._preloadTimeout),b._preloadTimeout=setTimeout(function(){b.preloadNearbyImages(),b._preloadTimeout=null},16)}),void w(h+e,function(){d.off(e),b.wrap.off("click"+e),b.arrowLeft&&g&&b.arrowLeft.add(b.arrowRight).destroyMfpFastClick(),b.arrowRight=b.arrowLeft=null})):!1},next:function(){b.direction=!0,b.index=S(b.index+1),b.updateItemHTML()},prev:function(){b.direction=!1,b.index=S(b.index-1),b.updateItemHTML()},goTo:function(a){b.direction=a>=b.index,b.index=a,b.updateItemHTML()},preloadNearbyImages:function(){var a,c=b.st.gallery.preload,d=Math.min(c[0],b.items.length),e=Math.min(c[1],b.items.length);for(a=1;a<=(b.direction?e:d);a++)b._preloadItem(b.index+a);for(a=1;a<=(b.direction?d:e);a++)b._preloadItem(b.index-a)},_preloadItem:function(c){if(c=S(c),!b.items[c].preloaded){var d=b.items[c];d.parsed||(d=b.parseEl(c)),y("LazyLoad",d),"image"===d.type&&(d.img=a(' ').on("load.mfploader",function(){d.hasSize=!0}).on("error.mfploader",function(){d.hasSize=!0,d.loadError=!0,y("LazyLoadError",d)}).attr("src",d.src)),d.preloaded=!0}}}});var U="retina";a.magnificPopup.registerModule(U,{options:{replaceSrc:function(a){return a.src.replace(/\.\w+$/,function(a){return"@2x"+a})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var a=b.st.retina,c=a.ratio;c=isNaN(c)?c():c,c>1&&(w("ImageHasSize."+U,function(a,b){b.img.css({"max-width":b.img[0].naturalWidth/c,width:"100%"})}),w("ElementParse."+U,function(b,d){d.src=a.replaceSrc(d,c)}))}}}}),function(){var b=1e3,c="ontouchstart"in window,d=function(){v.off("touchmove"+f+" touchend"+f)},e="mfpFastClick",f="."+e;a.fn.mfpFastClick=function(e){return a(this).each(function(){var g,h=a(this);if(c){var i,j,k,l,m,n;h.on("touchstart"+f,function(a){l=!1,n=1,m=a.originalEvent?a.originalEvent.touches[0]:a.touches[0],j=m.clientX,k=m.clientY,v.on("touchmove"+f,function(a){m=a.originalEvent?a.originalEvent.touches:a.touches,n=m.length,m=m[0],(Math.abs(m.clientX-j)>10||Math.abs(m.clientY-k)>10)&&(l=!0,d())}).on("touchend"+f,function(a){d(),l||n>1||(g=!0,a.preventDefault(),clearTimeout(i),i=setTimeout(function(){g=!1},b),e())})})}h.on("click"+f,function(){g||e()})})},a.fn.destroyMfpFastClick=function(){a(this).off("touchstart"+f+" click"+f),c&&v.off("touchmove"+f+" touchend"+f)}}(),A()}); jQuery(document).ready(function($) { /*******************************************************/ /* Lightbox (Content) /*******************************************************/ function initMagnificPopup(){ $(".ecp-trigger-lightbox, a[target='lightbox']").magnificPopup({ gallery: {enabled: false}, mainClass: 'mfp-fade', removalDelay: 300 }); /* On load lightboxes */ $(".ecp-lightbox[data-lightbox-trigger='onload']").each(function(){ var trigger = $(this).attr('data-lightbox-trigger'); var id = $(this).attr('id'); var bypass_cookie = $(this).attr('data-lightbox-bypass-cookie'); if (! $.cookie('ecp-lightbox-' + id) || bypass_cookie) { $.magnificPopup.open({ items: { src: '#' + id, type:'inline' }, }); $.cookie('ecp-lightbox-' + id, true, {path: "/"}); } }); $('.ecp-lightbox-close').on("click", function() { $.magnificPopup.close(); }); } initMagnificPopup(); }); /*******************************************************/ /* Add Parent Arrow SVG /*******************************************************/ document.addEventListener( 'DOMContentLoaded', function () { var menu_items_with_children = document.querySelectorAll('.ecp-menu.ecp-menu-depth-all > ul > li.menu-item-has-children'); for (var i = 0; i < menu_items_with_children.length; i++) { menu_items_with_children[i].insertAdjacentHTML('beforeend', ''); } }); /*******************************************************/ /* Custom Menu > Mobile Menu Type > Hamburger +- links /*******************************************************/ document.addEventListener( 'DOMContentLoaded', function () { var accordion_parents = document.querySelectorAll('.ecp-menu-accordion li.menu-item-has-children'); accordion_parents.forEach((li, index, array) => { var trigger = document.createElement('span'); trigger.classList.add('ecp-menu-parent-trigger'); trigger.innerHTML = ''; li.appendChild(trigger); li.addEventListener('click', event => { event.stopImmediatePropagation(); var ul = li.querySelector(':scope > ul'); var this_trigger = li.querySelector(':scope > .ecp-menu-parent-trigger'); if (this_trigger.classList.contains('ecp-menu-parent-trigger-active')) { ul.style.display = 'none'; this_trigger.classList.remove('ecp-menu-parent-trigger-active'); } else { ul.style.display = 'block'; this_trigger.classList.add('ecp-menu-parent-trigger-active'); } }); }); }); /*******************************************************/ /* Custom Menu > Mobile Menu Type > Hamburger Toggle Buttons (hamburger button, close button in overlay) /*******************************************************/ document.addEventListener( 'DOMContentLoaded', function () { var menu_toggle_buttons = document.querySelectorAll('.ecp-menu-hamburger-trigger-button, .ecp-menu-hamburger-trigger-close'); menu_toggle_buttons.forEach((button, index, array) => { button.addEventListener('click', event => { event.preventDefault() event.stopImmediatePropagation(); document.body.classList.toggle('ecp-menu-hamburger-open'); button.closest('.ecp-menu-mobile').classList.toggle('ecp-menu-mobile-active'); }); }); }); /*******************************************************/ /* Custom Menu > Mobile Menu Type > Hamburger +- links /*******************************************************/ document.addEventListener( 'DOMContentLoaded', function () { var accordion_parents = document.querySelectorAll('.ecp-menu-accordion li.menu-item-has-children'); accordion_parents.forEach((li, index, array) => { var trigger = document.createElement('span'); trigger.classList.add('ecp-menu-parent-trigger'); trigger.innerHTML = ''; li.appendChild(trigger); li.addEventListener('click', event => { event.stopImmediatePropagation(); var ul = li.querySelector(':scope > ul'); var this_trigger = li.querySelector(':scope > .ecp-menu-parent-trigger'); if (this_trigger.classList.contains('ecp-menu-parent-trigger-active')) { ul.style.display = 'none'; this_trigger.classList.remove('ecp-menu-parent-trigger-active'); } else { ul.style.display = 'block'; this_trigger.classList.add('ecp-menu-parent-trigger-active'); } }); }); }); /*******************************************************/ /* Custom Menu > Mobile Menu Type > Hamburger Toggle Buttons (hamburger button, close button in overlay) /*******************************************************/ document.addEventListener( 'DOMContentLoaded', function () { var menu_toggle_buttons = document.querySelectorAll('.ecp-menu-hamburger-trigger-button, .ecp-menu-hamburger-trigger-close'); menu_toggle_buttons.forEach((button, index, array) => { button.addEventListener('click', event => { event.preventDefault() event.stopImmediatePropagation(); document.body.classList.toggle('ecp-menu-hamburger-open'); button.closest('.ecp-menu-mobile').classList.toggle('ecp-menu-mobile-active'); }); }); }); /*******************************************************/ /* Voice Search /*******************************************************/ document.addEventListener( 'DOMContentLoaded', function () { var voice_search_button = document.querySelector('.ecp-voice-search-button'); if ( typeof(voice_search_button) != 'undefined' && voice_search_button != null) { voice_search_button.addEventListener('click', function(event) { event.preventDefault(); if (window.hasOwnProperty('webkitSpeechRecognition')) { var recognition = new webkitSpeechRecognition(); recognition.continuous = false; recognition.interimResults = false; recognition.lang = "en-US"; recognition.start(); recognition.onresult = function(e) { document.getElementById('transcript').value = e.results[0][0].transcript; recognition.stop(); document.getElementById('voice_search').submit(); }; recognition.onerror = function(e) { recognition.stop(); } } }); } });