function kitchen_interior_design_openNav() {
  jQuery(".sidenav").addClass('show');
}
function kitchen_interior_design_closeNav() {
  jQuery(".sidenav").removeClass('show');
}

( function( window, document ) {
  function kitchen_interior_design_keepFocusInMenu() {
    document.addEventListener( 'keydown', function( e ) {
      const kitchen_interior_design_nav = document.querySelector( '.sidenav' );

      if ( ! kitchen_interior_design_nav || ! kitchen_interior_design_nav.classList.contains( 'show' ) ) {
        return;
      }
      const elements = [...kitchen_interior_design_nav.querySelectorAll( 'input, a, button' )],
        kitchen_interior_design_lastEl = elements[ elements.length - 1 ],
        kitchen_interior_design_firstEl = elements[0],
        kitchen_interior_design_activeEl = document.activeElement,
        tabKey = e.keyCode === 9,
        shiftKey = e.shiftKey;

      if ( ! shiftKey && tabKey && kitchen_interior_design_lastEl === kitchen_interior_design_activeEl ) {
        e.preventDefault();
        kitchen_interior_design_firstEl.focus();
      }

      if ( shiftKey && tabKey && kitchen_interior_design_firstEl === kitchen_interior_design_activeEl ) {
        e.preventDefault();
        kitchen_interior_design_lastEl.focus();
      }
    } );
  }
  kitchen_interior_design_keepFocusInMenu();
} )( window, document );

var kitchen_interior_design_btn = jQuery('#button');

jQuery(window).scroll(function() {
  if (jQuery(window).scrollTop() > 300) {
    kitchen_interior_design_btn.addClass('show');
  } else {
    kitchen_interior_design_btn.removeClass('show');
  }
});

kitchen_interior_design_btn.on('click', function(e) {
  e.preventDefault();
  jQuery('html, body').animate({scrollTop:0}, '300');
});

jQuery(document).ready(function(){
  var owl = jQuery('.main-carousel');

  owl.owlCarousel({
    items: 1,
    loop: true,
    margin: 10,
    nav: true,
    dots: false,
    navText : ["<i class='fas fa-chevron-left'></i>","<i class='fas fa-chevron-right'></i>"]
  });

  // Update custom navigation with preview images
  function updateNavArrows() {
    var totalItems = owl.find('.owl-item').length;

    // Get indices for previous and next items
    var currentIndex = owl.find('.owl-item.active').index();

    var prevIndex = (currentIndex - 1 + totalItems) % totalItems;

    var nextIndex = (currentIndex + 1) % totalItems;

    // Set the preview images for prev and next arrows
    jQuery('.owl-prev').html(
      '<img src="' + owl.find('.owl-item').eq(prevIndex).find('img').attr('src') + '" alt="Previous">'
    );
    jQuery('.owl-next').html(
      '<img src="' + owl.find('.owl-item').eq(nextIndex).find('img').attr('src') + '" alt="Next">'
    );
  }

  // Update nav arrows on initialization and after each change
  updateNavArrows();

  owl.on('translated.owl.carousel', updateNavArrows)
  
});

  jQuery('document').ready(function(){

    var owl = jQuery('.featured .owl-carousel');
    owl.owlCarousel({
    margin: 30,
    nav:false,
    autoplay : true,
    lazyLoad: true,
    autoplayTimeout: 5000,
    loop: true,
    center:true,
    dots: false,
    navText : ['<i class="fa fa-lg fa-chevron-left" aria-hidden="true"></i>','<i class="fa fa-lg fa-chevron-right" aria-hidden="true"></i>'],
    responsive: {
      0: {
        items: 1
      },
      576: {
        items: 1
      },
      768: {
        items: 2
      },
      991: {
        items: 2
      },
      1020: {
        items: 3
      },
      1200: {
        items: 3
      }
    },
    autoplayHoverPause : false,
    mouseDrag: true
  });
  });

window.addEventListener('load', (event) => {
  jQuery(".loading").delay(2000).fadeOut("slow");
  jQuery(".loading2").delay(2000).fadeOut("slow");
});

jQuery('.header-search-wrapper .search-main').click(function(){
  jQuery('.search-form-main').toggleClass('active-search');
  jQuery('.search-form-main .search-field').focus();
});

jQuery(window).scroll(function() {
  var data_sticky = jQuery('.main-header').attr('data-sticky');

  if (data_sticky == "true") {
    if (jQuery(this).scrollTop() > 1){
      jQuery('.main-header').addClass("stick_header");
    } else {
      jQuery('.main-header').removeClass("stick_header");
    }
  }
});