jQuery(function($){
	"use strict";
	jQuery('.main-menu-navigation > ul').superfish({
		delay:       500,
		animation:   {opacity:'show',height:'show'},  
		speed:       'fast'
	});
});

function gym_training_coach_menu_open() {
	jQuery(".menu-brand.primary-nav").addClass('show');
}
function gym_training_coach_menu_close() {
	jQuery(".menu-brand.primary-nav").removeClass('show');
}

var gym_training_coach_Keyboard_loop = function (elem) {
    var gym_training_coach_tabbable = elem.find('select, input, textarea, button, a').filter(':visible');

    var gym_training_coach_firstTabbable = gym_training_coach_tabbable.first();
    var gym_training_coach_lastTabbable = gym_training_coach_tabbable.last();
    /*set focus on first input*/
    gym_training_coach_firstTabbable.focus();

    /*redirect last tab to first input*/
    gym_training_coach_lastTabbable.on('keydown', function (e) {
        if ((e.which === 9 && !e.shiftKey)) {
            e.preventDefault();
            gym_training_coach_firstTabbable.focus();
        }
    });

    /*redirect first shift+tab to last input*/
    gym_training_coach_firstTabbable.on('keydown', function (e) {
        if ((e.which === 9 && e.shiftKey)) {
            e.preventDefault();
            gym_training_coach_lastTabbable.focus();
        }
    });

    /* allow escape key to close insiders div */
    elem.on('keyup', function (e) {
        if (e.keyCode === 27) {
            elem.hide();
        }
        ;
    });
};

// scroll
jQuery(document).ready(function () {
	jQuery(window).scroll(function () {
	    if (jQuery(this).scrollTop() > 0) {
	        jQuery('#scrollbutton').fadeIn();
	    } else {
	        jQuery('#scrollbutton').fadeOut();
	    }
	});
	jQuery(window).on("scroll", function () {
	   document.getElementById("scrollbutton").style.display = "block";
	});
	jQuery('#scrollbutton').click(function () {
	    jQuery("html, body").animate({
	        scrollTop: 0
	    }, 600);
	    return false;
	});
});

jQuery(function($){
	$('.mobiletoggle').click(function () {
        gym_training_coach_Keyboard_loop($('.menu-brand.primary-nav'));
    });
});

// preloader
jQuery(function($){
    setTimeout(function(){
        $(".frame").delay(1000).fadeOut("slow");
    });
});

jQuery('document').ready(function($){
    $('.main-search span a').click(function(){
        $(".searchform_page").slideDown(500);
        gym_training_coach_Keyboard_loop($('.searchform_page'));
    });

    $('.close a').click(function(){
        $(".searchform_page").slideUp(500);
    });
}); 

jQuery(document).ready(function() {
    var owl = jQuery('#our-classes-section .owl-carousel');
        owl.owlCarousel({
            nav: true,
            dots: false,
            autoplay:false,
            autoplayTimeout:2000,
            autoplayHoverPause:true,
            loop: true,
            navText : ['<i class="fas fa-arrow-left"></i>','<i class="fas fa-arrow-right"></i>'],
            responsive: {
              0: {
                items: 1
              },
              600: {
                items: 2
              },
              1000: {
                items: 4
            }
        }
    })
});

/*sticky copyright*/
window.addEventListener('scroll', function() {
  var gym_training_coach_sticky = document.querySelector('.copyright-sticky');
  if (!gym_training_coach_sticky) return;

  var gym_training_coach_scrollTop = window.scrollY || document.documentElement.scrollTop;
  var gym_training_coach_windowHeight = window.innerHeight;
  var gym_training_coach_documentHeight = document.documentElement.scrollHeight;

  var gym_training_coach_isBottom = gym_training_coach_scrollTop + gym_training_coach_windowHeight >= gym_training_coach_documentHeight - 100;

  if (gym_training_coach_scrollTop >= 100 && !gym_training_coach_isBottom) {
    gym_training_coach_sticky.classList.add('copyright-fixed');
  } else {
    gym_training_coach_sticky.classList.remove('copyright-fixed');
  }
});

/* Progress Bar */
document.addEventListener("DOMContentLoaded", function () {
    const gym_training_coach_progressBar =
        document.getElementById("gym_training_coach_elemento_progress_bar");
    if (!gym_training_coach_progressBar) return;
    window.addEventListener("scroll", function () {
        const gym_training_coach_scrollTop =
            document.documentElement.scrollTop || document.body.scrollTop;
        const gym_training_coach_height =
            document.documentElement.scrollHeight -
            document.documentElement.clientHeight;
        const gym_training_coach_scrolled =
            (gym_training_coach_scrollTop / gym_training_coach_height) * 100;
        gym_training_coach_progressBar.style.width =
            gym_training_coach_scrolled + "%";
    });
});

