<?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 } ;?>		
	
    <!-- Sidebar Section --><a href="#" class="js-bauen-nav-toggle bauen-nav-toggle"><i></i></a>
    <aside id="bauen-aside">
        <!-- Logo -->
		<div class="bauen-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'){ ?>
				<img class="logo-img" src="<?php echo esc_url(Bauen_AfterSetupTheme::return_thme_option('logopic','url'));?>" alt="<?php  bloginfo('name'); ?>">
				<?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>		

        <!-- Menu -->
        <nav class="bauen-main-menu">
            <ul class="<?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_Click_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 href="#" class="one-page-menu-item nav-link '.esc_attr($bauen_menu_active).'" 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>
        </nav>
        <!-- Sidebar Footer -->
		<?php if (Bauen_AfterSetupTheme::return_thme_option('en_header_social_opt')=='st2'){ ?>
		<div class="bauen-footer">
		    <ul>
				<?php if(!empty($bauen_options['facebook'])):?> 
				<li><a href="<?php echo esc_url($bauen_options['facebook']); ?>" target="_blank"><i class="ti-facebook"></i></a></li>
				<?php endif;?>

				<?php if(!empty($bauen_options['twitter'])):?> 
				<li><a href="<?php echo esc_url($bauen_options['twitter']); ?>" target="_blank"><i class="ti-twitter"></i></a></li>
				<?php endif;?>

				<?php if(!empty($bauen_options['google-plus'])):?> 
				<li><a href="<?php echo esc_url($bauen_options['google-plus']); ?>" target="_blank"><i class="ti-google"></i></a></li>
				<?php endif;?>		

				<?php if(!empty($bauen_options['linkedin'])):?> 
				<li><a href="<?php echo esc_url($bauen_options['linkedin']); ?>" target="_blank"><i class="ti-linkedin"></i></a></li>
				<?php endif;?>	

				<?php if(!empty($bauen_options['instagram'])):?> 
				<li><a href="<?php echo esc_url($bauen_options['instagram']); ?>" target="_blank"><i class="ti-instagram"></i></a></li>
				<?php endif;?>	

				<?php if(!empty($bauen_options['pinterest'])):?> 
				<li><a href="<?php echo esc_url($bauen_options['pinterest']); ?>" target="_blank"><i class="ti-pinterest"></i></a></li>
				<?php endif;?>	

				<?php if(!empty($bauen_options['soundcloud'])):?> 
				<li><a href="<?php echo esc_url($bauen_options['soundcloud']); ?>" target="_blank"><i class="ti-soundcloud"></i></a>
				<?php endif;?>			

				<?php if(!empty($bauen_options['skype'])):?> 
				<li><a href="<?php echo esc_url($bauen_options['skype']); ?>" target="_blank"><i class="ti-skype"></i></a></li>
				<?php endif;?>	

				<?php if(!empty($bauen_options['dribbble'])):?> 
				<li><a href="<?php echo esc_url($bauen_options['dribbble']); ?>" target="_blank"><i class="ti-dribbble"></i></a></li>
				<?php endif;?>				

				<?php if(!empty($bauen_options['youtube'])):?> 
				<li><a href="<?php echo esc_url($bauen_options['youtube']); ?>" target="_blank"><i class="ti-youtube"></i></a></li>
				<?php endif;?>	

				<?php if(!empty($bauen_options['vimeo'])):?> 
				<li><a href="<?php echo esc_url($bauen_options['vimeo']); ?>" target="_blank"><i class="ti-vimeo"></i></a>
				<?php endif;?>

				<?php if(!empty($bauen_options['dropbox'])):?> 
				<li><a href="<?php echo esc_url($bauen_options['dropbox']); ?>" target="_blank"><i class="ti-dropbox"></i></a></li>
				<?php endif;?>	

				<?php if(!empty($bauen_options['github'])):?> 
				<li><a href="<?php echo esc_url($bauen_options['github']); ?>" target="_blank"><i class="ti-github"></i></a>
				<?php endif;?>	
				
				<?php if(!empty($bauen_options['tumblr'])):?> 
				<li><a href="<?php echo esc_url($bauen_options['tumblr']); ?>" target="_blank"><i class="ti-tumblr-alt"></i></a></li>
				<?php endif;?>

				<?php if(!empty($bauen_options['email'])):?> 
				<li><a href="mailto:<?php echo esc_attr($bauen_options['email']); ?>" target="_blank"><i class="ti-email"></i></a></li>
				<?php endif;?>

				<?php
				$bauen_more_social = Bauen_AfterSetupTheme::return_thme_option('opt_add_more_text_social','');
				if ( ! empty( $bauen_more_social ) ) {
				foreach ( $bauen_more_social as $bauen_more_socials ) { ;?>
				<?php echo balanceTags($bauen_more_socials);?>
				<?php } } ;?> 				
			</ul>  
		</div>  						
		<?php } ;?> 		
    </aside>
	
    <?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-darksidebar');?>
		<?php } 
		else { ?> 	
			<?php wp_enqueue_style('bauen-style-onepage-lightsidebar');?>
		<?php } ?>		
		
		<?php wp_enqueue_script('bauen-custom-sidebar-one');?>	
	
	<?php } 
	else { ?> 
		<?php if (Bauen_AfterSetupTheme::return_thme_option('theme_color_style')=='st2'){ ?>
			<?php wp_enqueue_style('bauen-style-multipage-darksidebar');?>
		<?php } 
		else { ?> 	
			<?php wp_enqueue_style('bauen-style-multipage-lightsidebar');?>
		<?php } ?>		
		
		<?php wp_enqueue_script('bauen-custom-sidebar');?>	

    <?php } ?>		
	
	
    <!-- Main -->
    <div id="bauen-main">	