<?php
defined('_FEXEC') or die();
$arrows = "&raquo;";

if (DOWN_FOR_MAINTENANCE == 'true')
	{
	$maintenance_on_at_time_raw = tep_db_query("select last_modified from " . TABLE_CONFIGURATION . " WHERE configuration_key = 'DOWN_FOR_MAINTENANCE'");
	$maintenance_on_at_time = tep_db_fetch_array($maintenance_on_at_time_raw);
	define('TEXT_DATE_TIME', $maintenance_on_at_time['last_modified']);
	}
	if(DOWN_FOR_MAINTENANCE_HEADER_OFF == 'false')
	{
		if (SHOW_TOP_BAR == 'yes') 
		{
		require_once(DIR_WS_TEMPLATES.TEMPLATE_NAME.'/content/topbar.php');
		} 
		?>	
		<header id="header" style="height:<?php 
		define('HEADER_HEIGHT', '84');
		echo HEADER_HEIGHT; //default: 84 ?>px">
		<div class="container">
		<div id="logo" class="pull-left">
		<?php 
		if(TEXT_LOGO=='yes')
		{
		?>
		<h1><a href="#body" class="scrollto"><?php echo TEXT_LOGO1; ?><span><?php echo TEXT_LOGO2; ?></span></a></h1>
		<?php //use an image
		}else
		{
		$url = '<a href="#body">' . tep_image(DIR_WS_TEMPLATES . DEFAULT_TEMPLATE . '/' . DIR_WS_IMAGES . COMPANY_LOGO, STORE_NAME, '', '') . '</a>';
		echo $url;
		}
		?>
		</div>
		<nav id="nav-menu-container">
		<ul class="nav-menu">
		<?php 
		if (SHOW_LANGUAGES_IN_HEADER == 'yes') 
		{
		//language selector
			if (!is_object($lng)) 
		{
			include(DIR_WS_CLASSES . 'language.php');
			$lng = new language;
		}
		
		if (getenv('HTTPS') == 'on') $connection = 'SSL';
		else $connection = 'NONSSL';
		
		$languages_string = '';
		$languages_active_string = '';
		reset($lng->catalog_languages);
		while (list($key, $value) = each($lng->catalog_languages)) 
		{
			
			if(basename($PHP_SELF) == 'checkout_payment_address.php') 
			{
			$languages_string='';
			}else
			{			
			$languages_string .= '
			<li>
			<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('language', 'currency')) . 'language=' . $key, $connection) . '">
			<i class="flag-icon flag-icon-' . $value['code'] . '"></i>
			&nbsp; 	&nbsp;'. $value['name'] .' 	&nbsp; 	&nbsp;
			</a>
			</li> 
			';
			}
			$languages_active_string = '
			<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('language', 'currency')) . 'language=' . $languages_code, $connection) . '">
			<i class="flag-icon flag-icon-' . $languages_code . '"></i>
			&nbsp; 	&nbsp;'. $languages_name .' 	&nbsp; 	&nbsp;</a>
			';
		}
		?>
		<li class="menu-has-children"><?php echo $languages_active_string; ?>
		<ul>
		<?php 
		echo $languages_string;
		?>
		</ul>
		<?php 
		}
		?>
		<?php
		if (SHOW_MAIN_FEATURED_CATEGORIES == 'true')
		{
		echo '<li class="fc"><a href="' . tep_href_link(FILENAME_FEATURED_CATEGORIES) . '">' . HEADING_FEATURED_CATEGORIES . '</a></li>';
		} 
		
		$looking_for = 'bor.php'; // is Box Office Reservations installed?

		if (defined('MODULE_PAYMENT_INSTALLED') && tep_not_null(MODULE_PAYMENT_INSTALLED) && $_SESSION['customer_country_id']==999) 
		{
		$modules_installed = explode(';', MODULE_PAYMENT_INSTALLED);
			if (in_array($looking_for, $modules_installed))
			{
			echo "<li><a href=\"" . tep_href_link('bor_listings.php') . "\">" . HEADER_VIEW_BOR . '</a></li>'; 
			}
		}
		?>
		<li><?php
		echo "<a href=\"" . tep_href_link(FILENAME_SHOPPING_CART) . "\">" . HEADER_TITLE_CART_CONTENTS . '</a>'; ?>
		</li>
		<li class="menu-active"><?php
		echo "<a href=\"" . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . "\">" . HEADER_TITLE_CHECKOUT . '</a>'; ?></li>
		<?php
		if (!isset($_COOKIE['customer_is_guest']))
		{ //PWA 
		?>
		<li><?php echo $log_page; ?>&nbsp;&nbsp;</li>
		<?php
		} 
		?>
		<!-- header shopping cart -->
		<?php //let's find out if there is a left column shopping cart?	
		if (SHOW_CART_IN_HEADER == 'yes') 
		{
			$shopping_cart_query = tep_db_query('select  infobox_display, infobox_file_name from ' . TABLE_INFOBOX_CONFIGURATION . ' where template_id = ' . tep_db_input(TEMPLATE_ID));

			while ($shopping_cart = tep_db_fetch_array($shopping_cart_query)) 
			{
				if (($shopping_cart['infobox_display'] == 'no')&&($shopping_cart['infobox_file_name'] == 'shopping_cart.php')) 
				{
				require_once (DIR_WS_TEMPLATES.TEMPLATE_NAME.'/shopping_cart_new.php');
				$top="_top";
				}
			}
		}
		?>
		</ul>
		</nav><!-- #nav-menu-container -->
		</div>
		</header><!-- #header -->
	<?php
	}
	//echo $category_depth;
	if($category_depth == 'top'){
	//if (substr(basename($PHP_SELF), 0, 5) == 'index') {
	if (SHOW_HEADER_PANE == 'yes') 
	{
	require_once(DIR_WS_TEMPLATES.TEMPLATE_NAME.'/content/headerbar.php');
	} 
	}
	?>		
	<br class="clearfloat">