function toggleMenu(){

var menu = document.getElementById("mobileMenu");

menu.classList.toggle("active");

}


/* =========================
SLIDER SYSTEM
========================= */

let slideIndex = 0;

function showSlide(index){

let slides = document.querySelectorAll(".slide");

if(slides.length === 0) return;

/* reset all slides */

slides.forEach(function(slide){
slide.classList.remove("active");
});

/* activate slide */

slides[index].classList.add("active");

}


/* AUTO SLIDER */

function startSlider(){

let slides = document.querySelectorAll(".slide");

if(slides.length === 0) return;

slideIndex++;

if(slideIndex >= slides.length){
slideIndex = 0;
}

showSlide(slideIndex);

setTimeout(startSlider,4000);

}


/* NEXT BUTTON */

function nextSlide(){

let slides = document.querySelectorAll(".slide");

slideIndex++;

if(slideIndex >= slides.length){
slideIndex = 0;
}

showSlide(slideIndex);

}


/* PREVIOUS BUTTON */

function prevSlide(){

let slides = document.querySelectorAll(".slide");

slideIndex--;

if(slideIndex < 0){
slideIndex = slides.length - 1;
}

showSlide(slideIndex);

}


document.addEventListener("DOMContentLoaded", function(){

showSlide(0);

startSlider();

});