function autocompleteInit(){var n="/api/suggest/";$.each(["where","city"],function(t,i){$("#"+i).autoComplete({minChars:2,delay:400,source:function(t,r){try{xhr.abort()}catch(u){}xhr=$.getJSON(n+i,{term:t},function(n){r(n)})}})})}function forEach(n,t,i){for(var r=0;r<n.length;r++)t.call(i,r,n[r])}function nodeListToArray(n){return Array&&n!==null?Array.prototype.slice.call(n):[]}function initHorizontalList(n){function s(n,i){var s=i.querySelector(".horizontal-list__items");i.addEventListener("mousedown",function(n){u=n.pageX;t=!0;i.classList.add("active");e=n.pageX-s.offsetLeft;o=s.scrollLeft});i.addEventListener("mouseleave",function(){t=!1;i.classList.remove("active")});i.addEventListener("mouseup",function(n){f=n.pageX;t=!1;i.classList.remove("active");u!==f?i.classList.add("no-actions-allow"):i.classList.remove("no-actions-allow")});i.addEventListener("mousemove",function(n){if(t){n.preventDefault();var i=n.pageX-s.offsetLeft,u=(i-e)*r;s.scrollLeft=o-u}})}n=n||document;var i,t,r,u,f,e,o;i=n.querySelectorAll(".horizontal-list");t=!1;r=1.5;forEach(i,function(n,t){s(n,t)})}function initLangMenu(){var n=document.querySelector(".wg-lang-selector__selected");n&&n.addEventListener("click",function(t){t.preventDefault();n.classList.toggle("active")})}function toggle(n){var t=n||{toggleOpen:".toggle-open",toggleContnent:".toggle-content"};$(t.toggleOpen).on("click",function(){$(this).toggleClass("toggle").next(t.toggleContnent).stop().slideToggle("fast")})}function getHeight(n){return!n?$(".page-container-inner").outerHeight()+$(".page-footer").outerHeight():$(n).outerHeight()}function getIndex(n){return $(n).data("index")}function expandMap(n){n.preventDefault();var i=getHeight(".page-header")-$(window).scrollTop(),t=getHeight()-(i<0?0:i);$("body").toggleClass("map-expand");$("body").hasClass("map-expand")?($(".page-container").height(t),$("#results-list__holder").height(t),$("#results-map__holder").height(t)):($(".page-container").height(""),$("#results-list__holder").height(""),$("#results-map__holder").height(""))}function scrollCheck(n){var t=getHeight(".page-header")-gutter,i=t-$("."+n).offset().top;$(window).scrollTop()<=t?$("#under-map").css({top:i,right:-$("#under-map").width()+1,position:"absolute"}):$("#under-map").css({top:0,right:0,position:"fixed"})}function getCookie(n){for(var r=n+"=",f=decodeURIComponent(document.cookie),u=f.split(";"),t,i=0;i<u.length;i++){for(t=u[i];t.charAt(0)==" ";)t=t.substring(1);if(t.indexOf(r)==0)return t.substring(r.length,t.length)}return""}function getCookieTable(n){var t=document.getElementById(n),i;t&&(i=function(n){var t,i,r,u,f,e,o,s;return t=document.createElement("tr"),i=document.createElement("td"),r=document.createElement("td"),u=document.createElement("td"),f=document.createElement("td"),e=document.createElement("td"),o=document.createElement("td"),s=document.createElement("td"),i.innerHTML=n.cookiename||"",r.innerHTML=n.samplevalue||"",u.innerHTML=n.expire||"",f.innerHTML=n.type||"",e.innerHTML=n.domain||"",o.innerHTML=n.vendorname||"",s.innerHTML=n.descr||"",t.appendChild(i),t.appendChild(r),t.appendChild(u),t.appendChild(f),t.appendChild(e),t.appendChild(o),t.appendChild(s),t},xhr=new XMLHttpRequest,xhr.open("GET","https://consentmanager.mgr.consensu.org/delivery/cookieinfo.php?id=9257&api=json",!0),xhr.onload=function(){var r,u,n;if(xhr.status>=200&&xhr.status<400)for(r=JSON.parse(xhr.response)||[],u=t.querySelector("tbody"),n=0;r.length>n;n++)u.appendChild(i(r[n]))},xhr.onerror=function(){t.style.display="none"},xhr.send())}function initPebbleConsent(){window._PebbleConsent=!1;var n={},t=[],i=getCookie("CookieScriptConsent");i.length&&(n=JSON.parse(i),t=Object.keys(n));t.length&&t.indexOf("categories")!==-1&&Array&&!Array.isArray(n.categories)&&JSON.parse(n.categories).indexOf("targeting")!==-1&&(window._PebbleConsent=!0)}var EventTracking,gutter,timeout;!function(n){n.fn.autoComplete=function(t){var i=n.extend({},n.fn.autoComplete.defaults,t);return"string"==typeof t?(this.each(function(){var i=n(this);"destroy"==t&&(n(window).off("resize.autocomplete",i.updateSC),i.off("blur.autocomplete focus.autocomplete keydown.autocomplete keyup.autocomplete"),i.data("autocomplete")?i.attr("autocomplete",i.data("autocomplete")):i.removeAttr("autocomplete"),n(i.data("sc")).remove(),i.removeData("sc").removeData("autocomplete"))}),this):this.each(function(){function r(n){var u=t.val(),f,r;if(t.cache[u]=n,n.length&&u.length>=i.minChars){for(f="",r=0;r<n.length;r++)f+=i.renderItem(n[r],u);t.sc.html(f);t.updateSC(0)}else t.sc.hide()}var t=n(this);t.sc=n('<div class="autocomplete-suggestions '+i.menuClass+'"><\/div>');t.data("sc",t.sc).data("autocomplete",t.attr("autocomplete"));t.attr("autocomplete","off");t.cache={};t.last_val="";t.updateSC=function(i,r){if(t.sc.css({top:t.offset().top+t.outerHeight(),left:t.offset().left,width:t.outerWidth()}),!i&&(t.sc.show(),t.sc.maxHeight||(t.sc.maxHeight=parseInt(t.sc.css("max-height"))),t.sc.suggestionHeight||(t.sc.suggestionHeight=n(".autocomplete-suggestion",t.sc).first().outerHeight()),t.sc.suggestionHeight))if(r){var f=t.sc.scrollTop(),u=r.offset().top-t.sc.offset().top;u+t.sc.suggestionHeight-t.sc.maxHeight>0?t.sc.scrollTop(u+t.sc.suggestionHeight+f-t.sc.maxHeight):u<0&&t.sc.scrollTop(u+f)}else t.sc.scrollTop(0)};n(window).on("resize.autocomplete",t.updateSC);t.sc.appendTo("body");t.sc.on("mouseleave",".autocomplete-suggestion",function(){n(".autocomplete-suggestion.selected").removeClass("selected")});t.sc.on("mouseenter",".autocomplete-suggestion",function(){n(".autocomplete-suggestion.selected").removeClass("selected");n(this).addClass("selected")});t.sc.on("mousedown click",".autocomplete-suggestion",function(r){var u=n(this),f=u.data("val");return(f||u.hasClass("autocomplete-suggestion"))&&(t.val(f),i.onSelect(r,f,u),t.sc.hide()),!1});t.on("blur.autocomplete",function(){try{over_sb=n(".autocomplete-suggestions:hover").length}catch(n){over_sb=0}over_sb?t.is(":focus")||setTimeout(function(){t.focus()},20):(t.last_val=t.val(),t.sc.hide(),setTimeout(function(){t.sc.hide()},350))});i.minChars||t.on("focus.autocomplete",function(){t.last_val="\n";t.trigger("keyup.autocomplete")});t.on("keydown.autocomplete",function(r){var f,u;if((40==r.which||38==r.which)&&t.sc.html())return u=n(".autocomplete-suggestion.selected",t.sc),u.length?(f=40==r.which?u.next(".autocomplete-suggestion"):u.prev(".autocomplete-suggestion"),f.length?(u.removeClass("selected"),t.val(f.addClass("selected").data("val"))):(u.removeClass("selected"),t.val(t.last_val),f=0)):(f=40==r.which?n(".autocomplete-suggestion",t.sc).first():n(".autocomplete-suggestion",t.sc).last(),t.val(f.addClass("selected").data("val"))),t.updateSC(0,f),!1;27==r.which?t.val(t.last_val).sc.hide():(13==r.which||9==r.which)&&(u=n(".autocomplete-suggestion.selected",t.sc),u.length&&t.sc.is(":visible")&&(i.onSelect(r,u.data("val"),u),setTimeout(function(){t.sc.hide()},20)))});t.on("keyup.autocomplete",function(u){var f,e,o;if(!~n.inArray(u.which,[13,27,35,36,37,38,39,40]))if(f=t.val(),f.length>=i.minChars){if(f!=t.last_val){if(t.last_val=f,clearTimeout(t.timer),i.cache){if(f in t.cache)return void r(t.cache[f]);for(e=1;e<f.length-i.minChars;e++)if(o=f.slice(0,f.length-e),o in t.cache&&!t.cache[o].length)return void r([])}t.timer=setTimeout(function(){i.source(f,r)},i.delay)}}else t.last_val=f,t.sc.hide()})})};n.fn.autoComplete.defaults={source:0,minChars:3,delay:150,cache:1,menuClass:"",renderItem:function(n,t){t=t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");var i=new RegExp("("+t.split(" ").join("|")+")","gi");return'<div class="autocomplete-suggestion" data-val="'+n+'">'+n.replace(i,"<b>$1<\/b>")+"<\/div>"},onSelect:function(){}}}(jQuery);$(function(){autocompleteInit()});EventTracking=EventTracking||{};EventTracking.createFunctionWithTimeout=function(n,t){function r(){i||(i=!0,n())}var i=!1;return setTimeout(r,t||1e3),r};EventTracking.trackEvent=function(n,t,i){if(Settings!=="undefined"&&Settings.gaCodes.length)for(var r=0;r<Settings.gaCodes.length;r++)ga("t"+r+".send","event",{eventCategory:n,eventAction:t,eventLabel:i})};EventTracking.init=function(){$(".t-c").each(function(){var t=$(this).closest(".wg-results-list__item"),n=$(this).data("td")||{};typeof n.id=="undefined"&&typeof t.data("id")!="undefined"&&(n.id=t.data("id"));$.isEmptyObject(n)||$(this).data("td",n)});$(".t-c").click(function(){var t=Settings.pageType||"UNKNOWN",i=$(this).data("ta")||"UNKNOWN CLICK",n=Settings.pageData||{};typeof $(this).data("td")!="undefined"&&(n.actionData=$(this).data("td"));EventTracking.trackEvent(t,i,JSON.stringify(n))});$(".t-fpbc").click(function(){var n=jQuery.extend(!0,{},Settings.pageData),t=$(this).closest(".item-data");n.l=t.data("id")||"unknown";n.lo=t.data("index")||0;EventTracking.trackEvent(Settings.pageType,"FullProfileButtonClick",JSON.stringify(n))})};EventTracking.trackProfileCardShown=function(n,t){Settings.var=Settings.var||{};Settings.var.profileCardsShown=Settings.var.profileCardsShown||0;var i=jQuery.extend(!0,{},Settings.pageData);i.l=n;i.lo=t;i.lc=++Settings.var.profileCardsShown;EventTracking.trackEvent(Settings.pageType,"ProfileCardShown",JSON.stringify(i))};$(document).ready(function(){EventTracking.init();typeof Settings.pageType!="undefined"&&typeof Settings.pageData!="undefined"&&EventTracking.trackEvent(Settings.pageType,"Load",JSON.stringify(Settings.pageData))});gutter=navigator.userAgent.indexOf("Firefox")>0?22:23;$(function(){toggle({toggleOpen:".filter-title",toggleContnent:".filter-list"});toggle({toggleOpen:".language-menu-inner>a",toggleContnent:".more-languages"});initLangMenu();initPebbleConsent()});window.addEventListener("CookieScriptAcceptAll",function(){window._PebbleConsent=!0});window.addEventListener("CookieScriptAccept",function(){window._PebbleConsent=!1;var n=CookieScript.instance.currentState();typeof n!="undefined"&&n.categories.indexOf("targeting")!==-1&&(window._PebbleConsent=!0)})