(()=>{const e=function(){const e=document.querySelector(".js-language-switcher"),t=document.querySelector(".js-contact-form"),o=document.querySelector(".js-contact-form-button"),n=document.querySelector(".js-status-ok"),c=document.querySelector(".js-status-error"),a=e=>{console.log("switchhh");const t=e.target.dataset.lang,o=document.querySelector("html").getAttribute("lang");window.location=t!==o&&"en"===t?"/en":"/",localStorage.setItem("preferredLanguage",t)},r=e=>{e.preventDefault(),console.log("Submit contact form");let a=new URLSearchParams(new FormData(document.querySelector(".js-contact-form")));o.disabled=!0,c.classList.add("hide"),s(t.action,a).then((e=>{e&&e.success?(t.classList.add("hide"),n.classList.remove("hide")):(o.disabled=!1,c.classList.remove("hide"))})).catch((e=>{console.log("error"),console.log(e),o.disabled=!1,c.classList.remove("hide")}))},s=async(e="",t={})=>(await fetch(e,{method:"POST",mode:"cors",cache:"no-cache",headers:{"Content-type":"application/x-www-form-urlencoded; charset=UTF-8","Sec-Fetch-Dest":"empty"},body:t}),{success:!0});return{init:function(){e&&e.addEventListener("click",a),t&&t.addEventListener("submit",r),(e=>{const t=/de/.test(e),o=document.querySelector("html").getAttribute("lang"),n=localStorage.getItem("preferredLanguage");if(null!==n&&"de"!==n&&"en"!==n)return!1;null===n?"de"!==o||t||(window.location="/en"):n!==o&&(window.location="de"===n?"/":"/en")})(navigator.language)},otherpub:function(){}}}();document.addEventListener("DOMContentLoaded",(function(){function t(e){let t=`; ${document.cookie}`.split(`; ${e}=`);if(2===t.length)return t.pop().split(";").shift()}if(e.init(),"true"!==t("managed_cookies")&&window.location.host.match(/iversity.org/)){const e=document.querySelector("html").getAttribute("lang");let t=document.createElement("iframe");t.classList.add("ck-iframe"),t.setAttribute("frameborder","0"),t.setAttribute("src",`https://iversity.org/${e}/ck`),document.querySelector("body").append(t),window.addEventListener("message",(e=>{"https://iversity.org"===e.origin&&"reloadForCookies"===e.data&&window.location.reload()}),!1)}else"true"===t("tracking_cookies")&&window.location.host.match(/iversity.org/)&&(console.log("add tracking"),o=window,n=document,c="script",a="ga",o.GoogleAnalyticsObject=a,o[a]=o[a]||function(){(o[a].q=o[a].q||[]).push(arguments)},o[a].l=1*new Date,r=n.createElement(c),s=n.getElementsByTagName(c)[0],r.async=1,r.src="https://www.google-analytics.com/analytics.js",s.parentNode.insertBefore(r,s),ga("create","UA-4103478-14","auto"),ga("send","pageview"));var o,n,c,a,r,s}))})();