<?php
// Do not allow direct access to the file.
if( ! defined( 'ABSPATH' ) ) {
    exit;
}
/**
 * Header Top
 *
 */
function faster_header () {
?>
<?php if ( !get_theme_mod( 'activate_header_top' ) ) { ?>
	<div class="header-top">
<?php if ( !get_theme_mod( 'activate_header_top' ) ) { ?>
			<?php 
			if( !get_theme_mod( 'activate_header_sticky' ) ) { echo esc_html( faster_marquee_vert () ); }
    }
			if ( !get_theme_mod( 'activate_header_cart' ) ) { do_action( 'faster_header_woo_cart' ); }
			if ( get_theme_mod( 'faster_active_social' ) ) { faster_social_section (); } 
		?>
	</div>
<?php
}
?>
<div id="mobile-grid" class="grid-top">
	<!-- Site Navigation  -->
	<button id="s-button-menu" class="menu-toggle" aria-controls="primary-menu" aria-expanded="false"><img src="<?php echo esc_url(get_template_directory_uri() ) . '/images/mobile.jpg'; ?>"/></button>
	<nav id="site-navigation-mobile" class="main-navigation" role="navigation">
		<button class="menu-toggle"><?php esc_html_e( 'Menu', 'faster' ); ?></button>
		<?php wp_nav_menu( array( 
		'theme_location' => 'primary',
		'menu_id' => 'primary-menu',	
		) ); ?>
	</nav><!-- #site-navigation -->
</div>
<div id="grid-top" class="grid-top">
	<!-- Site Navigation  -->
	<button id="s-button-menu"><img src="<?php echo esc_url(get_template_directory_uri() ) . '/images/mobile.jpg'; ?>"/></button>
	<nav id="site-navigation" class="main-navigation" role="navigation">
		<button class="menu-toggle" aria-controls="primary-menu" aria-expanded="false"><?php esc_html_e( 'Menu', 'faster' ); ?></button>
		<?php wp_nav_menu( array( 
		'theme_location' => 'primary',
		'menu_id' => 'primary-menu',
		) ); ?>
	</nav><!-- #site-navigation -->
</div>
<header id="masthead" class="site-header" itemscope="itemscope" itemtype="http://schema.org/WPHeader">
<?php if( has_header_image() or (is_singular() and has_post_thumbnail() and get_theme_mod( 'faster_header_featured' )) ) { ?>
	<!-- Header Image  -->
	<div class="all-header">
	    <div class="s-shadow"></div>
		<?php if( !get_theme_mod( 'activate_header_overlay' ) ) { ?>
	    <div class="dotted"></div>
		<?php } ?>
	    <div class="s-hidden">
			<?php if (get_theme_mod( 'header_image_position' ) == 'default' ) { ?>
			<img id="masthead" style="<?php faster_heade_image_zoom_speed (); ?>" class="header-image" src='<?php echo esc_url(get_template_directory_uri() ) . '/images/header.jpg'; ?>' alt="<?php esc_attr_e( 'header image','faster' ); ?>"/>	
			<?php } ?>
			<?php if (get_theme_mod( 'header_image_position' ) == 'real' ) { ?>
			<img id="masthead" style="<?php faster_heade_image_zoom_speed (); ?>" class="header-image" src='<?php if ( !is_home() and has_post_thumbnail() and get_theme_mod( 'faster_header_featured' ) ) { the_post_thumbnail_url(); } else { header_image(); } ?>' alt="<?php esc_attr_e( 'header image','faster' ); ?>"/>	
			<?php } else { ?>
			<div id="masthead" class="header-image" style="<?php faster_heade_image_zoom_speed (); ?> background-image: url( '<?php if (  !is_home() and has_post_thumbnail() and get_theme_mod( 'faster_header_featured' ) ) { the_post_thumbnail_url(); } else { header_image(); } ?>' );"></div>
			<?php } ?>
		</div>
		<div class="site-branding">
		<?php if ( display_header_text() == true ) { 
			if ( is_front_page() && is_home() ) :
			if ( has_custom_logo() ) { ?>
				<div class="header-logo" itemprop="logo" itemscope="itemscope" itemtype="http://schema.org/Brand">
						<?php the_custom_logo(); ?>
				</div>			
		<?php } else { ?>
					<h1 class="site-title" itemscope itemtype="http://schema.org/Brand"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><span class="ml2"><?php esc_html( bloginfo( 'name' ) ); ?></span></a></h1>
					<?php
				}
				else :
				if ( has_custom_logo() ) { ?>
					<div class="header-logo" itemprop="logo" itemscope="itemscope" itemtype="http://schema.org/Brand">
							<?php the_custom_logo(); ?>
					</div>			
				<?php } else { ?>
					<p class="site-title" itemscope itemtype="http://schema.org/Brand"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><span class="ml2"><?php esc_html( bloginfo( 'name' ) ); ?></span></a></p>
					<?php
				}
				endif;
				$faster_description = esc_html(get_bloginfo( 'description', 'display' ) );
				if ( $faster_description || is_customize_preview() ) :
					?>    
					<p class="site-description" itemprop="headline">
						<span class="ml2"><?php echo esc_html($faster_description); ?></span>
					</p>
				<?php endif; ?>	
		<?php } ?>
		<?php if ( get_theme_mod( 'faster_home_button_1', 'Contacts' ) ) { ?>
		    <a <?php echo wp_kses_post( faster_animation( "faster_button_1_animation" ) ); ?> class="button-h1" href="<?php echo esc_url( get_theme_mod( 'faster_home_buttom_1_url' ) ); ?>"><div><?php echo esc_html( get_theme_mod( 'faster_home_button_1', 'Contacts' ) ); ?></div></a>
		<?php } ?>
		<?php if ( get_theme_mod( 'faster_home_button_2', 'Contacts' ) ) { ?>
		    <a <?php echo wp_kses_post( faster_animation( "faster_button_2_animation" ) ); ?> class="button-h2" href="<?php echo esc_url( get_theme_mod( 'faster_home_buttom_2_url' ) ); ?>">
				<div><?php echo esc_html( get_theme_mod( 'faster_home_button_2', 'Abous US' ) ); ?></div>
			</a>
		<?php } ?>
		</div>
		<!-- .site-branding -->
		<?php if ( get_theme_mod( 'advertise_top' ) ) { ?>
		<a <?php if( get_theme_mod( 'advertise_top_link_type' ) == "new" ) { echo "target='_blank'"; } ?> href="<?php echo esc_url( get_theme_mod( 'advertise_top_url' ) ); ?>">
			<div class="top-adv">
				<img src="<?php echo esc_url( get_theme_mod( 'advertise_top' ) ); ?>" />
			</div>
		</a>
		<?php } ?>
	</div>
<?php } ?>
</header>
	<?php 
}