(function ($) {
    "use strict";

    // Back to top button
    $(window).scroll(function () {
        if ($(this).scrollTop() > 100) {
            $('.back-to-top').fadeIn('slow');
        } else {
            $('.back-to-top').fadeOut('slow');
        }
    });
    $('.back-to-top').click(function () {
        $('html, body').animate({scrollTop: 0}, 1500, 'easeInOutExpo');
        return false;
    });

    // Smooth scroll to contacts section
    $('.contact-scroll').click(function (e) {
        e.preventDefault();

        $('html, body').animate({
            scrollTop: $('#contacts-section').offset().top
        }, 1000, 'easeInOutExpo');
    });
  
})(jQuery);


document.addEventListener("DOMContentLoaded", function(){

    const reviews = document.querySelectorAll(".review-item");
    let index = 0;

    function showReview(i){
        reviews.forEach(r => r.classList.remove("active"));
        reviews[i].classList.add("active");
    }

    document.getElementById("nextReview").onclick = function(){
        index = (index + 1) % reviews.length;
        showReview(index);
    };

    document.getElementById("prevReview").onclick = function(){
        index = (index - 1 + reviews.length) % reviews.length;
        showReview(index);
    };

});

