<?php
if (isset($_GET['update_capcha'])) {
    ?>
    <img class="capture_image" border="0" alt="" style="vertical-align:middle" src="<?php echo get_stylesheet_directory_uri() ?>/admin/extensions/contact_form_capcha/image.php">
    <?php
    exit;
}
?><!DOCTYPE html>
<!--[if IE 7]>					<html class="ie7 no-js" <?php language_attributes(); ?>>     <![endif]-->
<!--[if lte IE 8]>              <html class="ie8 no-js" <?php language_attributes(); ?>>     <![endif]-->
<!--[if IE 9]>					<html class="ie9 no-js" <?php language_attributes(); ?>>     <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--> <html class="not-ie no-js" <?php language_attributes(); ?>>  <!--<![endif]-->

    <head>
        <?php if (!isset($content_width)) $content_width = 900; ?>
        <?php echo ThemeMakersHelperFonts::get_google_fonts_link() ?>

        <?php
        global $post;
        $meta_title = "";
        $meta_keywords = "";
        $meta_description = "";


        if (is_front_page()) {
            $meta_title = ThemeMakersThemeModel::get_option('meta_title_home');
            $meta_keywords = ThemeMakersThemeModel::get_option('meta_keywords_home');
            $meta_description = ThemeMakersThemeModel::get_option('meta_description_home');
        } else {
            if (is_single() OR is_page()) {
                $custom = get_post_custom($post->ID);
                $meta_title = @$custom["meta_title"][0];
                $meta_keywords = @$custom["meta_keywords"][0];
                $meta_description = @$custom["meta_description"][0];
            } else {
                if (is_object($post)) {
                    switch ($post->post_type) {
                        case 'post':
                            $meta_title = ThemeMakersThemeModel::get_option('meta_title_post_listing');
                            $meta_keywords = ThemeMakersThemeModel::get_option('meta_keywords_post_listing');
                            $meta_description = ThemeMakersThemeModel::get_option('meta_description_post_listing');
                            break;
                       
                        case 'gall':
                            $meta_title = ThemeMakersThemeModel::get_option('meta_title_gallery_listing');
                            $meta_keywords = ThemeMakersThemeModel::get_option('meta_keywords_gallery_listing');
                            $meta_description = ThemeMakersThemeModel::get_option('meta_description_gallery_listing');
                            break;

                        default:
                            break;
                    }
                }

                //***
                global $cat;
                $cat_head_seo_data = Thememakers_Entity_SEO_Group::get_cat_head_seo_data($cat);
                if (!empty($cat_head_seo_data['meta_title'])) {
                    $meta_title = $cat_head_seo_data['meta_title'];
                    $meta_keywords = $cat_head_seo_data['meta_keywords'];
                    $meta_description = $cat_head_seo_data['meta_description'];
                }
            }
        }

        //*******
        $_REQUEST['disable_blog_comments'] = ThemeMakersThemeModel::get_option('disable_blog_comments');
        ?>



        <title><?php echo empty($meta_title) ? get_bloginfo('name', 'display') : ($meta_title); ?></title>


        <script type="text/javascript" src="http://www.google.com/jsapi"></script>
        <?php

        wp_deregister_script('jquery');
        wp_register_script('jquery', THEMEMAKERS_THEME_URI . '/js/jquery172.js', array(), '1.7.2');
        wp_print_scripts('jquery');
        ?>
        <script type="text/javascript" src="<?php echo THEMEMAKERS_THEME_URI; ?>/js/mediaelement/mediaelement-and-player.min.js"></script>


        <?php
        $favicon = ThemeMakersThemeModel::get_option('favicon_img');
        if ($favicon) :
            ?>
            <link href="<?php echo $favicon; ?>" rel="icon" type="image/x-icon" />
        <?php else: ?>
            <link rel="shortcut icon" href="<?php echo get_stylesheet_directory_uri() ?>/favicon.ico" type="image/x-icon" />
        <?php endif; ?>

        <?php if (!empty($meta_keywords)): ?>
            <META NAME="keywords" CONTENT="<?php echo htmlspecialchars($meta_keywords, ENT_QUOTES) ?>">
        <?php endif; ?>
        <?php if (!empty($meta_description)): ?>
            <META NAME="Description" CONTENT="<?php echo htmlspecialchars($meta_description, ENT_QUOTES) ?>">
        <?php endif; ?>


        <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>,audio/mpeg; charset=<?php bloginfo('charset'); ?>" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta charset="UTF-8" />


        <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php
        $feedburner = ThemeMakersThemeModel::get_option('feedburner');
        if ($feedburner) {
            echo $feedburner;
        } else {
            bloginfo('rss2_url');
        }
        ?>" />

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

        <?php include_once THEMEMAKERS_THEME_PATH . '/ie8.php'; ?>

        <script type="text/javascript">
            var template_directory = "<?php echo THEMEMAKERS_THEME_URI; ?>/";
            var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";
            //translations
            var lang_enter_correctly = "<?php _e('Please enter correct', THEMEMAKERS_THEME_FOLDER_NAME); ?>";
            var lang_sended_succsessfully = "<?php _e('Your message has been sent successfully!', THEMEMAKERS_THEME_FOLDER_NAME); ?>";
            var lang_server_failed = "<?php _e('Server failed. Send later', THEMEMAKERS_THEME_FOLDER_NAME); ?>";
        </script>


        <link rel='stylesheet' href='<?php echo bloginfo('stylesheet_url') ?>' type='text/css' media='all' />
        <link rel="stylesheet" href="<?php echo THEMEMAKERS_THEME_URI; ?>/css/custom1.css" type="text/css" media="all" />
        <link rel="stylesheet" href="<?php echo THEMEMAKERS_THEME_URI; ?>/css/custom2.css" type="text/css" media="all" />
		
		
				
        <?php wp_head(); ?> 

        <!--[if lt IE 9]>
                        <script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE8.js"></script>
                        <script type="text/javascript" src="<?php echo THEMEMAKERS_THEME_URI; ?>/js/ie.js"></script>
        <![endif]-->


        <style type="text/css" media="print">#wpadminbar { display:none; }</style>


        <!-- HTML5 Shiv + detect touch events -->
        <script type="text/javascript" src="<?php echo THEMEMAKERS_THEME_URI; ?>/js/modernizr.custom.js"></script>


    </head>
    <?php
    $page_id = 0;
    if (is_single() OR is_page() OR is_front_page()) {
        global $post;
        $page_id = $post->ID;
    }
    ?>
	
	
    <?php echo ThemeMakersThemeModel::get_option('tracking_code'); ?>
	<?php $menu_skin = ThemeMakersThemeModel::get_option('menu_skin');
				if(empty($menu_skin)) $menu_skin="skin-1";
	?>
    <body <?php body_class('h-style-1 text-1 '.$menu_skin); ?> style="<?php echo ThemeMakersHelper::get_page_backround($page_id) ?>">
        <!-- ***************** - Wrapper - ******************* -->
        <div id="wrapper">

            <!-- ***************** - Header - ***************** -->
            <header class="clearfix">

                <!-- ***************** - Main Navigation - ***************** -->
                <nav id="navigation" class="navigation">

                    <?php wp_nav_menu(array('theme_location' => 'primary', 'container_class' => false)); ?>

					<?php $disable_user_registration = ThemeMakersThemeModel::get_option('disable_user_registration'); ?>
					
					<?php if (!$disable_user_registration) { ?>
						
                    <div class="account-wrapper">
                        <?php if (is_user_logged_in()): ?>
                            <ul id="user-account-nav">
                                <li class="admin-user"><?php _e('Hello', THEMEMAKERS_THEME_FOLDER_NAME); ?>, <?php
                        $current_user = wp_get_current_user();
                        print($current_user->display_name);
                            ?></li>
                                <li><a id="logout" href="#login-popup"><?php _e('Logout', THEMEMAKERS_THEME_FOLDER_NAME); ?></a></li>
                            </ul><!--/ #user-account-nav-->
                        <?php else: ?>
                            <ul id="user-account-nav">
                                <li><a id="login" href="#login-popup"><?php _e('Login', THEMEMAKERS_THEME_FOLDER_NAME); ?></a></li>
                                <li><a id="create" href="#create-account"><?php _e('Create an account', THEMEMAKERS_THEME_FOLDER_NAME); ?></a></li>
                            </ul><!--/ #user-account-nav-->
                        <?php endif; ?>


                    </div><!--/ .account-wrapper-->
					<?php } ?>

                </nav><!--/ #navigation-->
                <!-- ***************** - END Main Navigation - ******************* -->


                <!-- ***************** - Logo - ******************* -->
                <div id="logo">



                    <?php
                    $logo_font = ThemeMakersThemeModel::get_option('logo_font');
                    $logo_type = ThemeMakersThemeModel::get_option('logo_type');
                    $logo_text = ThemeMakersThemeModel::get_option('logo_text');
                    $logo_img = ThemeMakersThemeModel::get_option('logo_img');

                    //for footer html (login and register)
                    $_REQUEST['logo_font'] = $logo_font;
                    $_REQUEST['logo_type'] = $logo_type;
                    $_REQUEST['logo_text'] = $logo_text;
                    $_REQUEST['logo_img'] = $logo_img;

                    if (!$logo_type AND $logo_text) {
                        $default_logo_text = explode(" ", $logo_text);
                        $default_logo_text1 = "";
                        $default_logo_text2 = "";
                        if (count($default_logo_text) > 1) {
                            $default_logo_text1 = @$default_logo_text[0];
                            unset($default_logo_text[0]);
                            $default_logo_text2 = implode(" ", $default_logo_text);
                        } else {
                            $default_logo_text1 = $logo_text;
                        }
                        ?>

                        <a href="<?php echo home_url(); ?>">
                            <h1 style="font-family: '<?php echo $logo_font ?>' !important;" >
                                <?php echo $default_logo_text1; ?>
                            </h1>
                            <span style="font-family: '<?php echo $logo_font ?>' !important;" >
                                <?php echo $default_logo_text2; ?>
                            </span>
                        </a>

                    <?php } else if ($logo_type AND $logo_img) { ?>
                        <a href="<?php echo home_url(); ?>"><img src="<?php echo $logo_img; ?>" alt="<?php bloginfo('name'); ?>" /></a>
                        <?php
                    } else {

                        $bloginfo_name = get_bloginfo('name');
                        $default_logo_text = explode(" ", $bloginfo_name);
                        $default_logo_text1 = "";
                        $default_logo_text2 = "";
                        if (count($default_logo_text) > 1) {
                            $default_logo_text1 = @$default_logo_text[0];
                            unset($default_logo_text[0]);
                            $default_logo_text2 = implode(" ", $default_logo_text);
                        } else {
                            $default_logo_text1 = $bloginfo_name;
                        }
                        ?>
                        <a href="<?php echo home_url(); ?>"><h1><?php echo $default_logo_text1; ?></h1><span><?php echo $default_logo_text2; ?></span></a>
                    <?php } ?>

                    <div class="slogan"><?php bloginfo('description'); ?></div>

                </div><!--/ #logo-->
                <!-- ***************** - END Logo - ******************* -->


            </header>
            <!-- ***************** - END Header - ***************** -->


            <!-- *************** - Container - *************** -->
            <div class="container">


                <?php $hide_search_on_menu = ThemeMakersThemeModel::get_option('hide_search_on_menu'); ?>
                <?php if (!$hide_search_on_menu): ?>
                    <!-- ************** - Search - ************** -->
                    <div class="search-container">
                        <?php get_search_form(); ?>
                    </div><!--/ .search-container-->
                    <!-- *************** - END Search - *************** -->
                <?php endif; ?>


                <!-- ************** - Platform Navigation - ************** -->
                <nav id="platform-menu" class="platform-menu">

                    <a href="/" class="home"><?php _e('Home', THEMEMAKERS_THEME_FOLDER_NAME) ?></a>

                    <?php wp_nav_menu(array('menu' => 'Secondary Menu', 'container' => '')); ?>

                </nav><!--/ .platform-menu-->
                <!-- ************** - END Platform Navigation - ************** -->


                <!-- ************** - Featured Slider - ************** -->
                <?php get_template_part('slider'); ?>
                <!-- ************** - END Featured Slider - ************* -->


                <!-- ************** - Top Content Container - ************** -->

                <?php
                if (is_object($post)) {
                    $page_top = get_post_meta($post->ID, 'page_top', true);
                    if (!empty($page_top)) {
                        echo '<div class="gray-holder">' . do_shortcode(html_entity_decode($page_top)) . '<div class="clear"></div></div>';
                    }
                }
                ?>






                <!-- ************** - END Content Container - ************** -->


                <!-- ************** - Entry - ************** -->
                <div class="entry clearfix">


                    <!-- ************** - Content - ************** -->

                    <?php
                    $sidebar_position = "sbr";
                    $page_sidebar_position = "default";
										

                    if (!is_404() AND !is_author() AND !is_page_template('user_profile.php')) {
                        if (is_single() OR is_page()) {
                            $page_sidebar_position = get_post_meta(get_the_ID(), 'page_sidebar_position', TRUE);
                        }

                        if (!empty($page_sidebar_position) AND $page_sidebar_position != 'default') {
                            $sidebar_position = $page_sidebar_position;
                        } else {
                            $sidebar_position = ThemeMakersThemeModel::get_option('sidebar_position');
								if ($post->post_type == 'product'){
										$sidebar_position='no_sidebar';
								}
                        }

                        if (!$sidebar_position) {
                            $sidebar_position = "sbr";
                        }
                    } 
					
					else {
						
                        $sidebar_position = 'no_sidebar';
                    }
                    $_REQUEST['sidebar_position'] = $sidebar_position;

                    //********************************************************

                    $_REQUEST['excerpt_symbols_count'] = ThemeMakersThemeModel::get_option('excerpt_symbols_count');
                    if (!$_REQUEST['excerpt_symbols_count']) {
                        $_REQUEST['excerpt_symbols_count'] = 140;
                    }
                    $_REQUEST['show_full_content'] = ThemeMakersThemeModel::get_option('show_full_content');
                    $_REQUEST['blog_layout'] = ThemeMakersThemeModel::get_option('blog_layout');
                    ?>


                    <section class="container <?php echo $sidebar_position ?> clearfix">

                        <?php if ($sidebar_position != 'no_sidebar'){ ?>

                            <div id="content" class="clearfix">

                            <?php } else
							{ ?>
								<div id="content_full" class="clearfix">
							<?php
							}
							?>
