var inbtwn=function(){var r=location.protocol+"//"+location.hostname+":"+location.port,m=void 0,g=null,n=null,f=null,k=document.querySelector("#popup_box"),p=document.querySelector("#inbetween"),l=document.getElementById("inner-circle"),s={terms_link:0,policy_link:1,third_party_content:2},e={addListenerToAll:function(a,c){Array.prototype.slice.call(document.querySelectorAll(a)).forEach(c)},getParam:function(a){for(var c=location.search.substring(1).split("\x26"),b="",d=0;d<c.length;d++)if(c[d].split("\x3d")[0]==
a)return 1<c[d].split("\x3d").length&&(b=c[d].split("\x3d")[1]),b;return""},getResponse:function(a){var c=document.createElement("script");c.src=a;c.async="async";var b=document.head||document.getElementsByTagName("head")[0]||document.documentElement;c.onload=c.onreadystatechange=function(a){if(!c.readyState||/loaded|complete/.test(c.readyState))c.onload=c.onreadystatechange=null,b&&c.parentNode&&b.removeChild(c),c=void 0};c.onerror=function(){return!1};b.insertBefore(c,b.firstChild);return!0},polarToCartesian:function(a,
c,b,d){d=(d-90)*Math.PI/180;return{x:a+b*Math.cos(d),y:c+b*Math.sin(d)}},describeArc:function(a,c,b,d,e){var f=this.polarToCartesian(a,c,b,e);a=this.polarToCartesian(a,c,b,d);return["M",f.x,f.y,"A",b,b,0,180>=e-d?"0":"1",0,a.x,a.y].join(" ")},getCookie:function(a){return(a=document.cookie.match(new RegExp("(?:^|; )"+a.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,"\\$1")+"\x3d([^;]*)")))?decodeURIComponent(a[1]):void 0},msg:function(a){return!1},alertData:{success:{title:"Your request has been sent",body:"We deleted history from our servers and setted on Opt-out cookie",
icon:""},failed:{title:"Request is not send",body:"Something went wrong, we are looking into the problem",icon:" warning"},pending:{title:"Disabling cookies...",body:"",icon:""}},alert:function(){var a=null,c=null,b=null;return{show:function(d){d='\x3cdiv class\x3d"alert-icon'+d.icon+'"\x3e\x3c/div\x3e\x3cdiv class\x3d"bold-text"\x3e'+d.title+'\x3c/div\x3e\x3cdiv class\x3d"text"\x3e'+d.body+"\x3c/div\x3e";if(a)a.innerHTML=d,c.style.display="block",a.style.display="block";else{c=document.createElement("div");
c.id="alert-overlay";a=document.createElement("div");a.id="alert";a.innerHTML=d;d=document.getElementById("popup_box");var e=document.getElementById("popup_text");d.insertBefore(c,e);d.insertBefore(a,e)}b=window.setTimeout(function(){this.close()}.bind(this),1500)},close:function(){window.clearTimeout(b);a.style.display="none";c.style.display="none"}}}(),createTimer:function(a){var c="";return{start:function(b,d){function e(){f=Math.min((new Date-g)/a,1);b(f);1>f?c=window.setTimeout(e,16):"function"===
typeof d&&d()}var f,g=new Date;e()},stop:function(){window.clearTimeout(c)}}}},q={removeClass:function(a,c){var b=a.getAttribute("class").split(" "),d=b.indexOf(c);-1!==d&&(b.splice(d,1),b=1<b.length?b.join(" "):b,a.setAttribute("class",b))},addClass:function(a,c){var b=a.getAttribute("class"),b=b?b.split(" "):[];-1===b.indexOf(c)&&(b.push(c),b=1<b.length?b.join(" "):b,a.setAttribute("class",b))},unloadPopupBox:function(){clearTimeout(g);this.removeClass(k,"shown");g=setTimeout(function(){k.style.display=
"none"},300);p.style.opacity="1"},loadPopupBox:function(a){g&&clearTimeout(g);for(var c=document.querySelector("#popup_text").querySelectorAll(".terms-text"),b=c.length,d=0;b>d;d++)c[d].style.display="none";k.style.display="block";c[s[a]].style.display="block";g=setTimeout(function(){this.addClass(k,"shown")}.bind(this),10);p.style.opacity=".3"}},h={timer:null,configure:function(a,c){var b=c||3E3;l.style.stroke=a||"#acacac";l.setAttribute("d",e.describeArc(0,0,100,0,0));this.timer=e.createTimer(b);
this.start()},stop:function(){this.timer.stop()},start:function(){this.timer.start(function(a){l.setAttribute("d",e.describeArc(0,0,100,0,360*a))},function(){location.href=f})}},t={createCORSRequest:function(a,c){var b=new XMLHttpRequest;"withCredentials"in b?b.open(a,c,!0):"undefined"!=typeof XDomainRequest?(b=new XDomainRequest,b.open(a,c)):b=null;return b},setOptOut:function(){var a=arguments.length,c=0;e.alert.show(e.alertData.pending);for(var b=0;b<a;b++)this.makeRequest(arguments[b],function(b){b||
(e.alert.close(),e.alert.show(e.alertData.failed));c+=+b;c===a&&(e.alert.close(),e.alert.show(e.alertData.success))},b)},makeRequest:function(a,c,b){if(b=this.createCORSRequest("GET",a))b.open("GET",a,!0),b.withCredentials=!0,b.send(),b.onload=function(){c(!0);console.info("optout installed successfully")},b.onerror=function(){c(!1);console.info("optout was not installed")}}};document.querySelector("#policy").addEventListener("click",function(a){a.preventDefault();"A"==a.target.tagName&&(h.stop(),
q.loadPopupBox(a.target.id));return!1});e.addListenerToAll(".popupBoxClose",function(a){a.addEventListener("click",function(){q.unloadPopupBox();h.start();return!1})});return{init:function(a){n=a.urlToReplace;f=a.urlNoSession;h.configure(a.progressBarColor,3E3);m=a.refDomain;"string"===typeof a.pCleanCookie&&"true"==a.pCleanCookie&&void 0==e.getCookie("icl_opt_out")&&(e.getResponse(r+"/iceleads_rest/merch/optout"),console.info("optout installed successfully"));a=a.pInitUrl+"\x26oem_source\x3d"+a.pOemSource+
"\x26cleanCookie\x3d"+a.pCleanCookie+"\x26callback\x3dinbtwn.response";e.msg("init inbetween url: "+a);e.getResponse(a)},disableCookie:function(a){var c=location.protocol+"//"+location.hostname+"/iceleads_rest/merch/optout";a+="/iceleads_rest/merch/optout";document.cookie.split(";").forEach(function(a){document.cookie=a.replace(/^ +/,"").replace(/=.*/,"\x3d;expires\x3d"+(new Date).toUTCString()+";path\x3d/")});var b=new Date;b.setMonth(b.getMonth()+13);document.cookie="icl_opt_out\x3dtrue;expires\x3d"+
b+";path\x3d/";t.setOptOut(c,a)},response:function(a){void 0!==a.affiliate.session&&(f=n,f=f.replace(/ICL.SESS/g,a.affiliate.session),a=e.getCookie("icl_opt_out")?"":a.affiliate.session,f=m+"/iceleads_rest/merch/"+e.getParam("merch_id")+"/pass?mkey\x3d"+a+"\x26gh_ref\x3d"+encodeURIComponent(f))},stop:h.stop.bind(h)}}();