<?php
/**
 * The Header for our theme.
 *
 * Displays all of the <head> section and everything up till <div id="main">
 *
 * @package Serpentsoft
 * @subpackage Adams_News 1.0
 * @since Adams News 1.0
 */
?><!DOCTYPE html>
<!--[if IE 7]>
<html class="ie ie7" <?php language_attributes(); ?>>
<![endif]-->
<!--[if IE 8]>
<html class="ie ie8" <?php language_attributes(); ?>>
<![endif]-->
<!--[if !(IE 7) | !(IE 8)  ]><!-->
<html <?php language_attributes(); ?> xmlns:og="http://ogp.me/ns#">
<!--<![endif]-->
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<title><?php wp_title( '|', true, 'right' ); ?></title>
<link rel="profile" href="http://gmpg.org/xfn/11" />

<!-- Fav Icon Logo -->
<?php if( serpentsoft_get_data('serpentsoft_upload_favicon_logo') ): ?>
    <link rel="shortcut icon" href="<?php echo serpentsoft_get_data('serpentsoft_upload_favicon_logo'); ?>" title="Favicon" />
<?php else: ?>
    <link rel="shortcut icon" href="<?php echo get_template_directory_uri() . '/favicon.ico'; ?>" title="Favicon" />
<?php endif; ?>

<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />

<?php global $post;

// add this class to solve responsive issues
$page_layout = 'middle';

/* Self Hosted Audio and Video */
if( is_single() || is_page() ):
    $get_meta = get_post_custom($post->ID);
    if( isset($get_meta['serpentsoft_post_format'][0]) && $get_meta['serpentsoft_post_format'][0] != '' ) :
        if( $get_meta['serpentsoft_post_format'][0] == 'selfaudio' ):
            wp_enqueue_style( 'serpentsoft_jPlayer_Audio_style', get_template_directory_uri() . '/framework/jPlayer-220/styles/jplayer.blue.monday.css', array(), '2.0.0', 'all' );
        endif;
        if( $get_meta['serpentsoft_post_format'][0] == 'selfvideo' ):
            wp_enqueue_style( 'serpentsoft_jPlayer_Video_style', get_template_directory_uri() . '/framework/jPlayer-220/styles/jplayer.blue.monday.css', array(), '2.0.0', 'all' );
        endif;
    endif;
    
    $post_page_layout = serpentsoft_correct_layout($post->ID); //get_post_meta($post->ID, 'serpentsoft_page_layout', true);

    // Old Post
    if (!isset($post_page_layout) || empty($post_page_layout) || $post_page_layout == 'default'){
        $page_layout = serpentsoft_get_data('serpentsoft_pagelayout');
    }
    else{
        $page_layout = $post_page_layout;
    }
    
/* Not in single or page */    
else:
    $page_layout = serpentsoft_get_data('serpentsoft_pagelayout');
endif; ?>
    
<!-- Styles Should be After Script -->

<?php wp_head(); ?>

</head>

<body <?php body_class('custom-background'); ?>>
    <?php serpentsoft_share_buttons_assign_to_body(); ?>
    
    <?php if( serpentsoft_get_data('serpentsoft_switch_top_menu') ): ?>

    <nav class="top-menu-2 visible-desktop">
    <div class="row-fluid">
        <div class="navbar navbar-inverse">
            <h2 class="hidden">Nav Top Menu</h2>

            <div class="navbar-inner">
                <div class="container-fluid">
                    <button type="button" class="btn btn-navbar collapsed" data-toggle="collapse" data-target="#divTopNav">
                        <i class="icon-reorder"></i>
                    </button>

                        <div id="divTopNav" class="nav-collapse collapse clearfix">

                        <?php $ul_topnav = '<ul id="%1$s" class="%2$s">%3$s</ul>'; ?>						

                        <?php wp_nav_menu( array(
                                'container_id' => 'divTopNav',
                                'container' => 'ul',
                                'container_class' => 'nav',
                                'theme_location' => 'topnav',
                                'menu_class' => 'nav',
                                'items_wrap' => $ul_topnav,
                                'fallback_cb' => 'serpentsoft_nav_default',
                                'walker' => new wp_bootstrap_navwalker(),
                        ) ); ?>

                        <ul class="nav pull-right">
                        
                        <?php if(serpentsoft_get_data('serpentsoft_switch_top_menu_right') && serpentsoft_get_data('serpentsoft_top_menu_layout') != 'f-none' ): ?>
                            
                            <li class="dropdown"><a href="#" class="dropdown-toggle" data-hover="dropdown" data-delay="200">
                                <?php $menu_icon = serpentsoft_get_data('serpentsoft_topmenu_title_icon');
                                    if( !empty($menu_icon) ){ ?>
                                <i class="<?php echo $menu_icon; ?>"></i>
                                <?php } ?>
                                
                                <?php echo serpentsoft_get_data('serpentsoft_topmenu_title'); ?>
                                <span class="caret"></span></a>
                                
                            <ul class="dropdown-menu about-company">
                                <li>
                                    <div class="row-fluid about-company-container">
                                        <?php get_sidebar('topmenu'); wp_reset_query(); ?>
                                    </div>
                                </li>
                            </ul>
                                
                            </li>

                        <?php endif; // Top Menu Right Section ?>

                            <?php if( serpentsoft_get_data('serpentsoft_switch_top_menu_rightDateTime') ): ?>
                            <li class="divider-vertical"></li>

                            <li>
                                <div class="span-datetime clearfix">
                                    <span><i class="bo-icon-time bo-icon-white"></i><?php echo date_i18n( serpentsoft_getDateTimeFormat('dt') , current_time( 'timestamp', 0 ) ); ?></span>
                                </div>
                            </li>

                        <?php endif; ?>

                        </ul>
                    </div>

                </div>
            </div>
        </div>
    </div>
