<?php
global $current_user;
global $webh_data;
get_currentuserinfo();
$logoutuser = $logintext = $logouttext = '';
if(isset($webh_data['webhosty_logout_user']) && $webh_data['webhosty_logout_user']){
 $logoutuser = $webh_data['webhosty_logout_user'];
} 
if(isset($webh_data['webhosty_text_header']) && $webh_data['webhosty_text_header']){
 $logintext = $webh_data['webhosty_text_header'];
} 
if(isset($webh_data['webhosty_logout_text']) && $webh_data['webhosty_logout_text']){ 
 $logouttext = $webh_data['webhosty_logout_text'];
}
?>  
<nav id="nav">    
	<?php  if (has_nav_menu('webhosty_primary_menu')) {
	wp_nav_menu( array( 'theme_location' => 'webhosty_primary_menu','container' => false  , 'depth' => 4, 'walker' => new webhosty_menu_navwalker()));  
	}else{    
		wp_nav_menu( array( 'container' => false , 'depth' => 4 ) );
	}
	 if(isset($webh_data['wehosty_fieldswitch']) && $webh_data['wehosty_fieldswitch'] == '1'){
	if ( is_user_logged_in() ){ ?>  
	<ul id="user">
	<li><a accesskey="4" href="#"><?php echo esc_attr($logintext); ?> <span><?php echo esc_attr($current_user->user_login); ?></span></a></li>
	
		<li><a accesskey="6" href="<?php echo esc_url(wp_logout_url()); ?>"><?php echo esc_attr($logouttext); ?></a></li>
	</ul>  
	<?php } else { ?>
	<ul id="user">

	<li><a accesskey="6" href="<?php echo esc_url(wp_login_url()); ?>"><?php echo esc_attr($logoutuser); ?></a>
		</li>
		<?php 
		
		?>
	</ul>
	<?php }  } ?>	  
</nav>