console.log("hello");
window.addEventListener("scroll", function () {
  let navbar = document.getElementById("nav_bar");
  if (window.scrollY > 0) {
    navbar.classList.add("scroll_nav");
    navbar.classList.remove("bg-light");
  } else {
    navbar.classList.add("bg-light");
  }
});

const indicators = document.querySelectorAll(".carousel_btns button");
indicators.forEach((button, index) => {
  button.addEventListener("click", function () {
    indicators.forEach((bttn) => bttn.classList.remove("active"));
    button.classList.add("active");
  });
});

jQuery(document).ready(function ($) {
  $(".owl-one").owlCarousel({
    loop: true,
    autoplay: false,
    nav: true,
    smartSpeed: 500,
    autoplayTimeout: 1000,
    autoplayHoverPause: true,
    center: true,
    margin: 20,
    navSpeed: 500,
    responsive: {
      0: { items: 1, margin: 10 },
      600: { items: 2 },
      1000: { items: 3 },
    },
  });

  $(".owl-listslide").owlCarousel({
    loop: true,
    autoplay: false,
    nav: true,
    dots: false,
    smartSpeed: 500,
    autoplayTimeout: 1000,
    autoplayHoverPause: true,
    center: true,
    margin: 20,
    navSpeed: 500,
    responsive: {
      0: { items: 1, margin: 10 },
      320: { items: 2 },
      768: { items: 3 },
      1000: { items: 3 },
    },
  });

  $(".owl-two").owlCarousel({
    loop: true,
    nav: true,
    dots: false,
    autoplay: false,
    margin: 20,
    smartSpeed: 500,
    padding: 20,
    smartSpeed: true,
    autoplayTimeout: 2000,
    autoplayHoverPause: true,
    navSpeed: 500,
    responsive: {
      0: {
        items: 1,
      },
      600: {
        items: 2,
      },
      1000: {
        items: 3,
      },
    },
  });

  var owl = $(".owl-demo-2");
  owl.owlCarousel({
    autoplay: false,
    items: 4,
    dots: false,
    loop: true,
    nav: true,
    margin: 20,
    responsive: {
      0: { items: 1 },
      480: { items: 2 },
      768: { items: 3 },
      1020: { items: 4 },
    },
    autoplay: true,
    autoplayTimeout: 4000,
  });
  $(".next").click(function () {
    owl.trigger("owl.next");
  });
  $(".prev").click(function () {
    owl.trigger("owl.prev");
  });

  $(".latest-blog-posts .thumbnail.item").matchHeight();

  $("#register-link").click(function () {
    $("#login-box").hide();
    $("#register-box").show();
    $("#forgot-box").hide();
    $("#upload-box").hide();
  });

  $("#login-link").click(function () {
    $("#register-box").hide();
    $("#login-box").show();
    $("#forgot-box").hide();
    $("#upload-box").hide();
  });

  $("#forgot-link").click(function () {
    $("#login-box").hide();
    $("#register-box").hide();
    $("#forgot-box").show();
    $("#upload-box").hide();
  });

  $("#back-link").click(function () {
    $("#forgot-box").hide();
    $("#login-box").show();
  });

  $("#login-btn").click(function (event) {
    event.preventDefault();
    $("#login-box").hide();
    $("#upload-box").show();
  });

  $("#login-link").click(function () {
    $("#upload-box").hide();
    $("#login-box").show();
  });
});
