<div class="navbar navbar-default pjVpHeader">
	<div class="navbar-header">
		<?php
		$back = '';
		if(in_array($_GET['action'], array('pjActionView', 'pjActionLogin', 'pjActionForgotPassword', 'pjActionRegister')))
		{
			$listing_url = $_SERVER['SCRIPT_NAME'] .'?controller=pjListings&amp;action=pjActionListings'. (isset($_GET['iframe']) ? '&amp;iframe' : NULL);
			$back = isset($_SESSION[$controller->defaultBackUrl]) ? (!empty($_SESSION[$controller->defaultBackUrl]) ? $_SESSION[$controller->defaultBackUrl] : $listing_url) :  $listing_url;
			?><a href="<?php echo $back; ?>" class="navbar-toggle collapsed btn btn-default pjVpBtn pjVpBtnPrimary pjVpBtnBack pull-left"><i class="fa fa-caret-left hidden-xs"></i><?php __('front_link_back'); ?></a><?php
		} 
		?>
		<button type="button" class="navbar-toggle collapsed btn btn-default pjVpBtn pjVpBtnPrimary" data-toggle="collapse" data-target="#pjVpNavAccess">
			<span class="sr-only">Toggle navigation</span>
			<span class="icon-bar"></span>
			<span class="icon-bar"></span>
			<span class="icon-bar"></span>
			<span class="icon-bar"></span>
		</button>
				
		<button type="button" class="navbar-toggle collapsed btn btn-default pjVpBtn pjVpBtnPrimary" data-toggle="collapse" data-target="#pjVpFiltersNav">Filters</button>
	</div><!-- /.navbar-header -->
	
	<div class="collapse navbar-collapse pjVpNavAccess" id="pjVpNavAccess">
		<ul class="nav navbar-nav">
			<?php
			if(in_array($_GET['action'], array('pjActionView', 'pjActionLogin', 'pjActionForgotPassword', 'pjActionRegister')) && $back != '')
			{
				?>
				<li class="hidden-xs"><a href="<?php echo $back; ?>"><i class="fa fa-caret-left"></i><?php __('front_link_back'); ?></a></li>
				<?php
			}
			if($tpl['option_arr']['o_allow_add_package'] == 'Yes')
			{ 
				$login_url = pjUtil::buildFrontUrl($_SERVER['PHP_SELF']. '?controller=pjListings&amp;action=pjActionLogin', $_GET);
				$register_url = pjUtil::buildFrontUrl($_SERVER['PHP_SELF']. '?controller=pjListings&amp;action=pjActionRegister', $_GET);
				?>
				<li<?php echo $_GET['action'] == 'pjActionLogin' ? ' class="active"' : NULL;?>><a href="<?php echo $login_url;?>"><?php __('front_menu_login'); ?></a></li>
				<li<?php echo $_GET['action'] == 'pjActionRegister' ? ' class="active"' : NULL;?>><a href="<?php echo $register_url;?>"><?php __('front_menu_register'); ?></a></li>
				<?php
			}
			?>
		</ul>
		<?php 
		if(!isset($_SESSION[$controller->defaultMethod]))
		{
			if (isset($tpl['locale_arr']))
			{
				if (count($tpl['locale_arr']) > 1)
				{
					$selected_title = '';
					foreach($tpl['locale_arr'] as $k => $locale)
					{
						if($controller->getLocaleId() == $locale['id'])
						{
							$selected_title = pjSanitize::html($locale['title']);
						}
					}
					?>
					<ul class="nav navbar-nav navbar-right">
						<li class="dropdown">
							<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><?php echo $selected_title;?> <span class="caret"></span></a>
				
							<ul class="dropdown-menu" role="menu">
								<?php
								foreach($tpl['locale_arr'] as $k => $locale)
								{
									?>
									<li>
										<a href="<?php echo $_SERVER['SCRIPT_NAME']; ?>?controller=pjFront&amp;action=pjActionSetLocale&amp;locale=<?php echo $locale['id']; ?><?php echo isset($_GET['iframe']) ? '&amp;iframe' : NULL; ?>">
											<?php echo pjSanitize::html($locale['title']);?>
										</a>
									</li>
									<?php
								} 
								?>
							</ul>
						</li>
					</ul>
					<?php
				}
			}
		} 
		?>
	</div><!-- /.collapse navbar-collapse pjVpNavAccess -->
</div><!-- /.navbar navbar-default pjVpHeader -->