<?php
	$round_names = array('1'  => 'Round 1',						 
						 'QF' => 'Quarterfinals',
						 'SF' => 'Semifinals',
						 'F'  => 'Final',
						 'S'  => '3rd/5th Place',
						 'SC' => 'Consolation',
						 'C' => '4th/6th Place');

?>

<!-- Sub Title -->
<div style="text-align: center; color: #000000; font-size: 13pt; line-height: 2em; font-weight: bold;">
	<?php
		if (is_null($information['bracket']->location))
		{
			$sub_title = date('F j', strtotime($information['bracket']->event->start_at)) . '-' . date('j', strtotime($information['bracket']->event->end_at));
		}	
		else
		{
			$sub_title = date('F j', strtotime($information['bracket']->event->start_at)) . '-' . date('j', strtotime($information['bracket']->event->end_at)) . ', ' . $information['bracket']->location->name;
		}
	?>

	<?php echo $sub_title; ?>

</div>

<div style="width: 200px; height: 50px; position: absolute; top: 525px; left: 50px; background-image: url(<?php echo asset('images/logos/USBank_200x50px.png'); ?>); background-repeat: no-repeat;"></div>

<div style="width: 200px; height: 50px; position: absolute; top: 525px; right: 50px; background-image: url(<?php echo asset('images/logos/LesSchwab_200x50px.png'); ?>); background-repeat: no-repeat;">
</div>

<div style="width: 250px; height: 130px; position: absolute; top:600px; left: 390px; background-image: url(<?php echo asset('images/logos/OSAAStateChampionship_250x130px.png'); ?>); background-repeat: no-repeat;">
</div>

