<?php
$select_msg = __('front_select_seats_label', true); 
$select_msg = str_replace("{TICKET}", $tpl['selected_ticket_arr']['ticket'], $select_msg);
?>
<dl class="dl-horizontal pjTbChosenSeats">
	<dt><?php echo $select_msg;?>: </dt>
	
	<dd>
		<ul id="pjEtsListChosenSeats_<?php echo $_GET['id'];?>" class="list-inline pjTbListChosenSeats">
			<?php
			foreach($tpl['seat_selected_id_arr'] as $ticket_id => $seat_id_arr)
			{
				if($ticket_id == $_GET['ticket_id'])
				{
					foreach($seat_id_arr as $seat_id)
					{
						?><li id="pjEtsSeatChosen_<?php echo $ticket_id;?>_<?php echo $seat_id;?>"><a href="#" class="pjTbSeat pjTbSeatChecked" style="width: 25px; height: 25px; "><span class="pjTbSeatInner"><?php echo isset($tpl['seat_selected_arr'][$seat_id]) ? $tpl['seat_selected_arr'][$seat_id] : NULL;?></span></a></li><?php
					}
				}
			} 
			?>
		</ul><!-- /.list-inline pjTbListChosenSeats -->
	</dd>
	<dt id="pjTbSelectMoreSeats_<?php echo $_GET['id'];?>" class="pjTbSelectMoreSeats" data-singular_msg="<?php __('front_singular_more_seat');?>" data-plural_msg="<?php __('front_plural_more_seat');?>"></dt>
</dl><!-- /.dl-horizontal pjTbChosenSeats -->
<?php
$map = PJ_INSTALL_PATH . $tpl['event_arr']['map'];
if (is_file($map))
{
	$size = getimagesize($map);
	?>
	<div class="pjTbSeatsContainer">
		<div id="pjEtsMapHolder_<?php echo $_GET['id'];?>" class="pjEtsMapHolder" style="position: relative; height: <?php echo $size[1]; ?>px; margin: 0 auto;">
			<img id="pjEtsMap_<?php echo $_GET['id'];?>" src="<?php echo PJ_INSTALL_URL . $tpl['event_arr']['map']; ?>" alt="" style="margin: 0; border: none; position: absolute; top: 0; left: 0; z-index: 50" />

			<?php
			foreach ($tpl['seat_arr'] as $seat)
			{
				$seat_class = ' pjTbSeatAvailable';
				if($seat['booked_seats'] > 0)
				{
					$seat_class = ' pjTbSeatDisabled';
				}
				foreach($tpl['seat_selected_id_arr'] as $ticket_id => $seat_id_arr)
				{
					foreach($seat_id_arr as $seat_id)
					{
						if($seat['id'] == $seat_id)
						{
							if($ticket_id == $seat['ticket_id'])
							{
								$seat_class = ' pjTbSeatChecked';
							}else{
								$seat_class = ' pjTbSeatChecked pjEtsOtherTicket';
							}
						}
					}
				}
				?><span class="pjTbSeat<?php echo $seat_class;?>" data-id="<?php echo $seat['id']; ?>" data-ticket_id="<?php echo $seat['ticket_id'];?>" data-name="<?php echo $seat['name']; ?>" style="width: <?php echo $seat['width']; ?>px; height: <?php echo $seat['height']; ?>px; left: <?php echo $seat['left']; ?>px; top: <?php echo $seat['top']; ?>px; line-height: <?php echo $seat['height']; ?>px"><span class="pjTbSeatInner"><?php echo stripslashes($seat['name']); ?></span></span><?php
			}
			?>
		</div>
	</div><!-- /.pjTbSeatsContainer -->
	<?php
} 
?>