//! jaccueil.js

window.addEventListener('DOMContentLoaded', (event) => {
  console.log('#');

  let elBtnExtractTPG = document.getElementById("btnExtractTPG");

  let clickExtractTPG = function () {
    if (confirm("Voulez-vous extraire la dernière version du tarif public général ?")) {
      let url = "/expxls/export_tpg";
      console.log("Export Excel demandé : " + url);
      window.open(url);
      return false;
    }
  }

  const diaporamaImages = document.querySelectorAll('.diaporama img');
  let imageIndex = 0;

  setInterval(() => {
    diaporamaImages[imageIndex].classList.remove('active');
    imageIndex = (imageIndex + 1) % diaporamaImages.length;
    diaporamaImages[imageIndex].classList.add('active');
  }, 5000);


  elBtnExtractTPG.addEventListener('click', clickExtractTPG);
});