<!-- Top Half -->
<div style="height: 500px; margin-bottom: 125px;">

	<!-- Round 6, C -->
	<div class="round left" style="height: 500px; padding: 0 8px; margin-left: 20px;">
		
		<!-- Round Info -->
		<div class="info" style="margin-top: 16px;">
			<div class="title">
				<?php echo $round_names[$information['bracket']->rounds[6]->round->round_type]; ?>
			</div>
			<div class="date">
				<?php echo date('M. j', strtotime($information['bracket']->rounds[6]->event->start_at)); ?>
			</div>
		</div>

		<div class="spacer" style="height: 150px;"></div>

		<div class="connector right bottom" style="margin-top: 41px;"></div>			

		<!-- Matchups -->
		<?php for ($i = 18; $i < 19; $i++): ?>

			<?php echo BracketsController::getMatchup('left', $information['bracket']->matchups[$i]); ?>			

		<?php endfor; ?>
	

	</div>
	
	<!-- Round 5, SC -->
	<div class="round left" style="height: 500px; padding: 0 8px;">
		
		<!-- Round Info -->
		<div class="info" style="margin-top: 16px;">
			<div class="title">
				<?php echo $round_names[$information['bracket']->rounds[5]->round->round_type]; ?>
			</div>
			<div class="date">
				<?php echo date('M. j', strtotime($information['bracket']->rounds[5]->event->start_at)); ?>
			</div>
		</div>

		<div class="spacer" style="height: 48px;"></div>			


		<div class="connector left top" style="height: 101px; margin-top: 41px;"></div>			
		<div class="connector left bottom" style="height: 108px; margin-top: 144px;"></div>


		<!-- Matchups -->
		<?php for ($i = 16; $i < 18; $i++): ?>

			<div class="connector right bottom" style="margin-top: 41px;"></div>
			
			<?php echo BracketsController::getMatchup('left', $information['bracket']->matchups[$i]); ?>		
			
			<div class="spacer" style="height: 127px; position: relative;">
				<?php if ($i == 16 and
				     !is_null($information['bracket']->bracket->data) and
				     property_exists($information['bracket']->bracket->data, 'flag') and
				     property_exists($information['bracket']->bracket->data, 'show_flag') and
				     $information['bracket']->bracket->data->show_flag and
				     !Helpers::strIsEmpty($information['bracket']->bracket->data->flag)): ?>
					<div style="position: absolute; top: 49px; width: 293px; height: 25px; font-size: 8pt; line-height: 1.15em; left: 7px; color: #555555; overflow: hidden;">

						<img src="<?php echo asset('/images/icons/alert_2_16px.png'); ?>" alt="" title="" style="vertical-align: middle; width: 0.9em; height: 0.9em; margin: 0 2px 0 4px; top: -1px; position: relative;" />

						<?php echo $information['bracket']->bracket->data->flag; ?>

					</div>
				<?php endif; ?>
			</div>						

		<?php endfor; ?>

	</div>

	<!-- Round 1, QF -->
	<div class="round left" style="height: 500px; padding: 0 8px;">

		<!-- Round Info -->
		<div class="info" style="margin-top: 16px;">
			<div class="title">
				<?php echo $round_names[$information['bracket']->rounds[1]->round->round_type]; ?>
			</div>
			<div class="date">
				<?php echo date('M. j', strtotime($information['bracket']->rounds[1]->event->start_at)); ?>
			</div>
		</div>

		<!-- Matchups -->
		<?php for ($i = 8; $i < 12; $i++): ?>
			
			<?php if ($i == 8 or $i == 10): ?>
				<div class="connector right top" style="height: 47px; margin-top: 41px;"></div>			
				<div class="connector right bottom" style="height: 47px; margin-top: 90px;"></div>		

				<div class="connector left top" style="height: 47px; margin-top: 41px;"></div>			
				<div class="connector left bottom" style="height: 47px; margin-top: 90px;"></div>		
			<?php endif; ?>

			<?php echo BracketsController::getMatchup('right', $information['bracket']->matchups[$i]); ?>
			
			<?php if ($i == 9): ?>
				<div class="spacer" style="height: 32px;"></div>
			<?php else: ?>
				<div class="spacer" style="height: 12px;"></div>
			<?php endif; ?>

		<?php endfor; ?>

	</div>

	<?php if (!BracketsController::matchupHasTeams($information['bracket']->matchups[8]->matchup->id) or
	     !BracketsController::matchupHasTeams($information['bracket']->matchups[9]->matchup->id) or
	     !BracketsController::matchupHasTeams($information['bracket']->matchups[10]->matchup->id) or
	     !BracketsController::matchupHasTeams($information['bracket']->matchups[11]->matchup->id)): ?>
	
		<!-- Group Letters -->
		<div style="position: absolute; height: 500px; left: 504px; width: 24px; text-align: center;">

			<div class="group_letter" style="margin-top: 67px;">
	    	    <?php if (!BracketsController::matchupHasTeams($information['bracket']->matchups[8]->matchup->id)): ?>
	    			A
	    		<?php else: ?>
	    			&nbsp;
	    		<?php endif; ?>
			</div>
			<div class="group_letter" style="margin-top: 58px;">
				<?php if (!BracketsController::matchupHasTeams($information['bracket']->matchups[9]->matchup->id)): ?>
	    			B
	    		<?php else: ?>
	    			&nbsp;
	    		<?php endif; ?>
			</div>
			<div class="group_letter" style="margin-top: 78px;">
				<?php if (!BracketsController::matchupHasTeams($information['bracket']->matchups[10]->matchup->id)): ?>
	    			C
	    		<?php else: ?>
	    			&nbsp;
	    		<?php endif; ?>
			</div>
			<div class="group_letter" style="margin-top: 58px;">
				<?php if (!BracketsController::matchupHasTeams($information['bracket']->matchups[11]->matchup->id)): ?>
	    			D
	    		<?php else: ?>
	    			&nbsp;
	    		<?php endif; ?>
			</div>

		</div>
	<?php endif; ?>


	<!-- Round 2, SF -->
	<div class="round left" style="height: 500px; padding: 0 8px;">
		
		<!-- Round Info -->
		<div class="info" style="margin-top: 16px;">
			<div class="title">
				<?php echo $round_names[$information['bracket']->rounds[2]->round->round_type]; ?>
			</div>
			<div class="date">
				<?php echo date('M. j', strtotime($information['bracket']->rounds[2]->event->start_at)); ?>
			</div>
		</div>

		<div class="spacer" style="height: 48px;"></div>	

		<div class="connector right top" style="height: 101px; margin-top: 41px;"></div>			
		<div class="connector right bottom" style="height: 108px; margin-top: 144px;"></div>		

		<!-- Matchups -->
		<?php for ($i = 12; $i < 14; $i++): ?>

			<div class="connector left bottom" style="margin-top: 41px;"></div>

			<?php echo BracketsController::getMatchup('right', $information['bracket']->matchups[$i]); ?>
						
			<div class="spacer" style="height: 127px;"></div>						

		<?php endfor; ?>

	</div>
	
	<!-- Round 3, F -->
	<div class="round left" style="height: 500px; padding: 0 8px;">

		<!-- Round Info -->
		<div class="info" style="margin-top: 16px;">
			<div class="title">
				<?php echo $round_names[$information['bracket']->rounds[3]->round->round_type]; ?>
			</div>
			<div class="date">
				<?php echo date('M. j', strtotime($information['bracket']->rounds[3]->event->start_at)); ?>
			</div>
		</div>

		<div class="spacer" style="height: 150px;"></div>

		<div class="connector left bottom" style="margin-top: 41px;"></div>			

		<!-- Matchups -->
		<?php for ($i = 14; $i < 15; $i++): ?>

			<?php echo BracketsController::getMatchup('right', $information['bracket']->matchups[$i]); ?>
			
		<?php endfor; ?>

	</div>

	<!-- Round 4, S -->	
	<div class="round left" style="padding: 0 8px; position: absolute; left: 596px; top: 249px;">
		<!-- Round Info -->
		<div class="info" style="margin-bottom: -10px;">
			<div class="title" style="text-align: right;">
				<?php echo $round_names[$information['bracket']->rounds[4]->round->round_type]; ?>
			</div>
			<div class="date" style="text-align: right;">
				<?php echo date('M. j', strtotime($information['bracket']->rounds[4]->event->start_at)); ?>
			</div>
		</div>		

		<div class="connector right dashed" style="margin-top: -31px; height: 130px;"></div>			
		<div class="connector right bottom" style="margin-top: 41px;"></div>			

		<!-- Matchups -->
		<?php for ($i = 15; $i < 16; $i++): ?>

			<?php echo BracketsController::getMatchup('right', $information['bracket']->matchups[$i]); ?>
			
		<?php endfor; ?>

	</div>
