function loadimgPost(){document.querySelectorAll(".prodottos .image .imgcont:not(.loaded)").forEach(n=>{n.addEventListener("scroll",t=>{n.classList.contains("loading")&&t.preventDefault(),n.classList.contains("loaded")||(t.preventDefault(),n.classList.add("loading"),n.classList.add("loaded"),fetch("/wact.asmx/prodottoimg?page_id_name="+n.id.replace("img","")+"&lan=it").then(n=>n.text()).then(t=>{n.insertAdjacentHTML("beforeend",t);var i=window.setInterval(()=>{var t=!0;n.querySelectorAll("img").forEach(n=>{!n.complete&&n.naturalWidth>0&&(t=!1)});t&&(window.clearInterval(i),window.setTimeout(()=>{n.scroll({left:n.scrollWidth/n.querySelectorAll("img").length,top:0,behavior:"smooth"}),n.classList.remove("loading")},500))},500)}))})})}function chiudi_filtri(){document.querySelectorAll("ul[data-type]").forEach(n=>{n.classList.add("hidden")});document.querySelectorAll("strong[data-type]").forEach(n=>{n.classList.add("closed")})}function resettalis(){document.querySelectorAll("ul[data-type] li:not(.ricerca):not(.close)").forEach(n=>{n.style.display="block"});document.querySelectorAll("ul[data-type] li:not(.ricerca):not(.close) ul li").forEach(n=>{n.style.display="block"})}function binricerca_filtri(){document.querySelectorAll(".ricerca input").forEach(n=>{n.addEventListener("keyup",function(){for(var t=this,n=this;n.tagName!=="UL";)n=n.parentNode;t.value.length>0?(n.querySelectorAll("li:not(.ricerca)").forEach(n=>{n.querySelector("a")&&(n.style.display=n.querySelector("a").innerText.toLowerCase().indexOf(t.value.toLowerCase())!=0?"none":"block")}),n.querySelectorAll("li:not(.ricerca) ul li").forEach(n=>{n.querySelector("a")&&(n.querySelector("a").innerText.toLowerCase().indexOf(t.value.toLowerCase())!=0?n.style.display="none":(n.style.display="block",n.parentNode.parentNode.style.display="block"))})):resettalis()})})}function showtipo(n,t,i,r="cart"){var f,u;if(n&&n.preventDefault(),r=="cart"||loggato)if(r=="cart"||chekwishlist(t))bgff.classList.add("in"),fixbody(!0),f=document.getElementById("dispocatalogo"),f.innerHTML="",u=new XMLHttpRequest,u.open("GET","/wact.asmx/prodottovarianti?lan="+i+"&page_id_name="+t),u.onload=function(){f.innerHTML=u.responseText;f.classList.add("open");r!="cart"&&(document.getElementById("addtipofix").innerHTML='<i class="fa fa-heart"><\/i> '+document.getElementById("addtipofix").innerText);var n=document.querySelectorAll(".combinazionisel");n.forEach(t=>{var i=t.querySelectorAll("ul li");i.length>0?i.forEach(t=>{t.addEventListener("click",()=>{t.querySelector("input").click(),check_combinazioni(n)})}):t.addEventListener("change",function(){check_combinazioni(n)},{passive:!0})});document.querySelector("#contaniertipo .photocontainer .image")&&window.setTimeout(function(){document.querySelector("#contaniertipo .photocontainer .image").scrollTo(0,0)},500)},u.send();else return;else{fill_user_form();return}}function check_combinazioni(n){var r=!0,t=[],u,i;n.forEach(n=>{if(n.nodeName=="UL"){var i=n.querySelector("input:checked");i&&t.push(i.value)}else n.value==-1&&(r=!1),t.push(n.value)});t.sort();u=t.join("_");r&&(i=document.querySelector('[data-combi="'+u+'"]'),i&&eval(i.getAttribute("onclick")))}function checkdescs(){var n=window.location.href;n=window.location.href.indexOf("?")>=0?window.location.href+"&solocont=1":window.location.href+"?solocont=1";fetch(n).then(function(n){return n.text()}).then(function(n){var o=new DOMParser,t=o.parseFromString(n,"text/html");const r=t.querySelector("breadcrumb"),u=t.querySelector("catalogolist"),f=t.querySelector("titolo"),e=t.querySelector("dovebrand");e&&(document.querySelector("#catpresenti").innerHTML=e.innerHTML);myLazyLoad.update();r&&(document.querySelector(".breadcrumb").innerHTML=r.innerHTML);u&&(document.querySelector("#_catalogolist").innerHTML=u.innerHTML,document.querySelector("#maincontent h1").innerText=t.querySelector("h1").innerText,document.querySelector("#_catalogolist").innerHTML.length>200?document.querySelector("#_catalogolist").classList.add("mobilecut"):document.querySelector("#_catalogolist").classList.remove("mobilecut"));f&&(document.title=f.innerText);const i=document.querySelector(".mobilecut");i&&i.addEventListener("click",function(){i.classList.toggle("open")})})}function updateQueryStringParameter(n,t,i){var r=new RegExp("([?&])"+t+"=.*?(&|$)","i"),u=n.indexOf("?")!==-1?"&":"?";return n.match(r)?n.replace(r,"$1"+t+"="+i+"$2"):n+u+t+"="+i}function initpage(){!istouch&&window.innerWidth>=600&&filtri("desktop");const n=document.getElementById("selectorder");n&&n.addEventListener("change",function(){const n=updateQueryStringParameter(window.location.href,"order",this.value);window.location.href=n});chiudif();var t=document.getElementById("mobilefiltershow");t!=null&&t.addEventListener("click",function(){document.body.classList.add("noscroll");filtri("mobie");columnleft.classList.add("mobi")})}function caricainfinito(){var n=document.getElementById("moreprods");n&&observer.observe(n)}function altriprodotti(){totalpr>0&&totalpr>scroller&&window.location.href.indexOf("page=")<=0&&(postumi(),scroller=totalpr)}function filtri(n){var t,i;if(document.getElementById("selectorder")){if(t=window.location.href,t.indexOf("page=")>0)return;t=t.replace(".pager","").replace("#","");t.indexOf("page=")>0&&(t=t.substring(-t.indexOf("page=")-1));t=t.indexOf("?")>0?t+"&":t+"?";t=t.indexOf(".html")>0?t.replace(".html",".pager.html"):t.indexOf(".htm")>0?t.replace(".htm",".pager.htm"):t.replace("?",".pager?");t+="&filtri=1";i=new XMLHttpRequest;i.open("GET",t+"&tipofiltro="+n);i.onload=function(){if(i.status===200){var t=document.querySelector("#nores"),n=document.querySelector(".filternav");if(i.responseText.indexOf('"res-tit">0<\/span>')<0){const t=document.getElementById("cercaspeciale");t!=null&&i.responseText.indexOf("cercaspeciale")<0?(n.innerHTML=t.outerHTML+i.responseText,document.getElementById("nores").style.display="block"):n&&(n.innerHTML=i.responseText);bindchiudi();linkajax()}else t!=null&&(t.style.display="block");document.getElementById("columnleft")&&(i.responseText.indexOf("cercaspeciale")<0&&document.getElementById("cercaspeciale")==null?document.getElementById("columnleft").classList.remove("moto"):document.getElementById("columnleft").classList.add("moto"))}};i.send()}}function postumi(){var r=1,n,u,t,i;r+=parseInt(totalpr);n=window.location.href;n=n.replace("#","");n.indexOf("page=")>0&&(n=n.substring(-n.indexOf("page=")-1));n=n.indexOf("?")>0?n+"&":n+"?";n=n.indexOf(".html")>0?n.replace(".html",".pager.html"):n.indexOf(".htm")>0?n.replace(".htm",".pager.htm"):n.replace("?",".pager?");n=n+"page="+r;totalpr!=jload?(u=document.querySelector(".panel-body"),t=document.createElement("div"),t.classList.add("col-xs-12"),t.classList.add("text-center"),t.classList.add("moreprods"),t.innerHTML='<img class="responsive" src="/img/imgload_dark.svg" alt="loading">',u.appendChild(t),i=new XMLHttpRequest,i.open("GET",n),i.onload=function(){var n,u,f,o,e,t,s;if(i.status===200){for(n=document.querySelector(".moreprods"),n.parentNode.removeChild(n),u=document.createElement("div"),u.innerHTML=i.responseText,f=u.querySelector("#cont"),f!=null?(o=document.querySelector(".panel-body"),o.insertAdjacentHTML("beforeend",f.innerHTML),myLazyLoad&&myLazyLoad.update(),totalpr=r):(totalpr=totalpr,document.getElementById("moreprods").style.display="none",observer.unobserve(document.getElementById("moreprods"))),localStorage.setItem("__oldpage",totalpr),e=document.querySelectorAll(".nuovi"),t=0,s=e.length;t<s;t++)n=e[t],n.classList.remove("nuovi"),n.addEventListener("click",function(){localStorage.setItem("__"+window.location.href,document.querySelector("#prodcontainer").innerHTML);localStorage.setItem("scrollpos",window.scrollY)});loadimgPost()}},i.send(),jload=totalpr):document.getElementById("moreprods").classList.add("hidden")}function chiudif(){var n=document.querySelector("#columnleft #risultati");n?chiudi_finestra_filtri(n):(n=document.querySelector("#columnleft .fa-close"),n&&chiudi_finestra_filtri(n))}function chiudi_finestra_filtri(n){n.addEventListener("click",function(){columnleft.classList.remove("mobi");bgff.classList.remove("in");fixbody(!1)})}function bindchiudi(){desktoptrack();window.addEventListener("click",function(n){n.target.tagName!="INPUT"&&chiudi_filtri()},{passive:!1});chiudif();document.querySelectorAll("ul[data-type] .close").forEach(n=>{n.addEventListener("click",t=>{t.stopPropagation();var i=n.parentNode,r=i.getAttribute("data-type");i.classList.add("hidden");document.querySelectorAll("ul[data-type]").forEach(t=>{t.getAttribute("data-type")!=n.getAttribute("data-type")&&t.classList.add("hidden")});document.querySelector("#columnleft strong[data-type='"+r+"']").classList.add("closed")})});document.querySelectorAll("#columnleft strong").forEach(n=>{var t=document.querySelector("ul[data-type='"+n.getAttribute("data-type")+"']");t&&n.addEventListener("click",i=>{i.stopPropagation(),document.querySelectorAll("ul[data-type]").forEach(t=>{t.getAttribute("data-type")!=n.getAttribute("data-type")&&t.classList.add("hidden")}),document.querySelectorAll("#columnleft strong").forEach(t=>{t.getAttribute("data-type")!=n.getAttribute("data-type")&&t.classList.add("closed")}),t.classList.toggle("hidden"),n.classList.toggle("closed"),document.getElementById("columnleft").scrollTop=0})});binricerca_filtri()}var scroller,plac,savesearch,sy,elementsArray,i,len,bindanalytics,desktoptrack;loadimgPost();const banner=document.querySelector(".mobilecut");banner&&banner.addEventListener("click",function(){banner.classList.toggle("open")});var linkajax=function(){var t,n,i;for(totalpr=1,scroller=0,jload=0,document.getElementById("filtriapertimobile").innerHTML=document.querySelector(".torem")?document.querySelector(".torem").innerHTML:"",t=document.querySelectorAll("#columnleft li a,.torem a,#filtriapertimobile a"),caricainfinito(),n=0,i=t.length;n<i;n++)link=t[n],link.getAttribute("href")!="/"&&link.addEventListener("click",function(n){var r,e;n.stopPropagation();n.preventDefault();document.querySelector("#columnleft").classList.add("loading");var i=new XMLHttpRequest,f=this.querySelector("input"),t=this.href,u=null;if(f){for(f.checked=f.cheked?!1:!0,r=this;r.tagName!=="UL";)r=r.parentNode;u=r.dataset.type}t=t.replace("#","").replace(".pager","");e="mobile";t.indexOf("filtri=1")<0&&(t+=t.indexOf("?")>0?"&filtri=1":"?filtri=1");t=t.indexOf(".html")>0?t.replace(".html",".pager.html"):t.indexOf(".htm")>0?t.replace(".htm",".pager.htm"):t.replace("?",".pager?");i.open("GET",t+"&tipofiltro="+e);i.onload=function(){var t,o,s,n,r,f,e;document.querySelector("#columnleft").classList.remove("loading");t=i.responseURL.replace("?filtri=1&","?").replace("?filtri=1","").replace("?tipofiltro=mobile","").replace("?tipofiltro=mobie","").replace("?tipofiltro=desktop","").replace("&filtri=1","").replace(".pager","").replace("&tipofiltro=mobile","");window.history.replaceState("","",t);o="?";t.indexOf("?")>0&&(o="&");s=i.responseText;n=document.createElement("div");n.innerHTML=s;trovati=n.querySelector("#res-tit").innerHTML;u&&(r=n.querySelector("strong[data-type='"+u+"']"),f=n.querySelector("ul[data-type='"+u+"']"),r&&f&&(r.classList.remove("closed"),f.classList.remove("hidden")));const h=n.querySelector("#newfiltri").innerHTML;e=document.querySelector("#nores");h!=""?document.querySelector(".filternav").innerHTML=n.querySelector("#newfiltri").innerHTML:e&&(e.style.display="block");i.responseText.indexOf("cercaspeciale")<0&&document.getElementById("cercaspeciale")==null?document.getElementById("columnleft").classList.remove("moto"):document.getElementById("columnleft").classList.add("moto");document.getElementById("prodcontainer").innerHTML=n.querySelector("#newprod").innerHTML;document.querySelector("#mobilefiltershow small").innerHTML="("+document.querySelectorAll(".torem a").length+" attivi )";document.querySelector("#risultati_ordine span e").innerHTML=n.querySelector("#res-tit").innerHTML;myLazyLoad.update();checkdescs();linkajax();bindchiudi()};i.send()})},ifiltri=document.querySelector(".filternav"),container=document.querySelector(".box-product"),containeroffset=0;container&&(containeroffset=container.getBoundingClientRect().top);scroller=0;plac="/img/imgload.svg";jload=0;totalpr=1;savesearch="Vedi i risultati";_lingua!="it"&&(savesearch="Go to results");var attuale="",oldhtml=localStorage.getItem("__"+window.location.href),oldpage=localStorage.getItem("__oldpage");if(oldhtml){for(totalpr=oldpage,initpage(),document.querySelector("#prodcontainer").innerHTML=oldhtml,myLazyLoad&&myLazyLoad.update(),sy=parseInt(localStorage.getItem("scrollpos")),window.scrollTo(0,sy),elementsArray=document.querySelectorAll(".prodottos"),i=0,len=elementsArray.length;i<len;i++)elem=elementsArray[i],elem.addEventListener("click",function(){localStorage.setItem("__"+window.location.href,document.querySelector("#prodcontainer").innerHTML);localStorage.setItem("scrollpos",window.scrollY)});localStorage.removeItem("scrollpos");localStorage.removeItem("__oldpage");localStorage.removeItem("__"+window.location.href);window.location.href.indexOf("page=")<=0&&postumi()}initpage();bindanalytics=function(n){window.ga?ga(function(){tracker=ga.getAll()[0];tracker&&tracker.send({hitType:"event",eventCategory:"UX",eventAction:"Filtri",eventLabel:document.title+"=>"+n})}):checkIfAnalyticsLoaded()};const observer=new IntersectionObserver(n=>{n.forEach(n=>{n.isIntersecting&&altriprodotti()})},{root:null,rootMargin:"0px 0px -400px 0px",threshold:1});caricainfinito();desktoptrack=function(){for(var t=document.querySelectorAll("#columnleft ul.filtri li a"),n=0,i=t.length;n<i;n++)link=t[n],link.addEventListener("click",function(){bindanalytics(this.innerText)})};