window.addEventListener("scroll", function () {
  const header = document.querySelector(".main-header");
  if (window.scrollY > 50) {
    header.classList.add("scrolled");
  } else {
    header.classList.remove("scrolled");
  }
});
/*****************************************************/
$("#owl-slider").owlCarousel({
    loop: true,
    margin: 0,
    nav: true,
    items: 1,
    autoplay: true,
    autoplayTimeout: 4000,
    autoplayHoverPause: true
  });
/*****************************************************/
/*ar swiper = new Swiper(".swiper", {
  effect: "cards",
  grabCursor: true,
  initialSlide: 2,
  speed: 500,
  loop: true,
  rotate: true,
  mousewheel: {
    invert: false,
  },
  autoplay: {
    delay: 250,
  },
});*/
/*****************************************************/
$(window).on('load', function () {
 });
 setTimeout(function () {
    $("#loader-wrapper").fadeOut();
    $("#loader-wrapper").delay(200).fadeOut("slow");
}, 200);
/*****************************************************/
var Accordion = function(el, multiple) {
  this.el = el || {};
  this.multiple = multiple || false;
  var links = this.el.find('.link');
  links.on('click', {el: this.el, multiple: this.multiple}, this.dropdown)
}
 Accordion.prototype.dropdown = function(e) {
    var $el = e.data.el;
    $this = $(this),
    $next = $this.next();
    $next.slideToggle();
    $this.parent().toggleClass('open');
    if (!e.data.multiple) {
        $el.find('.submenu').not($next).slideUp().parent().removeClass('open');
    };
  }	
 var accordion = new Accordion($('#accordion'), false);
/*****************************************************/
 $(window).scroll(function () {
  if ($(this).scrollTop() > 100) {
  $('.scrollup').fadeIn();
  } else {
  $('.scrollup').fadeOut();
 }});
  $('.scrollup').click(function () {
  $("html, body").animate({
  scrollTop: 0}, 50);
  return false;   
});
/*****************************************************/
$(window).scroll(function() {
  if ($(this).scrollTop() > 1){  
      $('.site-navigation').addClass("stickyHeader");
  }
  else{
     $('.site-navigation').removeClass("stickyHeader");
  }
});
/***********************************************/
$("#mobileOwlSlider").owlCarousel({
  items: 1,
  loop: true,
  autoplay: true,
  autoplayTimeout: 3500,
  autoplayHoverPause: false,
  nav: true,
  dots: true,
  margin: 0,
  video: true,
  navText: [
    '<i class="fa-solid fa-chevron-left"></i>',
    '<i class="fa-solid fa-chevron-right"></i>'
  ]
});