</div>





<!-- Bottom Half -->

<div style="height: 500px;">





	<!-- Round 0 (1), Left Side -->

	<div class="round left" style="height: 500px; padding: 0 8px; margin-left: 50px;">

		

		<!-- Round Info -->

		<div class="info" style="margin-top: 16px;">

			<div class="title">

				<?php echo $round_names[$information['bracket']->rounds[0]->round->round_type]; ?>

			</div>

			<div class="date">

				<?php echo date('M. j', strtotime($information['bracket']->rounds[0]->event->start_at)); ?>

			</div>

		</div>



		<!-- Matchups -->

		<?php for ($i = 0; $i < 4; $i++): ?>



			<?php if ($i % 2 == 0): ?>

				<div class="connector right top" style="margin-top: 41px; height: 48px;"></div>

				<div class="connector right bottom" style="margin-top: 89px; right: -6px;"></div>

			<?php else: ?>

				<div class="connector right bottom" style="margin-top: -7px; height: 48px;"></div>

				<div class="connector right top" style="margin-top: -7px; right: -6px;"></div>

			<?php endif; ?>



			<?php echo BracketsController::getMatchup('right', $information['bracket']->matchups[$i]); ?>

			

			<div class="spacer" style="height: 24px;"></div>



		<?php endfor; ?>



	</div>



	<!-- Group Letters -->

	<div style="float: left; margin-left: 12px; height: 500px;">	



		<div class="group_letter" style="margin-top: 120px;">

			<?php if (!BracketsController::matchupHasTeams($information['bracket']->matchups[8]->matchup->id)): ?>

    			A

    		<?php else: ?>

    			&nbsp;

    		<?php endif; ?>

		</div>

		<div class="group_letter" style="margin-top: 178px;">

			<?php if (!BracketsController::matchupHasTeams($information['bracket']->matchups[9]->matchup->id)): ?>

    			B

    		<?php else: ?>

    			&nbsp;

    		<?php endif; ?>

		</div>



	</div>



	<!-- Round 0 (1), Right Side -->

	<div class="round right" style="height: 500px; padding: 0 8px; margin-right: 50px;">		

		

		<!-- Round Info -->

		<div class="info" style="margin-top: 16px;">

			<div class="title">

				<?php echo $round_names[$information['bracket']->rounds[0]->round->round_type]; ?>

			</div>

			<div class="date">

				<?php echo date('M. j', strtotime($information['bracket']->rounds[0]->event->start_at)); ?>

			</div>

		</div>



		<!-- Matchups -->

		<?php for ($i = 4; $i < 8; $i++): ?>



			<?php if ($i % 2 == 0): ?>

				<div class="connector left top" style="margin-top: 41px; height: 48px;"></div>

				<div class="connector left bottom" style="margin-top: 89px; left: -6px;"></div>

			<?php else: ?>

				<div class="connector left bottom" style="margin-top: -7px; height: 48px;"></div>

				<div class="connector left top" style="margin-top: -7px; left: -6px;"></div>

			<?php endif; ?>



			<?php echo BracketsController::getMatchup('left', $information['bracket']->matchups[$i]); ?>

			

			<div class="spacer" style="height: 24px;"></div>



		<?php endfor; ?>

	</div>	



	

	<!-- Group Letters -->

	<div style="float: right; margin-right: 12px; height: 500px;">

		<div class="group_letter" style="margin-top: 120px;">

    		<?php if (!BracketsController::matchupHasTeams($information['bracket']->matchups[10]->matchup->id)): ?>

    			C

    		<?php else: ?>

    			&nbsp;

    		<?php endif; ?>

		</div>

		<div class="group_letter" style="margin-top: 178px;">

			<?php if (!BracketsController::matchupHasTeams($information['bracket']->matchups[11]->matchup->id)): ?>

    			D

    		<?php else: ?>

    			&nbsp;

    		<?php endif; ?>

		</div>

	</div>



</div>





