if (document.getElementById('menu') != null) {
    var menu = document.getElementById("menu")

    document.getElementById("hamburgermenu").addEventListener("click", () => {
        menu.style.display = "flex";
        document.body.style.overflow = "hidden"
    })

    document.getElementById("close").addEventListener("click", () => {
        menu.style.display = "none";
        document.body.style.overflow = "auto"
    })
    document.querySelectorAll('.menu-item').forEach(anchor => {
        anchor.addEventListener('click', function (e) {
            menu.style.display = "none";
            document.body.style.overflow = "auto"
        });
    });
}
// When the user scrolls the page, execute myFunction
window.onscroll = function () { myFunction() };

// Get the header
var header = document.getElementById("myHeader");

// Get the offset position of the navbar
var sticky = header.offsetTop;

// Add the sticky class to the header when you reach its scroll position. Remove "sticky" when you leave the scroll position
function myFunction() {
    if (window.scrollY > sticky) {
        header.classList.add("sticky");
    } else {
        header.classList.remove("sticky");
    }
}
var swiper = new Swiper(".mySwiper", {
    pagination: {
        el: ".swiper-pagination",
    },
    navigation: {
        nextEl: ".swiper-button-next",
        prevEl: ".swiper-button-prev",
    },
    slidesPerView: 1,
    loop: true,
    autoplay: {
        delay: 10000,
    },
});

document.querySelectorAll('a[href^="#"]').forEach(anchor => {
    anchor.addEventListener('click', function (e) {

        document.querySelector(this.getAttribute('href')).scrollIntoView({
            behavior: 'smooth'
        });
    });
});