<?php
/**
 * $Desc
 *
 * @version    $Id$
 * @package    wpbase
 * @author     WPOpal  Team <wpopal@gmail.com, support@wpopal.com>
 * @copyright  Copyright (C) 2014 wpopal.com. All Rights Reserved.
 * @license    GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
 *
 * @website  http://www.wpopal.com
 * @support  http://www.wpopal.com/support/forum.html
 */
?>
<!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(); ?>>
<!--<![endif]-->
<head>
    <title><?php wp_title( '|', true, 'right' ); ?></title>
    <?php wp_head(); ?>
</head>

<body <?php body_class('header-v2'); ?>>
	<!-- OFF-CANVAS MENU SIDEBAR -->
    <section id="wpo-off-canvas" class="wpo-off-canvas">
        <div class="wpo-off-canvas-body">
            <div class="wpo-off-canvas-header">
                <?php get_search_form(); ?>
                <!-- <button type="button" class="close btn btn-close" data-dismiss="modal" aria-hidden="true">
                    <i class="fa fa-times"></i>
                </button> -->
                <!-- <div class="mobile-menu-header">
                    <?php //_e('Menu',TEXTDOMAIN); ?>
                </div> -->
            </div>
            <nav class="navbar navbar-offcanvas navbar-static" role="navigation">
                <?php
                $args = array(
                    'theme_location'  => 'mainmenu',
                    'container_class' => 'navbar-collapse',
                    'menu_class'      => 'wpo-menu-top nav navbar-nav',
                    'fallback_cb'     => '',
                    'menu_id'         => 'main-menu-offcanvas',
                    'walker'          => new Wpo_Megamenu_Offcanvas()
                );
                wp_nav_menu($args);
                ?>
            </nav>
        </div>
    </section>
    <!-- //OFF-CANVAS MENU SIDEBAR -->

	<?php global $woocommerce; ?>
    <!-- START Wrapper -->
	<div class="wpo-wrapper">
		<!-- HEADER -->
		<header id="wpo-header" class="wpo-header">
			<div class="container">
				<div class="header-wrap clearfix">
					<!-- LOGO -->
					<div class="logo-in-theme pull-left text-center">
						<div class="logo">
							<a href="<?php echo esc_url( home_url( '/' ) ); ?>">
								<img src="<?php echo of_get_option('logo'); ?>" alt="<?php bloginfo( 'name' ); ?>">
							</a>
						</div>
					</div>
					<!-- MENU -->
					<nav id="wpo-mainnav" data-duration="<?php echo of_get_option('megamenu-duration',400); ?>" class="wpo-megamenu <?php echo of_get_option('magemenu-animation','slide'); ?> animate navbar navbar-default" role="navigation">
						<div class="navbar-header">
							<?php wpo_renderButtonToggle(); ?>
						</div><!-- //END #navbar-header -->
						<?php
                            $args = array(  'theme_location' => 'mainmenu',
                                            'container_class' => 'collapse navbar-collapse navbar-ex1-collapse',
                                            'menu_class' => 'nav navbar-nav megamenu',
                                            'fallback_cb' => '',
                                            'menu_id' => 'main-menu',
                                            'walker' => new Wpo_Megamenu());
                            wp_nav_menu($args);
                        ?>
					</nav>
					<!-- //MENU -->
					<!-- Setting -->
					<?php //bigshop_cartpopup(); ?>
					<!-- // Setting -->
				</div>
				<div class="header-bottom">
                <?php
                    $is_vertical = is_active_sidebar('menu-vertical');
                ?>
                    <?php if($is_vertical){ ?>
					<div class="header-left widget-vertical-menu widget box col-sm-3 hidden-xs hidden-sm">
						<?php dynamic_sidebar( 'menu-vertical' ); ?>
					</div>
                    <?php } ?>



					<div class="pull-left search header-center hidden-xs hidden-sm"<?php echo (!$is_vertical)?' style="width:88%;"':''; ?>>
						<?php get_search_form(); ?>
					</div>

					<div class="pull-left header-right hidden-sm">
						<div class="config">
							<a href="#">
								<i class="fa fa-user"></i>
							</a>
							<div class="active-content">
								<?php
									$args = array( 'theme_location' => 'topmenu',
			                                'fallback_cb' => '',
			                                'menu_id' => 'top-header-menu',
			                                'container_class' =>'menu-top-menu-header-container'
			                            );
			               			wp_nav_menu($args);
								?>
                                <?php                     
                                if( function_exists( 'icl_get_languages' ) ){
                                    $languages = icl_get_languages('skip_missing=N&orderby=KEY&order=DIR&link_empty_to=str');
                                    if( is_array( $languages ) ){
                                        
                                        foreach( $languages as $lang_k=>$lang ){
                                            if( $lang['active'] ){
                                                $active_lang = $lang;
                                                unset( $languages[$lang_k] );
                                            }
                                        }

                                        // disabled
                                        if( count( $languages ) ){
                                            $lang_status = 'enabled';
                                        } else {
                                            $lang_status = 'disabled';
                                        }
                                        
                                        echo '<div class="language wpml-languages quick-button '. esc_attr( $lang_status ).'">';
                                        
                                            echo '<div class="button heading active" href="'. esc_url( $active_lang['url'] ) .'" ontouchstart="this.classList.toggle(\'hover\');">';
                                                echo '<img src="'. esc_url( $active_lang['country_flag_url'] ) .'" alt="'. esc_attr( $active_lang['translated_name'] ) .'"/>';
                                                echo esc_attr( $active_lang['translated_name'] );
                                                if( count( $languages ) ) echo '<i class="icon-down-open-mini"></i>';
                                            echo '</div>';
                                            
                                            if( count( $languages ) ){
                                                echo '<ul class="wpml-lang-dropdown">';
                                                    foreach( $languages as $lang ){
                                                        echo '<li><a href="'. esc_url( $lang['url'] ) .'"><img src="'. esc_url( $lang['country_flag_url'] ).'" alt="'. esc_attr( $lang['translated_name'] ).'"/>'. esc_attr( $lang['translated_name'] ).'</a></li>';
                                                    }
                                                echo '</ul>';
                                            }
                                            
                                        echo '</div>';
                                    }
                                }
                            ?>
							</div>
						</div>



                        <?php if( of_get_option('woo-show-minicart', true) ) : ?>
                            <div class="cart">
                                <a class="cart-contents" href="<?php echo $woocommerce->cart->get_cart_url(); ?>" title="<?php _e('View your shopping cart', 'woothemes'); ?>">
                                    <i class="fa fa-shopping-cart"></i>
                                    <span>(<?php echo sprintf(_n('%d item', $woocommerce->cart->cart_contents_count, 'woothemes'), $woocommerce->cart->cart_contents_count);?>)</span>
                                    <?php //echo $woocommerce->cart->get_cart_total(); ?>
                                </a>
                                <div class="cart-content">
                                    <div class="hide_cart_widget_if_empty"><div class="widget_shopping_cart_content"></div></div>
                                </div>
                            </div>
                        <?php endif; ?>



					</div>
				</div>
			</div>
		</header>

		<!-- //HEADER -->