<?php
$map = $tpl['event_arr']['map'];
if (is_file($map))
{
	$size = getimagesize($map);
	?>
	<div style="display: block; float: left;" class="b10">
		<div class="tbSelectSeatGuide"></div>
		<div class="tbAskToSelectSeats" style="display: block;"><?php __('lblSelectAvailableSeats');?></div>
		<div id="tbSelectedSeats"></div>
		<div class="tbTipToRemoveSeats" style="display: none"><?php __('lblRemoveSeats');?><br/></div>
	</div>
	<div class="tb-seats-legend b10">
		<label><span class="tb-available-seats"></span><?php __('lblAvailableSeats');?></label>
		<label><span class="tb-selected-seats"></span><?php __('lblSelectedSeats');?></label>
		<label><span class="tb-booked-seats"></span><?php __('lblBookedSeats');?></label>
	</div>
	<div class="clear_both"></div>
	<div id="boxMap">
		<div id="tbMapHolder" class="tbMapHolder" style="position: relative; overflow: hidden; width: <?php echo $size[0]; ?>px; height: <?php echo $size[1]; ?>px; margin: 0 auto;">
			<img id="map" src="<?php echo $map; ?>" alt="" style="margin: 0; border: none; position: absolute; top: 0; left: 0; z-index: 500" />
			<?php
			foreach ($tpl['seat_arr'] as $seat)
			{
				$seat_class = ' tbSeatAvailable';
				if($seat['booked_seats'] > 0)
				{
					$seat_class = ' tbSeatBlocked';
				}
				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 = ' tbSeatSelected';
							}else{
								$seat_class = ' tbSeatSelected pjTbsOtherTicket';
							}
						}
					}
				}
				?><span class="tbSeatRect<?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"><?php echo stripslashes($seat['name']); ?></span><?php
			}
			?>
		</div>
	</div>
	<?php
} 
?>