function vr_games_openNav() {
  jQuery(".sidenav").addClass('show');
}
function vr_games_closeNav() {
  jQuery(".sidenav").removeClass('show');
}

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

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

      if ( ! shiftKey && tabKey && vr_games_lastEl === vr_games_activeEl ) {
        e.preventDefault();
        vr_games_firstEl.focus();
      }

      if ( shiftKey && tabKey && vr_games_firstEl === vr_games_activeEl ) {
        e.preventDefault();
        vr_games_lastEl.focus();
      }
    } );
  }
  vr_games_keepFocusInMenu();
} )( window, document );

var vr_games_btn = jQuery('#button');

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

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

jQuery(document).ready(function() {

    var owl = jQuery('#top-slider .owl-carousel');
    owl.owlCarousel({
    margin: 0,
    nav:false,
    autoplay : true,
    lazyLoad: true,
    autoplayTimeout: 5000,
    loop: false,
    dots: false,
    navText : ['<i class="fas fa-chevron-left" aria-hidden="true"></i>','<i class="fas fa-chevron-right" aria-hidden="true"></i>'],
    responsive: {
      0: {
        items: 1
      },
      576: {
        items: 1
      },
      768: {
        items: 1
      },
      1000: {
        items: 1
      },
      1200: {
        items: 1
      }
    },
    autoplayHoverPause : false,
    mouseDrag: true
  });
})

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

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