<?php
	
function deep_print_menu($ispagephp = true, $isfirstpage = false){
	global $deep_header_bgstyle_pre, $deep_header_bgstyle_after;
	$header_shrink = "";
	$header_after_scroll = true;
	$typeofheader = get_option("deep_header_style_type");
	$deep_underlining_effect = get_option("deep_menu_underline_".$deep_header_bgstyle_pre,"on") == "on" ? " deep-underlining " : "";
	$header_fixed_helper = false;
	$deep_header_hide_on_start = $deep_content_at_top = false;
	?>
	
	<div class="header_style9_contents_bearer <?php if ($header_fixed_helper) echo esc_attr( 'menu_is_fixed' ); ?> deep_menu_trigger">
		<div class="header_style9_left <?php echo esc_attr($typeofheader); if (get_option('deep_header_animations') == 'on') echo " wpb_animate_when_almost_visible wpb_fadeInDownShort fadeInDownShort";?>">
			<header class="header_style9_left_container <?php echo " ".esc_attr($deep_header_bgstyle_pre); ?>">
				
				<div class="navbar-header">

					<a class="navbar-brand nav-to" href="<?php echo esc_url(home_url("/")); ?>" tabindex="-1">
					<?php 
						$deep_header_style_pre = $deep_header_bgstyle_pre == 'dark' ? 'light' : 'dark';
						$deep_header_style_after = $deep_header_bgstyle_after == 'dark' ? 'light' : 'dark';
						
						$alone = true;
						if (get_option("deep_logo_retina_image_url_".$deep_header_style_pre) != ""){
							$alone = false;
						}
						?>
						<img class="logo_normal<?php echo ! $alone ? ' notalone' : ''; ?>" src="<?php echo esc_url( get_option( 'deep_logo_image_url_' . $deep_header_style_pre ) ); ?>" alt="<?php esc_attr_e( 'Site Logo', 'deep' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name' ) ); ?>">
    					
    				<?php 
    				if (get_option("deep_logo_retina_image_url_".$deep_header_style_pre) != ""){
    				?>

							<img class="logo_retina" style="display:none; position: relative;" src="<?php echo esc_url( get_option( 'deep_logo_retina_image_url_' . $deep_header_style_pre ) ); ?>" alt="<?php esc_attr_e( 'Retina Logo', 'deep' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name' ) ); ?>">
							
    				<?php
					}
					/* deep_header_after_scroll option */
	    			if ($header_after_scroll || $deep_header_hide_on_start){
		    			$alone = true;
	    				if (get_option("deep_logo_retina_image_url_".$deep_header_style_after) != ""){
		    				$alone = false;
	    				}
    					?>
    					
    					<img class="logo_normal logo_after_scroll<?php echo ! $alone ? ' notalone' : ''; ?>" src="<?php echo esc_url( get_option( 'deep_logo_image_url_' . $deep_header_style_after ) ); ?>" alt="<?php esc_attr_e( 'Logo after scroll', 'deep' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name' ) ); ?>">
	    					
	    				<?php 
	    				if (get_option("deep_logo_retina_image_url_".$deep_header_style_after) != ""){
	    				?>
		    				<img class="logo_retina logo_after_scroll" style="display:none; position: relative;" src="<?php echo esc_url( get_option( 'deep_logo_retina_image_url_' . $deep_header_style_after ) ); ?>" alt="<?php esc_attr_e( 'Retina Logo after scroll', 'deep' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name' ) ); ?>">
							<?php
							}
						}
					?>
					</a>
				</div>
				
				<div class="menu_trigger">
					<span class="hamburguer-trigger-menu-icon">   
						<span class="hamburguer-line hamburger-line-1"></span>
						<span class="hamburguer-line hamburger-line-2"></span>
						<span class="hamburguer-line hamburger-line-3"></span>
					</span>
				</div>
				
				<div class="navbar-collapse collapse">
					<?php 
						if (!$isfirstpage){
							if ($ispagephp){
								wp_nav_menu( array( 'theme_location' => 'PrimaryNavigation', 'container' => false, 'menu_class' => 'nav navbar-nav navbar-right', 'walker' => new deep_walker_nav_menu_outsider, 'fallback_cb' => esc_html__('You need to assign a Menu to the Main Navigation Location.','deep') ) );
							} 
							else {
								global $homes;
								$homes = 0;
								wp_nav_menu( array( 'theme_location' => 'PrimaryNavigation', 'container' => false, 'menu_class' => 'nav navbar-nav navbar-right', 'walker' => new deep_walker_nav_menu, 'fallback_cb' => esc_html__('You need to assign a Menu to the Main Navigation Location.','deep') ) );
							}
						}
						
						// menu effects helpers
						$deep_inline_script = '
							jQuery(document).ready(function(){
								"use strict";
								var css_helper = "";
								if (jQuery("#deep-custom-style-inline-css").hasClass("submenus-added")) return;
								if (!jQuery("#deep-custom-style-inline-css").hasClass("footer-elements-added")){
									var transDelayValue = (parseFloat(jQuery(".navbar-nav > li:last").css("transition-delay")) + .15)+"s";
									css_helper += ".deep_menu_trigger.menu-opened .deep-opened-footer-elements{  -webkit-transition: all .4s ease-in-out "+transDelayValue+";-moz-transition: all .4s ease-in-out "+transDelayValue+";-ms-transition: all .4s ease-in-out "+transDelayValue+";-o-transition: all .4s ease-in-out "+transDelayValue+";transition: all .4s ease-in-out "+transDelayValue+"; } "; 
									jQuery("#deep-custom-style-inline-css").addClass("footer-elements-added");
								}
								jQuery(".header_style9_left_container .nav li > ul").each(function(e){
									var classes = jQuery(this).attr("class").split(" "),
										menuDepth =  classes.filter(function (v) {return /menu-depth-/.test(v)});
									if (menuDepth && parseInt(menuDepth[0].replace("menu-depth-",""),10) > 1 && jQuery(this).closest(".deep_mega_menu").length) return;
									jQuery(this).addClass("submenu-helper-"+e);
										var thisHeight = jQuery(this).height();
										css_helper += ".submenu-helper-"+e+"{ border-top: "+thisHeight*(1/2)+"px solid transparent !important; border-bottom: "+thisHeight*(1/2)+"px solid transparent !important; height: "+thisHeight+"px; overflow: hidden; }";
								});
								jQuery("#deep-custom-style-inline-css").html( jQuery("#deep-custom-style-inline-css").html() + css_helper );
								jQuery(window).on("resize", function(){ 
									if (!jQuery("#deep-custom-style-inline-css-resizer").length) jQuery("#deep-custom-style-inline-css").after("<style id=\"deep-custom-style-inline-css-resizer\" />");
									var css_helper = "";
									jQuery(".header_style9_left_container .nav li.deep_mega_menu > ul").each(function(e){
										jQuery(this).addClass("submenu-helper-resizer-"+e);
										var maxHeight = 0;
										jQuery(this).children("li").each(function(){ if (jQuery(this).height() > maxHeight) maxHeight = jQuery(this).height(); });
										css_helper += ".submenu-helper-resizer-"+e+"{ border-top: "+maxHeight*(1/2)+"px solid transparent !important; border-bottom: "+maxHeight*(1/2)+"px solid transparent !important; height: "+maxHeight+"px; overflow: hidden; }";
									});
									jQuery("#deep-custom-style-inline-css-resizer").html(css_helper);
								});
								jQuery("#deep-custom-style-inline-css").addClass("submenus-added");
								
								
								 
							';
						$deep_inline_script .= '
							});';
						wp_add_inline_script( 'deep-global', $deep_inline_script, 'after' );
					?>
					
					<div class="deep_right_header_icons <?php
						if (class_exists( 'WooCommerce' ) && get_option("deep_woocommerce_cart") == "on") echo "with-woocommerce-cart";
					?>">
						<?php
						
						//search trigger
						if (get_option("deep_enable_search") == "on"){
							?>
							<div class="search_trigger <?php if (get_option("deep_search_mobile") == "off") echo "disable_deep_search_mobile"; ?>">
								<i class="mi-search"></i>
								<span class="search-menu-text"><?php 
								
									if (function_exists('icl_t')){
										printf(esc_html__("%s","deep"), icl_t( 'deep', 'Search', get_option('deep_search_menu_title')));
									} else {
										printf(esc_html__("%s","deep"), get_option("deep_search_menu_title"));
									}
								?>
								</span>
							</div>
							<?php
						}
						?>
						
						<?php
						global $woocommerce;
						if (isset($woocommerce) && get_option("deep_woocommerce_cart") == "on"){	
						
							?>	
							<div class="deep_cart_header <?php if (get_option("deep_woocommerce_cart_mobile") == "off") echo "disable_deep_woocommerce_cart_mobile"; ?>">
								<?php deep_print_woocommerce_button();?>
								
								<span class="search-menu-text cart">
								<?php 
									if (function_exists('icl_t')){
										printf(esc_html__("%s","deep"), icl_t( 'deep', 'Cart', get_option('deep_cart_menu_title')));
									} else {
										printf(esc_html__("%s","deep"), get_option("deep_cart_menu_title"));
									}
								
								?>
								</span>
							</div>
						
						<?php
						}
						
						
						
						
						
						/* Languages menu */
							if (get_option("deep_languages_menu") == "on"){
								?>
								<div class="menu-languages <?php if (get_option("deep_extra_menu_mobile") == "off") echo "disable_extra_menu_mobile"; ?>">
									
									<div class="top-bar-menu">
										<?php wp_nav_menu( array( 'theme_location' => 'languagenav', 'container' => false, 'menu_class' => 'sf-menu', 'menu_id' => 'menu_top_bar', 'fallback_cb' => false )); ?>
									</div>
									
								
									
								</div>
								<?php
							}
						?>
						
						
						<?php	
							if (get_option('deep_header_button') == 'on'){
								
								if (get_option('button_style') == 'text_style'){
									?>
									<div class="deep-header-button only_text_button">
										
										<a <?php if (get_option("deep_header_button_link_target") == "on") echo " target='_blank'"; ?> href="<?php echo esc_url(get_option('deep_header_button_link')); ?>" class="nav-to opacity-1 no-hover">
										
											<span class="link-hover-anim <?php if (get_option("deep_header_button_border_bottom") == "on") echo " underline"; ?>" data-link-animate="y">
												
												<?php
												
												if (get_option('deep_header_button_ellipse') == 'on'){?>
													<span class="icon-ellipse me-1"></span>
												
												<?php
												}
													
												if (function_exists('icl_t')){
													printf(esc_html__( "%s", "deep" ), stripslashes_from_strings_only(icl_t( 'deep', 'Header Button', get_option('deep_header_button_text'))));
												} else {
													printf(esc_html__( "%s", "deep" ), stripslashes_from_strings_only(get_option('deep_header_button_text')));
												}
												if (get_option('deep_header_button_icon') == 'on'){
													?>
													<i class="icon-arrow-right1" aria-hidden="true"></i>
													<?php
													
												}
												?>
												
											</span>
										
										</a>
										
									</div>
									<?php
								}
								else if (get_option('button_style') == 'special_button_style'){
									?>
									<div class="deep-header-button only_special_button">
										
										
										<a <?php if (get_option("deep_header_button_link_target") == "on") echo " target='_blank'"; ?> href="<?php echo esc_url(get_option('deep_header_button_link')); ?>" class="nav-to">
										
											<span class="special_button_style_header" data-btn-animate="y">
												<span class="btn-animate-y">
													
													<?php
													
													if (get_option('deep_header_button_ellipse') == 'on'){
													?>
													<span class="icon-ellipse me-1"></span>
													
													<?php
													}
													
													if (function_exists('icl_t')){
														printf(esc_html__( "%s", "deep" ), stripslashes_from_strings_only(icl_t( 'deep', 'Header Button', get_option('deep_header_button_text'))));
													} else {
														printf(esc_html__( "%s", "deep" ), stripslashes_from_strings_only(get_option('deep_header_button_text')));
													}
													
													if (get_option('deep_header_button_icon') == 'on'){
														?>
														<i class="icon-arrow-right1" aria-hidden="true"></i>
														<?php
														
													}
													?>
													
												</span>
												
											</span>
											
										</a>
										
									</div>
									<?php
								}else{
									?>
									<div class="deep-header-button only_button">
										<a <?php if (get_option("deep_header_button_link_target") == "on") echo " target='_blank'"; ?> href="<?php echo esc_url(get_option('deep_header_button_link')); ?>" class="nav-to">
										
											<?php
											if (get_option('deep_header_button_ellipse') == 'on'){
											?>
											<span class="icon-ellipse me-1"></span>
											
											<?php
											}
											 
											if (function_exists('icl_t')){
												printf(esc_html__( "%s", "deep" ), stripslashes_from_strings_only(icl_t( 'deep', 'Header Button', get_option('deep_header_button_text'))));
											} else {
												printf(esc_html__( "%s", "deep" ), stripslashes_from_strings_only(get_option('deep_header_button_text')));
											}
											
											if (get_option('deep_header_button_icon') == 'on'){
												?>
												<i class="icon-arrow-right1" aria-hidden="true"></i>
												<?php
												
											}
											?>
											
											
										</a>
									</div>
									<?php
								}
								}
							?>
						</div>
					
				</div>
				
				
				
				<?php ob_start(); ?>
				<div class="deep_style9_social_icons">
					<?php
					if (get_option("deep_footer_display_social_icons") == "on"){
						?>
						<div class="social-icons-fa align-<?php echo esc_attr(get_option("deep_footer_social_icons_alignment")); ?>">
					        <?php ob_start(); ?>
					        <ul>
							<?php
								$icons = array(array("houzz","Houzz"),array("facebook","Facebook"),array("twitter","Twitter"),array("tumblr","Tumblr"),array("stumbleupon","Stumble Upon"),array("flickr","Flickr"),array("linkedin","LinkedIn"),array("delicious","Delicious"),array("skype","Skype"),array("digg","Digg"),array("vimeo-square","Vimeo"),array("deviantart","DeviantArt"),array("behance","Behance"),array("instagram","Instagram"),array("wordpress","Wordpress"),array("youtube","Youtube"),array("reddit","Reddit"),array("soundcloud","SoundCloud"),array("pinterest","Pinterest"),array("dribbble","Dribbble"),array("vk","VK"),array("twitch","Twitch"),array("foursquare","Foursquare"),array("slack","Slack"),array("whatsapp","whatsapp"),array("line","Line"),array("weixin","weixin"),array("imdb","imdb"),array("tiktok","tiktok"),array("amazon","amazon"),array("apple","apple"),array("google-play","google-play"),array("snapchat","snapchat"),array("tripadvisor","tripadvisor"));
								$counter = 0;
								foreach ($icons as $i){
									if (is_string(get_option("deep_icon-".$i[0])) && get_option("deep_icon-".$i[0]) != ""){
										$counter++;
										?>
										<li>
											<a href="<?php echo esc_url(get_option("deep_icon-".$i[0])); ?>" <?php if (get_option("deep_enable_blank_social_link") == "on") echo " target='_blank'";?>  class="social-network <?php echo esc_attr(strtolower($i[0])); ?>" title="<?php echo esc_attr($i[1]); ?>"><i class="fab fa-<?php echo esc_attr(strtolower($i[0])); ?>"></i></a>
										</li>
										<?php
									}
								}
							?>
							
							<?php if ( is_string(get_option("deep_icon-envelope")) && get_option("deep_icon-envelope") != "" ){ ?>
													<li><a href="<?php echo esc_url(get_option("deep_icon-envelope"))?>" <?php if (get_option("deep_enable_blank_social_link") == "on") echo " target='_blank'";?>  class="envelope" title="email"><i class="far fa-envelope"></i></a></li>
												<?php } ?>
												
												<?php if ( is_string(get_option("deep_icon-rss")) && get_option("deep_icon-rss") != "" ){ ?>
													<li><a href="<?php echo esc_url(get_option("deep_icon-rss"))?>" <?php if (get_option("deep_enable_blank_social_link") == "on") echo " target='_blank'";?>  class="rss" title="rss"><i class="fa fa-rss-square"></i></a></li>
												<?php } ?>
						    </ul>
						    <?php if ($counter) echo '<span></span>'.ob_get_clean().'<span></span>'; ?>
						</div>
					<?php }
					?>
				</div>

				<?php
					if (get_option('deep_show_sec_footer') == 'on' && get_option('deep_footer_display_custom_text') == 'on'){ ?>
					<div class="deep_style9_footer_contents">
						<div class="footer_custom_text"><?php echo do_shortcode(stripslashes(get_option("deep_footer_custom_text"))); ?></div>
					</div>	
					<?php }
				?>
				
				<?php
					$deep_footer_elems = ob_get_clean();
					echo wp_kses($deep_footer_elems, 'post');
					?>
					<div class="deep-opened-footer-elements"><?php echo wp_kses($deep_footer_elems, 'post'); ?></div>
					<?php
				?>

			</div>
		</header><!--  endof left -->
		<div class="header_style9_right">
			
	<?php
}
	
?>