const countDown = document.getElementById('countdown');

const categories = (e, TabCategories) => {
  let tablinks;
  let tabCategory = document.getElementsByClassName("category");

  for (let i = 0; i < tabCategory.length; i++) {
    tabCategory[i].style.display = "none";
  }
  tablinks = document.getElementsByClassName("raffle__tab-category");
  for (let i = 0; i < tablinks.length; i++) {
    tablinks[i].className = tablinks[i].className.replace(" active", "");
  }

  e.currentTarget.className += " active";
  document.getElementById(TabCategories).style.display = "block";
};

// Create function for Countdown
const getCountDown = (redirect, second = 1, count = 5) => {
  const ms = 1000;
  let sec = ms * second;
  const timer = setInterval(() => {
    countDown.textContent = count;
      if ( count === 0) {
        clearInterval(timer);
        window.location.href = redirect;
      } 
    count--;
  }, sec);
};


// create function for active
// const categories = (TabCategories) => {
//   let category = document.getElementsByClassName("category");
//   let activeTab = document.getElementById(TabCategories);
//   for (let i = 0; i < category.length; i++) {
//     category[i].className = category[i].className.replace(" active", "");
//     category[i].style.display = "none";
//   }
//   activeTab.className += " active";
//   document.getElementById(TabCategories).style.display = "block";

// };
