<?php
if (isset($tpl['arr']) && !empty($tpl['arr']))
{
	$isDestination = $_GET['action'] == 'pjActionDestinations' || ($_GET['action'] == 'pjActionPage' && (int) $tpl['arr']['id'] === 2);
	$isPage = $_GET['action'] == 'pjActionPage' && in_array($tpl['arr']['id'], array(1,3));
	?>
	<div class="page-header">
		<?php
		if ($isDestination)
		{
			?><div class="page-menu"><?php
			if (isset($tpl['dest_arr']) && !empty($tpl['dest_arr']))
			{
				?>
				<div class="dest-nav dropdown-nav">
					<a href="#" class="dropdown-toggle dropdown-closed"><?php
					$text = 'Select destination';
					if (isset($_GET['seo_url']) && !empty($_GET['seo_url']))
					{
						foreach ($tpl['dest_arr'] as $item)
						{
							if ($item['seo_url'] == $_GET['seo_url'])
							{
								$text = pjSanitize::html($item['name']);
								break;
							}
						}
					}
					echo $text;
					?></a>
				
					<ul>
					<?php
					foreach ($tpl['dest_arr'] as $item)
					{
						if (empty($item['seo_url']))
						{
							continue;
						}
						?><li>
							<a href="<?php echo $URL; ?>destinations/<?php echo $item['seo_url']; ?>/"<?php echo !isset($_GET['seo_url']) || $_GET['seo_url'] != $item['seo_url'] ? NULL : ' class="active"'; ?>><?php echo pjSanitize::html($item['name']); ?></a>
							<span>(<?php echo pjSanitize::html($item['country']); ?>)</span>
						</li><?php
					}
					?>
					</ul>
				
				</div>
				<?php
			}
			?></div><?php
		}
		?>
		<div class="page-image">
			<img src="<?php echo PJ_INSTALL_URL . $tpl['arr']['image_thumb']; ?>" alt="<?php echo pjSanitize::html($tpl['arr']['name']); ?>" />
			<h2 class="page-title"><span class="page-title-inner"><?php echo pjSanitize::html($tpl['arr']['title']); ?></span></h2>
		</div>
		<?php
		if ($isPage)
		{
			?>
			<div class="panel-outer social-box page-contact">
			<?php include dirname(__FILE__) . '/follow.php'; ?>
			</div>
			<?php if ((int) $tpl['option_arr']['o_view_subscribe'] === 1) : ?>
			<div class="panel-outer subscribe-box page-contact">
				<div class="panel-inner">
				<?php include dirname(__FILE__) . '/subscribe.php'; ?>
				</div>
			</div>
			<?php
			endif;
		}
		?>
	</div>
	<?php
	if ($isDestination)
	{
		include dirname(__FILE__) . '/share.php';
	}
	?>
	<div class="page-desc"><?php echo stripslashes($tpl['arr']['full_desc']); ?></div>
	<?php
}
?>