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

});

function multipurpose_corporate_resmenu_open() {
	window.multipurpose_corporate_mobileMenu=true;
	jQuery(".sidebar").addClass('menubar');
}
function multipurpose_corporate_resmenu_close() {
	window.multipurpose_corporate_mobileMenu=false;
	jQuery(".sidebar").removeClass('menubar');
}

jQuery(document).ready(function () {

	window.multipurpose_corporate_currentfocus=null;
  	multipurpose_corporate_checkfocusdElement();
	var multipurpose_corporate_body = document.querySelector('body');
	multipurpose_corporate_body.addEventListener('keyup', multipurpose_corporate_check_tab_press);
	var multipurpose_corporate_gotoHome = false;
	var multipurpose_corporate_gotoClose = false;
	window.multipurpose_corporate_mobileMenu=false;
 	function multipurpose_corporate_checkfocusdElement(){
	 	if(window.multipurpose_corporate_currentfocus=document.activeElement.className){
		 	window.multipurpose_corporate_currentfocus=document.activeElement.className;
	 	}
 	}
	function multipurpose_corporate_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.multipurpose_corporate_mobileMenu){
					if (!e.shiftKey) {
						if(multipurpose_corporate_gotoHome) {
							jQuery( ".main-menu-navigation ul:first li:first a:first-child" ).focus();
						}
					}
					if (jQuery("a.closebtn.responsive-menu").is(":focus")) {
						multipurpose_corporate_gotoHome = true;
					} else {
						multipurpose_corporate_gotoHome = false;
					}

			}else{

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

					if(window.multipurpose_corporate_mobileMenu){
					}
				}

				}
			}
		}
	 	multipurpose_corporate_checkfocusdElement();
	}

});

(function( $ ) {

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

	  if (scroll >= 100) sticky.addClass('fixed-menubox');
	  else sticky.removeClass('fixed-menubox');
	});
	
	/**** Hidden search box ***/
	jQuery('document').ready(function($){
		$('.search-box i').click(function(){
	        $(".serach_outer").slideDown(700);
	    });

	    $('.closepop i').click(function(){
	        $(".serach_outer").slideUp(700);
	    });
	});

})( jQuery );

