let slideIndex = 1;
showSlides(slideIndex);

function nextSlide() {
    showSlides(slideIndex += 1);
}

function previousSlide() {
    showSlides(slideIndex -= 1);
}

function currentSlide(n) {
    showSlides(slideIndex = n);
}

function showSlides(n) {
    let slider      = document.getElementsByClassName("slidepics");
    let slider_dots = document.getElementById("js-slider-dots").children;

    if (n > slider.length) {
      slideIndex = 1
    }

    if (n < 1) {
        slideIndex = slider.length
    }

    for (i = 0; i < slider.length; i++) {
        slider[i].style.display = "none";
        slider_dots[i].classList.remove("active")
    }

    slider[slideIndex - 1].style.display = "block";
    slider_dots[slideIndex - 1].classList.add("active")
}