(function(){
  function initFinalSlider(){
    document.documentElement.style.overflowY='auto';
    document.body.style.overflowY='auto';
    document.body.style.position='static';
    document.querySelectorAll('.home-hero-slider').forEach(function(slider){
      if(slider.dataset.finalPolished==='1') return;
      var clone=slider.cloneNode(true);
      clone.dataset.finalPolished='1';
      slider.parentNode.replaceChild(clone, slider);
      var slides=[].slice.call(clone.querySelectorAll('.slide'));
      if(!slides.length) return;
      var index=0;
      slides.forEach(function(s,i){s.classList.toggle('active',i===0);});
      if(slides.length>1){
        setInterval(function(){
          slides[index].classList.remove('active');
          index=(index+1)%slides.length;
          slides[index].classList.add('active');
        },5600);
      }
    });
  }
  if(document.readyState==='loading') document.addEventListener('DOMContentLoaded',function(){setTimeout(initFinalSlider,120);});
  else setTimeout(initFinalSlider,120);
})();
