jQuery(document).ready(function($) {
  var scroll = $(window).scrollTop();
  var scrollup = $('.scroll-top');
  /*------------------------------------------------
            Scroll Top
  ------------------------------------------------*/
  scrollup.click(function () {
    $('html, body').animate({
      scrollTop: '0px'
    }, 800);
    return false;
  });
  $(window).scroll(function () {
    var scroll = $(window).scrollTop();
    if (scroll >= 200) {
      scrollup.fadeIn();
    } else {
      scrollup.fadeOut();
    }
  });
});

// Main Slider
jQuery(document).ready(function () {
  jQuery('.slider-section.owl-carousel').owlCarousel({
    loop: true,
    center: true,
    items: 1,
    margin: 0,
    nav: true,
    dots: false,
    autoplay: true,
    navText: [
      "<i class='fa-solid fa-arrow-left'></i>",
      "<i class='fa-solid fa-arrow-right'></i>"
    ],
    responsive: {
      0: {
        stagePadding: 0
      },
      768: {
        stagePadding: 120
      },
      1200: {
        stagePadding: 250
      }
    }
  });
});

jQuery(function ($) {

  function church_community_initCarousel() {
    var $church_community_carousel = $('.ministries-section .owl-carousel');

    $church_community_carousel.owlCarousel({
      nav: false,
      lazyLoad: true,
      autoplayTimeout: 4000,
      loop: true,
      dots: false,
      center: true,
      autoplayHoverPause: false,
      // autoplay: true,
      mouseDrag: true,
      responsive: {
        0: {
          items: 1,
          margin: 8,
        },
        420: {
          items: 1,
          margin: 12,
        },
        634: {
          items: 1,
          margin: 15,
        },
        768: {
          items: 3,
          margin: 15,
        },
        958: {
          items: 3,
          margin: 18,
        },
        992: {
          items: 3,
          margin: 17,
        },
        1200: {
          items: 3,
          margin:20,
        },
        1567: {
          items: 3,
          margin:25,
        }
      },
      onInitialized: church_community_updateActiveCenter,
      onTranslated: church_community_updateActiveCenter
    });
  }

  function church_community_updateActiveCenter() {
    var $church_community_section = $('.ministries-section');

    $church_community_section.find('.owl-item')
      .removeClass('active-center');

    $church_community_section.find('.owl-item.center')
      .addClass('active-center');
  }
  church_community_initCarousel();
});

// Slider
jQuery(document).ready(function() {
  jQuery('.testimonial-section .owl-carousel').owlCarousel({
    loop: true,
    margin: 20,
    nav: true,
    navText: ["<i class='fa-solid fa-angles-left'></i>", "<i class='fa-solid fa-angles-right'></i>"], 
    dots: true,
    rtl: false,
    responsive: {
    0: { 
      items: 1 
    },
    600: { 
      items: 2 
    },
    992: { 
      items: 3 
    },
    1200: { 
      items: 4 
    }
  },
    autoplay: true,
  });
});

jQuery(document).ready(function() {
  jQuery('.latest-news .owl-carousel').owlCarousel({
    loop: true,
    margin: 40,
    nav: true,
    navText: ["<i class='fa-solid fa-angles-left'></i>", "<i class='fa-solid fa-angles-right'></i>"], 
    dots: false,
    rtl: false,
    responsive: {
    0: { 
      items: 1 
    },
    600: { 
      items: 2 
    },
    992: { 
      items: 3 
    },
    1200: { 
      items: 4 
    }
  },
    autoplay: true,
  });
});