jQuery(document).ready(function($){
	
   $(window).on('load resize', function() {
			
				if ( window.innerWidth <= 1024 ) {
					
					
					$('#main-navigation').removeClass('main-menu');
					$('#main-navigation').addClass('mob-nav');
					$('#main-navigation.mob-nav').hide();
					$('#main-navigation.mob-nav .sub-menu').hide();
					
					$('#main-navigation.mob-nav').find( '.menu-item-has-children > a' ).after('<button class="submenu-btn"></button>');
					
					$('.menu-btn').removeClass('focus');
					$('.menu-btn').show();
					
				} else {
					
					$('#main-navigation').addClass('main-menu');
					$('#main-navigation').removeClass('mob-nav');
					$('#main-navigation.main-menu').show();
					$('#main-navigation.mob-nav .submenu').removeAttr('style');
					$('.hide-mob-menu').removeClass('show');
					$('.submenu-btn').remove();
					$('.menu-btn').hide();
				}
			
			});
			
				$('.menu-btn').on('click', function() {
					var headerFix = $('#site-header').offset().top;
					$('#main-navigation.mob-nav').slideToggle(300);
					$(this).toggleClass('focus');
					$(this).offset().top = headerFix;
					$('.hide-mob-menu').addClass('show');
					$('.hide-mob-menu-btm').addClass('show');
					
					
				});

				$(document).on('click', '#main-navigation.mob-nav li .submenu-btn', function(e) {
					$(this).toggleClass('focus');
					
					$(this).toggleClass('focus').next('ul').slideToggle(300);
					e.stopImmediatePropagation()
				});
				
				
				$('.hide-mob-menu').on('click', function() {
					$('#main-navigation.mob-nav').hide();
					
				});
				$('.hide-mob-menu-btm').on('click', function() {
					$('#main-navigation.mob-nav').hide();
					
				});
	
	
});