</nav>
    
<?php if( serpentsoft_get_data('serpentsoft_switch_responsiveness') ){ ?>
    <nav class="container-fluid mobile primary_menu visible-phone visible-tablet">
        <div id="top_mobile_menu" class="menu row-fluid">
        <?php echo serpentsoft_mobile_menu( array( 'menu_name' => 'topnav', 'id' => 'top_menu_mobile', 'class' => 'top_menu_mobile span12 mobile_menu_select' ) ); ?>
        </div>
    </nav>
<?php } ?>
    
<?php endif; ?>
	

    <header>
        <div class="navbar navbar-banner">
            <div class="container-fluid">
                <div class="row-fluid">
                
                    <div class="logo-240 pull-left" itemscope itemtype="http://schema.org/Brand"><?php serpentsoft_header_logo(); ?></div>
                    <?php serpentsoft_header_adv(); ?>
                </div>
            </div>
        </div>
    </header>

    <nav class="container-fluid navbar-main visible-desktop <?php if( serpentsoft_get_data('serpentsoft_switch_menu_sticky') ): echo 'enable-fixed'; endif; ?>">
        <h2 class="hidden">Main Navigation Bar</h2>
        
        <div class="navbar">
            <div class="navbar-inner">
                <div class="clearfix">

                    <div id="divMainNav" class="nav-collapse collapse clearfix">

                    <?php $ul_menu = '<ul id="%1$s" class="%2$s">%3$s</ul>'; ?>

                    <?php wp_nav_menu( array(
                        'container_id' => 'divMainNav',
                        'container' => 'ul',
                        'container_class' => 'nav',
                        'theme_location' => 'mainnav',
                        'menu_class' => 'nav',
                        'items_wrap' => $ul_menu,
                        'fallback_cb' => 'serpentsoft_nav_default',
                        'walker' => new wp_bootstrap_navwalker(),
                        ) );
                    
                    if(serpentsoft_get_data('serpentsoft_switch_menu_random_post')): ?>
                    
                    <ul class="nav pull-right">
                    	<li class="divider-vertical"></li>
                        <li><a href="<?php echo esc_url( home_url('/') . '?random=1'); ?>" rel="tooltip" data-toggle="tooltip" data-placement="top" data-original-title="<?php _e('Random Post', 'serpentsoft'); ?>" title=""><i class="icon-random"></i></a></li>
                    </ul>
					
                    <?php endif; ?> 
                    </div>
				
                </div>
            </div>
        </div>   
    </nav>
    
    <?php if( serpentsoft_get_data('serpentsoft_switch_responsiveness') ){ ?>
        <nav class="container-fluid mobile primary_menu visible-phone visible-tablet">
            <div id="mobile_menu" class="menu row-fluid">
            <?php echo serpentsoft_mobile_menu( array( 'menu_name' => 'mainnav', 'id' => 'primary_menu_mobile', 'class' => 'top_menu_mobile span12 mobile_menu_select' ) ); ?>
            </div>
        </nav>
    <?php } ?>
    
    <!-- Begin Body -->
    <div class="container-fluid" itemscope itemtype="http://schema.org/CreativeWork">

        <?php if(serpentsoft_get_data('serpentsoft_switch_fullWidth_content') ){
            
        $fullWidth_content = serpentsoft_get_data('serpentsoft_fullWidth_custom_content_code');
        if( !empty($fullWidth_content) ){ ?>
        
        <div class="row-fluid full-width-custom-content"><div class="span12">
            <?php if( serpentsoft_get_data('serpentsoft_switch_revolution_slider') ) { echo putRevSlider($fullWidth_content); } else { echo $fullWidth_content; } ?>
        
        </div></div>
        <?php } } ?>
                
        <!-- Main Content -->
        <div class="row-fluid main-site-container-<?php echo $page_layout; ?>">

            <!-- Draw Side Bars if not Single and Page -->
            <?php serpentsoft_header_page_layout(); ?>
			
            <!-- main content -->
            <div class="span6 main-content">

                <!-- Breaking News -->
            <?php serpentsoft_header_breakingnews(); wp_reset_query(); ?>