(function($) {

  $("#hamburger-menu").click(function(event) {
    event.stopPropagation();
    $(".header-navigation").addClass("open");

  });

    $(".close-menu").click(function(event) {
    event.stopPropagation();
    $(".header-navigation").removeClass("open");

  });

  $("#hamburger-menu").keypress(function(e) {
    var key = e.which;
    if (key == 13) // the enter key code
    {
      $(".header-navigation").addClass("open");
    }
  });

  $(".close-menu").keypress(function(e) {
    var key = e.which;
    if (key == 13) // the enter key code
    {
      $(".header-navigation").removeClass("open");
    }
  });


$('.small-banner-wrap.twocolumn:not(.slick-initialized').slick({
    slidesToShow: 2,
    slidesToScroll: 1,
    speed: 500,
    autoplay: true,
    arrows: false,
    responsive: [
        {
            breakpoint: 1150,
            settings: {
                slidesToShow: 1,
                slidesToScroll: 1,
                infinite: true,
            }
        },
        {
            breakpoint: 768,
            settings: {
                slidesToShow: 1,
                slidesToScroll: 1
            }
        },
        {
            breakpoint: 600,
            settings: {
                slidesToShow: 1,
                slidesToScroll: 1
            }
        }
    ]
});

$('.small-banner-wrap:not(.slick-initialized').slick({
    slidesToShow: 3,
    slidesToScroll: 1,
    speed: 500,
    arrows: false,
    autoplay: true,
    responsive: [
        {
            breakpoint: 990,
            settings: {
                slidesToShow: 2,
                slidesToScroll: 1,
                infinite: true,
            }
        },
        {
            breakpoint: 768,
            settings: {
                slidesToShow: 2,
                slidesToScroll: 1
            }
        },
        {
            breakpoint: 600,
            settings: {
                slidesToShow: 1,
                slidesToScroll: 1
            }
        }
    ]
});

})(jQuery);

if (jQuery(window).width() < 991){
  const  travel_blogz_focusableElements =
  'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
const travel_blogz_modal = document.querySelector('nav#site-navigation'); 

const travel_blogz_firstFocusableElement = travel_blogz_modal.querySelectorAll(travel_blogz_focusableElements)[0]; 
const travel_blogz_focusableContent = travel_blogz_modal.querySelectorAll(travel_blogz_focusableElements);
const travel_blogz_lastFocusableElement = travel_blogz_focusableContent[travel_blogz_focusableContent.length - 1];


document.addEventListener('keydown', function(e) {
let isTabPressed = e.key === 'Tab' || e.keyCode === 9;

if (!isTabPressed) {
  return;
}

if (e.shiftKey) { // if shift key pressed for shift + tab combination
  if (document.activeElement === travel_blogz_firstFocusableElement) {
    travel_blogz_lastFocusableElement.focus(); // add focus for the last focusable element
    e.preventDefault();
  }
} else { // if tab key is pressed
  if (document.activeElement === travel_blogz_lastFocusableElement) { // if focused has reached to last focusable element then focus first focusable element after pressing tab
    travel_blogz_firstFocusableElement.focus(); // add focus for the first focusable element
    e.preventDefault();
  }
}
});

travel_blogz_firstFocusableElement.focus();}