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

function hotel_resort_resmenu_open() {
	window.hotel_resort_mobileMenu=true;
	jQuery(".sidebar").addClass('menubar');
}
function hotel_resort_resmenu_close() {
	window.hotel_resort_mobileMenu=false;
	jQuery(".sidebar").removeClass('menubar');
}

jQuery(document).ready(function () {

	window.hotel_resort_currentfocus=null;
  	hotel_resort_checkfocusdElement();
	var hotel_resort_body = document.querySelector('body');
	hotel_resort_body.addEventListener('keyup', hotel_resort_check_tab_press);
	var hotel_resort_gotoHome = false;
	var hotel_resort_gotoClose = false;
	window.hotel_resort_mobileMenu=false;
 	function hotel_resort_checkfocusdElement(){
	 	if(window.hotel_resort_currentfocus=document.activeElement.className){
		 	window.hotel_resort_currentfocus=document.activeElement.className;
	 	}
 	}
	function hotel_resort_check_tab_press(e) {
		"use strict";
		// pick passed event or global event object if passed one is empty
		e = e || event;
		var activeElement;

		if(window.innerWidth < 999){
			if (e.keyCode == 9) {
				if(window.hotel_resort_mobileMenu){
					if (!e.shiftKey) {
						if(hotel_resort_gotoHome) {
							jQuery( ".main-menu-navigation ul:first li:first a:first-child" ).focus();
						}
					}
					if (jQuery("a.closebtn.responsive-menu").is(":focus")) {
						hotel_resort_gotoHome = true;
					} else {
						hotel_resort_gotoHome = false;
					}

			}else{

					if(window.hotel_resort_currentfocus=="resToggle"){
						jQuery( "" ).focus();
					}
				}
			}
		}
		if (e.shiftKey && e.keyCode == 9) {
			if(window.innerWidth < 999){
				if(window.hotel_resort_currentfocus=="header-search"){
					jQuery(".resToggle").focus();
				}else{
					if(window.hotel_resort_mobileMenu){
						if(hotel_resort_gotoClose){
							jQuery("a.closebtn.responsive-menu").focus();
						}
						if (jQuery( ".main-menu-navigation ul:first li:first a:first-child" ).is(":focus")) {
							hotel_resort_gotoClose = true;
						} else {
							hotel_resort_gotoClose = false;
					}
				
				}else{

					if(window.hotel_resort_mobileMenu){
					}
				}

				}
			}
		}
	 	hotel_resort_checkfocusdElement();
	}

});


(function( $ ) {

	$(window).scroll(function(){
		var sticky = $('.sticky-menubox'),
		scroll = $(window).scrollTop();

		if (scroll >= 100) sticky.addClass('fixed-menubox');
		else sticky.removeClass('fixed-menubox');
	});

})( jQuery );