<?php
/**
 * Header.php is generally used on all the pages of your site and is called somewhere near the top
 * of your template files. It's a very important file that should never be deleted.
 * @package Ultra WordPress Theme
 * @since 1.0
 * @author AJ Clarke : http://wpexplorer.com
 * @copyright Copyright (c) 2012, AJ Clarke
 * @link http://wpexplorer.com
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 */ ?>

<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
	<meta charset="<?php bloginfo( 'charset' ); ?>" />
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
	<title><?php wp_title(''); ?><?php if( wp_title('', false) ) { echo ' |'; } ?> <?php bloginfo('name'); ?></title>
	<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
	<?php wp_head(); // Very important WordPress core hook. If you delete this bad things WILL happen. ?>   
</head>

<body <?php body_class( of_get_option('layout','boxed') .'-layout' ); ?>>

<div id="site-wrap" class="<?php echo wpex_sitewrap_classes(); ?>">

	<?php
	// Show top bar if enabled
	if ( of_get_option('top_bar', '1' ) == '1' ) { ?>
	<div id="top-bar">
		<div id="top-bar-inner" class="boxed boxed-extended clearfix">
			<?php
			// If top bar content option isn't blank in the admin, display it
			if ( of_get_option('top_bar_left_content','Call Us Today at 1-800-999-99-99') !== '' ) { ?>
			<div id="top-bar-left">
				<?php
				// Display icon based on theme option
				if ( of_get_option('top_bar_left_content_icon','phone') !== 'Select' ) { ?>
					<span class="icon-<?php echo of_get_option('top_bar_left_content_icon','phone'); ?>"></span>
				<?php } // end icon check
				echo of_get_option('top_bar_left_content','Call Us Today at 1-800-999-99-99'); ?>
			</div><!-- #top-bar-lef -->
			<?php } // end top_bar_left_content check ?>
			<div id="top-bar-right">
				<?php
				// Display social links if enabled
				if( of_get_option('social','1') == '1' ) { ?>
					<div id="header-social">
						<?php
						// Loop through social options
						$wpex_social_links = wpex_get_social();
						foreach( $wpex_social_links as $social_link ) {
							if( of_get_option( $social_link ) ) {
								echo '<a href="'. of_get_option( $social_link ) .'" title="'. $social_link .'" target="_blank"><img src="'. get_template_directory_uri() .'/images/social/'.$social_link.'.png" alt="'. $social_link .'" /></a>';
							} // end #social_link check
						} // end foreach $social_link ?>
				</div><!-- #header-social -->
				<?php } // end social enable check ?>
				<nav id="top-bar-nav">
					<?php wp_nav_menu( array(
						'theme_location' => 'top_menu',
						'sort_column' => 'menu_order',
						'fallback_cb' => false
					)); ?>
				</nav><!-- #top-bar-nav -->
			</div><!-- #top-bar-right -->
		</div><!-- #top-bar-inner -->
	</div><!-- #top-bar -->
	<?php } // end top_bar check ?>
	
	<div id="wrap">
	
		<div id="header-wrap">
			<header id="header" class="boxed boxed-extended clearfix">
					<div id="logo" class="clearfix">
						<?php
						// Show custom image logo if defined in the admin
						if( of_get_option('custom_logo') ) { ?>
							<a href="<?php echo home_url(); ?>/" title="<?php echo get_bloginfo( 'name' ); ?>" rel="home"><img src="<?php echo of_get_option('custom_logo'); ?>" alt="<?php echo get_bloginfo( 'name' ) ?>" /></a>
						<?php }
						// No custom img logo - show text logo
							else { ?>
							 <h2><a href="<?php echo home_url(); ?>/" title="<?php echo get_bloginfo( 'name' ); ?>" rel="home"><?php echo get_bloginfo( 'name' ); ?></a></h2>
						<?php } ?>
					</div><!-- #logo -->

					
					<?php
					// Navigation for header style one
					if ( of_get_option('header_style', 'one') == 'one' ) { ?>
					<div id="navigation-wrap">
						<nav id="navigation" class="clearfix <?php if( of_get_option('header_search','1') == '1' ) echo 'with-search'; ?>">
							<?php wp_nav_menu( array(
								'theme_location' => 'main_menu',
								'sort_column' => 'menu_order',
								'menu_class' => 'sf-menu',
								'fallback_cb' => false
							)); ?>
						</nav><!-- #navigation -->
					</div><!-- #navigation-wrap -->
					<?php } ?>
					
					<?php
					// Searchform
					if( of_get_option('header_search') == '1' && of_get_option('header_style', 'one') !== 'three' ) { ?>
						<div id="header-search"><?php get_search_form(); ?></div>
						<div id="header-search-toggle"><span class="icon-search"></span></div>
					<?php } ?>
			</header><!-- #header -->
		</div><!-- #header-wrap -->
		
		<?php
		// Navigation for header style two
		if ( of_get_option('header_style', 'one') !== 'one' ) { ?>
		<div id="navigation-wrap">
			<div id="navigation-centered" class="boxed boxed-extended clearfix">
				<nav id="navigation">
					<?php wp_nav_menu( array(
						'theme_location' => 'main_menu',
						'sort_column' => 'menu_orde',
						'menu_class' => 'sf-menu',
						'fallback_cb' => false
					)); ?>
				</nav><!-- #navigation -->
			</div><!-- #navigation-centered -->
		</div><!-- #navigation-wrap -->
		<?php } ?>
		
		<div id="main-content" class="<?php if ( of_get_option('layout','boxed') == 'boxed' ) echo 'boxed'; ?> clearfix">