text: function handleSubmit(event) {
      event.preventDefault();
  
      const email = document.getElementById('email').value.trim();
      const subject = document.getElementById('subject').value.trim();
      const message = document.getElementById('message').value.trim();
  
      const data = {
          email,
          subject,
          message
      };
  
      fetch("/email/send", {
          method: "POST",
          body: JSON.stringify(data),
          headers: {
              "Content-Type": "application/json",
              "Access-Control-Allow-Origin": "*"
          }
      }).then(body => body.json()).then(res => {
          if (res.status === "ok") {
              switch (getCookie("lang")) {
                  case "fr":
                      alert("Email envoyé!");
                      break;
                  default:
                      alert("Email successfully sent!");
                      break;
              }
          } else {
              var errorDiv = document.createElement("DIV");
              errorDiv.classList.add("center");
              errorDiv.style.margin = "auto 40% auto 40%";
              errorDiv.style.backgroundColor = "#ffcccc";
              errorDiv.style.border = "2px solid #ff3333";
              errorDiv.style.width = "50%;";
              errorDiv.id = "error";
              var errorSpan = document.createElement("SPAN");
              errorSpan.classList.add("center");
              errorSpan.style.margin = "50% 10px 10px 10px;";
              errorSpan.innerHTML = res.error;
              errorDiv.appendChild(errorSpan);
              if (!document.getElementById("error")) document.getElementById("emailForm").appendChild(errorDiv);
          }
      });
  }
  
  function displayNavbar2() {
      var dropdown = document.getElementsByClassName("dropdown-content")[0];
  
      switch (dropdown.style.display) {
          case "block":
              dropdown.style.display = "none";
              break;
          case "none":
              dropdown.style.display = "block";
              break;
          default:
              dropdown.style.display = "none";
              break;
      }
  }
  
  function shrinkHeader() {
      var header = document.getElementsByClassName("header")[0];
      if (scrollY > 40) {
          if (window.innerWidth > 900) {
              document.querySelector(":root").style.setProperty("--headerHeight", "calc(3vw + 3vh)");
          }
      } else {
          if (window.innerWidth > 900) {
              document.querySelector(":root").style.setProperty("--headerHeight", "calc(4vw + 4vh)");
          }
      }
  }
  
  function handleLang(lang) {
      setCookie("lang", lang);
      window.location.reload();
  }
  
  function getCookie(name) {
      var nameEQ = name + "=";
      var ca = document.cookie.split(';');
      for (var i = 0; i < ca.length; i++) {
          var c = ca[i];
          while (c.charAt(0) == ' ') c = c.substring(1, c.length);
          if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
      }
      return null;
  }
  
  function setCookie(name, value, days) {
      var expires = "";
      if (days) {
          var date = new Date();
          date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
          expires = "; expires=" + date.toUTCString();
      }
      document.cookie = name + "=" + (value || "") + expires + "; path=/";
  }