<?php $bauen_options = get_option('bauen'); ?>
    <!-- header start -->
	<?php if (!is_search()) { ?>
		<?php if (is_page()||is_single()||!is_404()) { ?>
			
			<?php if(get_post_meta($post->ID,'bauen_page_header_color_style_opt',true)=='st2'){ ?> 
				<?php $bauen_header_color = '-white';?>
			<?php } 
			else { ?>  
				<?php $bauen_header_color = '-black';?>		
			<?php } ;?>				
			
			<?php if(get_post_meta($post->ID,'bauen_page_header_logo_color_style_opt',true)=='st2'){ ?> 
				<?php $bauen_header_logo_sub_color = 'custom-logo-sub-white';?>
			<?php } 
			else { ?>  
				<?php $bauen_header_logo_sub_color = 'custom-logo-sub-gray';?>	
			<?php } ;?>			

		<?php } 
		else { ?> 	
		
			<?php if (Bauen_AfterSetupTheme::return_thme_option('header_logo_sub_color_style')=='yes'){ ?>  
				<?php $bauen_header_logo_sub_color = 'custom-logo-sub-white';?>
			<?php } 
			else { ?> 
				<?php $bauen_header_logo_sub_color = 'custom-logo-sub-gray';?>
			<?php } ;?>	
			
			<?php if (Bauen_AfterSetupTheme::return_thme_option('header_color_style')=='yes'){ ?>  
				<?php $bauen_header_color = '-white';?>
			<?php } 
			else { ?> 
				<?php $bauen_header_color = '-black ';?>
			<?php } ;?>			
			
		<?php } ;?>
	<?php } 
	else { ?> 	
	
		<?php if (Bauen_AfterSetupTheme::return_thme_option('header_logo_sub_color_style')=='yes'){ ?>  
			<?php $bauen_header_logo_sub_color = 'custom-logo-sub-white';?>
		<?php } 
		else { ?> 
			<?php $bauen_header_logo_sub_color = 'custom-logo-sub-gray';?>
		<?php } ;?>	
		
		<?php if (Bauen_AfterSetupTheme::return_thme_option('header_color_style')=='yes'){ ?>  
			<?php $bauen_header_color = '-white';?>
		<?php } 
		else { ?> 
			<?php $bauen_header_color = '-black ';?>
		<?php } ;?>			
		
	<?php } ;?>		
	<!-- Navbar -->
	<nav class="navbar navbar-expand-lg">
		<!-- Logo -->
		<div class="logo-wrapper ">
			<div class="logo <?php echo esc_attr($bauen_header_logo_sub_color);?>">
				<a href="<?php echo esc_url( home_url( '/' ) ); ?>">
					<?php if (Bauen_AfterSetupTheme::return_thme_option('image_logo')=='st2'){ ?>
						<?php if (Bauen_AfterSetupTheme::return_thme_option('nav_scroll_logo')=='st2'){ ?>
								<?php if (is_page()||is_single()) { ?>
									<?php if(get_post_meta($post->ID,'bauen_page_header_sticky_logo_visiablity_opt',true)=='st2'){ ?>
										<img class="logo-img" src="<?php echo esc_url(Bauen_AfterSetupTheme::return_thme_option('logopic_dark','url'));?>" alt="<?php  bloginfo('name'); ?>">
									<?php } else { ?>
										<img class="logo-img if-regular" src="<?php echo esc_url(Bauen_AfterSetupTheme::return_thme_option('logopic','url'));?>" alt="<?php  bloginfo('name'); ?>">
										<img class="logo-img if-scroll" src="<?php echo esc_url(Bauen_AfterSetupTheme::return_thme_option('logopic_dark','url'));?>" alt="<?php  bloginfo('name'); ?>">
									<?php } ;?>
								<?php } else { ?>
									<?php if (Bauen_AfterSetupTheme::return_thme_option('nav_scroll_logo_visiabilty')=='st2'){ ?>
										<img class="logo-img" src="<?php echo esc_url(Bauen_AfterSetupTheme::return_thme_option('logopic_dark','url'));?>" alt="<?php  bloginfo('name'); ?>">
									<?php } else { ?>
										<img class="logo-img if-regular" src="<?php echo esc_url(Bauen_AfterSetupTheme::return_thme_option('logopic','url'));?>" alt="<?php  bloginfo('name'); ?>">
										<img class="logo-img if-scroll" src="<?php echo esc_url(Bauen_AfterSetupTheme::return_thme_option('logopic_dark','url'));?>" alt="<?php  bloginfo('name'); ?>">
									<?php } ;?>
								<?php } ;?>
							<?php } else { ?>
								<img class="logo-img " src="<?php echo esc_url(Bauen_AfterSetupTheme::return_thme_option('logopic','url'));?>" alt="<?php  bloginfo('name'); ?>">
							<?php } ;?>
					<?php } ?>
					<?php if (Bauen_AfterSetupTheme::return_thme_option('text_logo')!='st1'){ ?>
					<h2>	
					    <?php if(!empty($bauen_options['logo_text_title'])): ?>
						    <?php echo esc_html(Bauen_AfterSetupTheme::return_thme_option('logo_text_title',''));?>
						<?php else:?>
						    <?php  bloginfo('name'); ?>	
						<?php endif;?>
						<?php if(!empty($bauen_options['logo_text_sub'])):?>
						<span><?php echo esc_html(Bauen_AfterSetupTheme::return_thme_option('logo_text_sub',''));?></span>
						<?php endif;?>
					</h2>
					<?php } ?>
				</a>			
			</div>
		</div>
		<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> <span class="icon-bar"><i class="ti-line-double"></i></span> </button>
		<!-- Navbar links -->
		<div class="collapse navbar-collapse" id="navbarSupportedContent">
			<ul class="navbar-nav ml-auto <?php echo esc_attr($bauen_header_color);?>">
				<?php
					$athers = array(
						'theme_location'  => 'top-menu',
						'menu'            => 'div',
						'container'       => 'ul',
						'container_class' => '',
						'menu_class'      => '',
						'menu_id'         => '',
						'echo'            => true,
						'fallback_cb'     => 'show_top_menu',
						'before'          => '',
						'after'           => '',
						'link_before'     => '',
						'link_after'      => '',
						'items_wrap'      => '%3$s',
						'depth'           => 0,
						'walker'          => new Bauen_Classic_Walker
						);					

				if(has_nav_menu('main-menu')) { 
					$bauen_menu_location = get_nav_menu_locations(); // Get our nav locations (set in our theme, usually functions.php)
					$bauen_menuID = $bauen_menu_location['main-menu']; // Get the *primary* menu ID
					$bauen_nav_items = wp_get_nav_menu_items($bauen_menuID);
					$bauen_counter=0;
					$bauen_count = count($bauen_nav_items);
					$menu_item='';
					foreach ( $bauen_nav_items as $bauen_nav_item ) {
					$bauen_separatepages = get_post_meta($bauen_nav_item->object_id, "bauen_open_page", true);
					$bauen_varpost = get_post($bauen_nav_item->object_id);
					$bauen_menu_active='';
					if ($bauen_counter == 0) {
					$bauen_menu_active='active';	
					}
					if ( $bauen_separatepages == true ) {
						$menu_item .='<li class="nav-item "><a href="'. esc_url( $bauen_nav_item->url ) .'" class="nav-link  '.esc_attr($bauen_menu_active).'"> ' . apply_filters( 'the_title', $bauen_nav_item->title, $bauen_nav_item->ID ) . '</a></li>';
					}
					else  if($bauen_nav_item->object != 'page'){
						$menu_item .='<li class="nav-item "><a href="'. esc_url( $bauen_nav_item->url ) .'" class="nav-link  '.esc_attr($bauen_menu_active).'"> ' . apply_filters( 'the_title', $bauen_nav_item->title, $bauen_nav_item->ID ) . '</a></li>';
					}
					else { 
						if (is_front_page()){
						$menu_item .='<li class="nav-item"><a  class="one-page-menu-item active  nav-link '.esc_attr($bauen_menu_active).'" href="#"   data-scroll-nav="'.esc_attr($bauen_counter).'"> ' . apply_filters( 'the_title', $bauen_nav_item->title, $bauen_nav_item->ID ) . '</a></li>';	
						}
						else {
							$menu_item .='<li class="nav-item "><a href="'. esc_url(home_url()).'/#'. $bauen_varpost->post_name .'" class="nav-link nav-color '.esc_attr($bauen_menu_active).'" > ' . apply_filters( 'the_title', $bauen_nav_item->title, $bauen_nav_item->ID ) . '</a></li>';
						}
					}
					
					$bauen_counter++;
					}
					echo $menu_item;
				}
				else if(has_nav_menu('top-menu')){
					wp_nav_menu( $athers );
				}
				?>				
			</ul>
		</div>
	</nav>


    <?php if(has_nav_menu('main-menu')) {?>
	
		<?php if (Bauen_AfterSetupTheme::return_thme_option('theme_color_style')=='st2'){ ?>
			<?php wp_enqueue_style('bauen-style-onepage-dark');?>
		<?php } 
		else { ?> 	
			<?php wp_enqueue_style('bauen-style-onepage-light');?>
		<?php } ?>	
		
		<?php wp_enqueue_script('bauen-custom-one');?>	

	<?php } 
	else { ?> 
	
		<?php if (Bauen_AfterSetupTheme::return_thme_option('theme_color_style')=='st2'){ ?>
			<?php wp_enqueue_style('bauen-style-multipage-dark');?>
		<?php } 
		else { ?> 	
			<?php wp_enqueue_style('bauen-style-multipage-light');?>
		<?php } ?>
		
		<?php wp_enqueue_script('bauen-custom');?>	
	
	<?php } ?>	