<?php $__env->startSection('page_title'); ?>
    <?php echo $information['school']->short_name; ?>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('page_sub_title'); ?>    
   <?php echo $information['school']->name; ?>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('live_alert'); ?>

    <?php
        GeneralController::getLiveAlert();
    ?>
    
<?php $__env->stopSection(); ?>

<?php $__env->startSection('scripts'); ?>
    @parent

    <style type="text/css">
    	tbody tr.odd {
    		background-color: #f2f2f2;
    	}

    	.success_bar {
    		position: fixed;
    		top: 600px;
    		left: 0;
    		width: 100%;
    		padding: 0.25em 0;
    		line-height: 1.5em;
    		background-color: rgba(176, 255, 190, 0.0);
    		border-bottom: 2px solid rgba(13, 88, 27, 0.50);
    		border-top: 2px solid rgba(13, 88, 27, 0.50);
    		z-index: 500;
    	}

    	.success_bar .message {
    		width: 1200px;
    		margin: 0 auto;
    		font-size: 14pt;
    		color: #151515;
    	}  

    </style>

<?php $__env->stopSection(); ?>

<?php $__env->startSection('jquery_init'); ?>

	$('.button').button();
	$('.button.no_text').button({ text : false});
	$('.button.map_link').button({ icons : { primary : 'ui-icon-pin-s' }});
	$('.button.edit').button({ icons : { primary : 'ui-icon-pencil' }});
	$('.button.edit_league').button({ icons : { primary : 'ui-icon-pencil' }, text : false}).css('width', '16px').css('height', '16px').tooltip();
	$('.button.add').button({ icons : { primary : 'ui-icon-plusthick' }});
	$('.button.delete').button({ text : false, icons : { primary : 'ui-icon-closethick'}}).css('width', '16px').css('height', '16px');

	$('.tooltip').tooltip();

	$('.back_to_schools_list').button ({ icons : { primary : 'ui-icon-arrowthick-1-w'}});
	

	function colorRows ()
	{		
		$('table').each(function ()
		{
			var i = 0;

			$('tbody tr:visible', $(this)).each(function ()
			{
				if (i % 2 == 1)
				{
					$(this).addClass('odd');
				}
				else
				{
					$(this).removeClass('odd');
				}
				i = i + 1;
			});		


		});		
	}

	colorRows();

	$('.success_bar').animate({ 'top' : 32, 'background-color' : 'rgba(176, 255, 190, 1.0)'}, 1600, 'easeOutQuad', function ()
	{		
		$(this).delay(6000).fadeOut(4000);	

		$(this).hover(function ()
		{
			$(this).stop(true).css('opacity', '1.0');
		},
		function ()
		{
			$(this).fadeOut(4000);
		})
	});	
	
	$('.staff_info')
		.button({ text : false,
		          icons : { primary : 'ui-icon-help'}})
		.css({'width' : '16px', 'height' : '16px'})
		.tooltip()
		.click(function ()
		{
			var staff_obj = $(this);
			var staff_id = $(staff_obj).attr('data-staff-id');			
			var staff_lookup = $(staff_obj).attr('data-lookup');

			$('<div></div>')
			    .appendTo('body')			    
			    .dialog(
			    {	      		    
	      			dialogClass: 'contact_information_card',
	      			resizable: false,
	      			height: 200,
	      			<?php if (Auth::check() and Auth::user()->isOsaaUser()): ?>
	      			width: 600,
	      			<?php else: ?>
	      			width: 400,
	      			<?php endif; ?>
	      			modal: false,	      			
	      			title: 'Contact Information',
			      	open : function ()
				    	{  
				       		var dialog_object = $(this);				       		

				       		dialog_object.html("<div class='ajax_loader' style='width:16px; height:11px; margin:4em auto; background-image: url(http://www.osaa.org/images/icons/ajax_loader2.gif); background-repeat:no-repeat;'></div>");          

				          	var jqxhr = $.ajax({
				          							type : 'GET',
				          							url : 'http://www.osaa.org/' + staff_lookup + '/' + staff_id,
				          							dataType : 'html'
				          						})
				          						.done(function (data)
												{
			                                    	dialog_object.html(data);
			                                        
			                                    }).fail(function (jqXHR, status, error)
			                                    {			                                    	
			                                    	var response = jqXHR.responseText;
			                                    	var errorData = $.parseJSON(response);			                                    	
			                                    	console.log(errorData);
			                                    	dialog_object.html('<h3 style="margin: 0.5em 0;">' + errorData.error.type + '</h3>' + errorData.error.message + '<br /><br /><span style="font-size: 9pt;">Line ' + errorData.error.line + ' in ' + errorData.error.file);

			                                    	if (dialog_object.html() == '')
			                                    	{
			                                    		dialog_object.html('There was an error.');
			                                    	}
			                                    });	

			                $('.contact_information_card .ui-widget-header').addClass('ui-state-hover');
			                $('.contact_information_card .ui-dialog-title').css('font-size', '11pt');
				      	}
				});
		});

	<?php if (Auth::check() and Auth::user()->canAccessSchoolTask($information['school']->id, 'ADMIN')): ?>	

		$('.edit_activity_staff')
			.button({ icons : { primary : 'ui-icon-person'}})
			.css({'font-size' : '9pt',
			      'right' : '0',
			      'top' : '0.75em',
			      'float' : 'right',
			      'position' : 'relative'})
			.tooltip();


		$('.add_staff_contact')
			.button({ icons : { primary : 'ui-icon-plusthick'}})
			.css({'font-size' : '9pt',
			      'right' : '0',
			      'top' : '0.75em',
			      'float' : 'right',
			      'position' : 'relative'})
			.tooltip()
			.click(function ()
			{
				var button_obj = $(this);
				var school_id = $(button_obj).attr('data-school-id');
				<?php if (!Helpers::strIsEmpty($information['school_district']->id)): ?>
					var school_district_id = <?php echo $information['school_district']->id; ?>;
				<?php else: ?>
					var school_district_id = '';
				<?php endif; ?>

				$('<div></div>')
				    .appendTo('body')			    
				    .dialog(
				    {	      		    
		      			dialogClass: 'add_staff_contact_dialog',
		      			resizable: false,
		      			height: 430,	      			
		      			width: 700,	      			
		      			modal: true,	      			
		      			title: 'Add Staff Contact',
		      			buttons: [
		      				{
		      					text : "Create Contact",
		      		   			'class' : "float_left",
		      		   			icons : { primary : 'ui-icon-disk'},
		      		   		 	click : function()
		      		   		  		  {   
						            	  // Submit the form
						            	  $('form', $(this)).submit();

								          $(this).dialog("close");

								          return true;
								       }
							},										
							{
								text : "Cancel",
								'class' : "float_right",
								'autofocus' : true,
								icons : { primary : 'ui-icon-cancel'},
								click : function()
										{
								        	$(this).dialog( "close" );								          	
								          	$(this).remove();
								          	return false;
								        }
							}
						],
				      	open : function ()
					    	{  
					       		function checkRole()
								{
									var value = $('#role').val();

									if (value == 'Prin.' || value == 'AD' || value == 'AT' || value == 'Doc.' || value == 'Supt.')
									{
										$('#is_on_rosters').val(1);
										
									}
									else
									{
										$('#is_on_rosters').val(0);
									}
								}

					       		var dialog_object = $(this);				       		

					       		dialog_object.html("<div class='ajax_loader' style='width:16px; height:11px; margin:4em auto; background-image: url(http://www.osaa.org/images/icons/ajax_loader2.gif); background-repeat:no-repeat;'></div>");

					          	var jqxhr = $.ajax({
					          							type : 'GET',
					          							url : 'http://www.osaa.org/schools/add-staff',
					          							data : { 'school_id' : school_id, 'school_district_id' : school_district_id},
					          							dataType : 'html'
					          						})
					          						.done(function (data)
													{
				                                    	dialog_object.html(data);

														$('#role').on('change', function ()
														{															
														    checkRole();			
														});

														checkRole();

														<?php if (Auth::check() and Auth::user()->isOsaaUser()): ?>
															$('#is_on_rosters').removeAttr('disabled');
														<?php endif; ?>														
				                                        
				                                    }).fail(function (jqXHR, status, error)
				                                    {			                                    	
				                                    	var response = jqXHR.responseText;
				                                    	var errorData = $.parseJSON(response);			                                    	
				                                    	console.log(errorData);
				                                    	dialog_object.html('<h3 style="margin: 0.5em 0;">' + errorData.error.type + '</h3>' + errorData.error.message + '<br /><br /><span style="font-size: 9pt;">Line ' + errorData.error.line + ' in ' + errorData.error.file);

				                                    	if (dialog_object.html() == '')
				                                    	{
				                                    		dialog_object.html('There was an error.');
				                                    	}
				                                    });					               
				                
				                $('.add_staff_contact_dialog .ui-dialog-title').css('font-size', '11pt');
				                $('.ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '9pt');
				          		$('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%');	

				          		$(this).parent().find('[autofocus]').focus();	
	      
					      	}
					});
			});


		$('.edit_staff_info')
			.button({ text : false,
			          icons : { primary : 'ui-icon-pencil'}})
			.css({'width' : '16px', 'height' : '16px'})
			.tooltip()
			.click(function ()
		{
			var staff_obj = $(this);
			var staff_id = $(staff_obj).attr('data-staff-id');			
			var staff_lookup = $(staff_obj).attr('data-lookup');

			$('<div></div>')
			    .appendTo('body')			    
			    .dialog(
			    {	      		    
	      			dialogClass: 'edit_contact_information_card',
	      			resizable: false,
	      			height: 525,	      			
	      			width: 700,	      			
	      			modal: true,	      			
	      			title: 'Edit Contact Information',
	      			buttons: [
	      				{
	      					text : "Save Changes",
	      		   			'class' : "float_left",
	      		   			icons : { primary : 'ui-icon-disk'},
	      		   		 	click : function()
	      		   		  		  {                   							          
							          $('form', $(this)).submit();

							          $(this).dialog("close");							          

							          return true;
							       }
						},
						{
	      					text : "Replace this Person",
	      		   			'class' : "float_left",
	      		   			'style' : "margin-left: 35px;",
	      		   			icons : { primary : 'ui-icon-closethick'},
	      		   		 	click : function()
	      		   		  		    {                   
							          	// Confirm the user's choice
							          	var result = confirm("Are you sure you want to retire this current person's contact information?\n\nThis will remove the person from his/her current position.  Once this person is removed, you will be able to add a new staff contact as a replacement.");

							          	if (result == true)
							          	{
							            	// Create a flag to retire this staff
							            	var input = $('<input>')
							            				    .attr('type', 'hidden')
							            				    .attr('name', 'replace')
							            				    .val('true');

							            	// Append the flag to the form submission
							            	$('form', $(this)).append($(input));

							            	// Submit the form
							            	$('form', $(this)).submit();

									        $(this).dialog("close");

									        return true;
							            }
							            else
							           	{
							           		return false;
							           	}
							          
							        }
						},						
						{
							text : "Cancel",
							'class' : "float_right",
							'autofocus' : true,
							icons : { primary : 'ui-icon-cancel'},
							click : function()
									{
							        	$(this).dialog( "close" );
							        	$(this).remove();
							          	return false;
							        }
						}
					],
			      	open : function ()
				    	{  
				       		var dialog_object = $(this);				       		

				       		dialog_object.html("<div class='ajax_loader' style='width:16px; height:11px; margin:4em auto; background-image: url(http://www.osaa.org/images/icons/ajax_loader2.gif); background-repeat:no-repeat;'></div>");          

				          	var jqxhr = $.ajax({
				          							type : 'GET',
				          							url : 'http://www.osaa.org/' + staff_lookup + '/' + staff_id,
				          							dataType : 'html'
				          						})
				          						.done(function (data)
												{
			                                    	dialog_object.html(data);
			                                        
			                                    }).fail(function (jqXHR, status, error)
			                                    {			                                    	
			                                    	var response = jqXHR.responseText;
			                                    	var errorData = $.parseJSON(response);			                                    	
			                                    	console.log(errorData);
			                                    	dialog_object.html('<h3 style="margin: 0.5em 0;">' + errorData.error.type + '</h3>' + errorData.error.message + '<br /><br /><span style="font-size: 9pt;">Line ' + errorData.error.line + ' in ' + errorData.error.file);

			                                    	if (dialog_object.html() == '')
			                                    	{
			                                    		dialog_object.html('There was an error.');
			                                    	}
			                                    });	
			                
			                $('.edit_contact_information_card .ui-dialog-title').css('font-size', '11pt');
			                $('.ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '9pt');
			          		$('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%');	

			          		$(this).parent().find('[autofocus]').focus();		      
				      	}
				});
		});

		<?php if (!is_null($information['execute_function'])): ?>

			var execute_function = "<?php echo $information['execute_function']; ?>";
			var execute_function_data = "<?php echo $information['execute_function_data']; ?>";

			// Execute function "edit_staff", click the edit staff pencil icon matching the given staff ID 
			if (execute_function == "edit_staff")
			{
				var button = $('[data-staff-id="' + execute_function_data + '"]')[0];
				button.click();
			}

		<?php endif; ?>


	<?php endif; ?>

	<?php if (Auth::check() and Auth::user()->isOsaaUser()): ?>	

		$('.button.add_coop')
			.button({ icons : { primary : 'ui-icon-link' }})						
			.tooltip()
			.click(function ()
			{
				var button_obj = $(this);
				var school_id = $(button_obj).attr('data-school-id');							

				$('<div></div>')
				    .appendTo('body')			    
				    .dialog(
				    {	      		    
		      			dialogClass: 'add_coop_dialog',
		      			resizable: false,
		      			height: 675,
		      			width: 675,
		      			modal: true,
		      			title: 'Add Cooperation',
		      			buttons: [
		      				<?php if (count($information['aps']) > 0): ?>
		      				{
		      					text : "Create Coop",
		      		   			'class' : "float_left",
		      		   			icons : { primary : 'ui-icon-disk'},
		      		   		 	click : function()
		      		   		  		  {                   							          
								          // Confirm the user's choice
							          	  var result = confirm("Are you sure you want to create this new coop?\n\nAre the schools correct?  Did you select the right activity?  Are the years accurate?");
  
							          	  if (result == true)
							          	  {
							                  $('form', $(this)).submit();

									          $(this).dialog("close");							          

									          return true;
							              }
							              else
							           	  {
							           		  return false;
							           	  }
								         
								       }
							},
							<?php endif; ?>							
							{
								text : "Cancel",
								'class' : "float_right",
								'autofocus' : true,
								icons : { primary : 'ui-icon-cancel'},
								click : function()
										{
								        	$(this).dialog( "close" );
								        	$(this).remove();
								          	return false;
								        }
							}
						],
				      	open : function ()
					    	{  
					       		var dialog_object = $(this);				       		

					       		dialog_object.html("<div class='ajax_loader' style='width:16px; height:11px; margin:4em auto; background-image: url(http://www.osaa.org/images/icons/ajax_loader2.gif); background-repeat:no-repeat;'></div>");          

					          	var jqxhr = $.ajax({
					          							type : 'GET',
					          							url : 'http://www.osaa.org/schools/' + school_id + '/coops/new',
					          							dataType : 'html'
					          						})
					          						.done(function (data)
													{
				                                    	dialog_object.html(data);
				                                        
				                                    }).fail(function (jqXHR, status, error)
				                                    {			                                    	
				                                    	var response = jqXHR.responseText;
				                                    	var errorData = $.parseJSON(response);			                                    	
				                                    	console.log(errorData);
				                                    	dialog_object.html('<h3 style="margin: 0.5em 0;">' + errorData.error.type + '</h3>' + errorData.error.message + '<br /><br /><span style="font-size: 9pt;">Line ' + errorData.error.line + ' in ' + errorData.error.file);

				                                    	if (dialog_object.html() == '')
				                                    	{
				                                    		dialog_object.html('There was an error.');
				                                    	}
				                                    });	
				                
				                $('.add_coop_dialog .ui-dialog-title').css('font-size', '11pt');
				                $('.ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '9pt');
				          		$('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%');	

				          		$(this).parent().find('[autofocus]').focus();		      
					      	}
					});
			});


		$('#confirm_delete_ap').dialog({
	      autoOpen: false,
	      resizable: false,
	      height:515,
	      width: 500,
	      modal: true,
	      buttons: [
	      				{
	      					text : "Yes",
	      		   			'class' : "float_left",
	      		   			icons : { primary : 'ui-icon-check'},
	      		   		 	click : function()
	      		   		  		  {                   
							          $(this).dialog("close");

							          var ap = $(this).attr('data-ap');
							          
							          var request = $.ajax(
										{
										    type : 'POST',
										    url : 'http://www.osaa.org/schools/drop-activity-program',
										    data : {
										               'ap_id' : ap			               
										           },
										    dataType : 'html'
										});
										
										request.always(function (data)
										{
										    location.reload();
										});

							          return true;
							       }
						},
						{
							text : "Cancel",
							'class' : "float_right",
							icons : { primary : 'ui-icon-cancel'},
							click : function()
									{
							        	$(this).dialog( "close" );							        	
							          	return false;
							        }
						}
					],
	      open : function ()
			      {  		         
			          $('.ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '10pt');
			          $('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%');
			      }
	    });  

		$('.button.confirm').click(function ()
		{		
			var ap = $(this).attr('data-ap');		
			var action = $(this).attr('data-confirm');
			
			$('#confirm_delete_ap').html(action)
							       .attr('data-ap', ap)							   
							       .dialog('open');
		});

		$('#add_ap').dialog({
	      autoOpen: false,
	      resizable: false,
	      height:525,
	      width: 500,
	      modal: true,
	      buttons:
	      		[
	      			{
	        			text : "Add",
	        			'class' : 'float_left',
	        			icons : { primary : 'ui-icon-check'},
	        			click : function()
	        					{                   

									$(this).dialog("close");

									var school = $(this).attr('data-school');

									var request = $.ajax(
									{
									    type : 'POST',
									    url : 'http://www.osaa.org/schools/add-activity-program',
									    data : $('form').serializeArray(),
									    dataType : 'html'
									});

									request.always(function (data)
									{
									    location.reload();
									});

									return true;
						        }
					},
					{
	        			text : "Cancel",
	        			'class' : 'float_right',
	        			icons : { primary : 'ui-icon-cancel'},
	        			click : function()
	        					{
	          						$(this).dialog( "close" );	          						
	          						return false;
	        					}
	        		}
	        	],      
	      open : function ()
		      	{  
		       		$('#add_ap').html("<div class='ajax_loader' style='width:16px; height:11px; margin:4em auto; background-image: url(http://www.osaa.org/images/icons/ajax_loader2.gif); background-repeat:no-repeat;'></div>");          
		          
		          	var school = $(this).attr('data-school');

		          	var jqxhr = $.ajax({
		          							type : 'GET',
		          							url : 'http://www.osaa.org/schools/add-activity-program',
		          							data : { 'school' : school},
		          							dataType : 'html'
		          						})
		          						.done(function (data)
										{
	                                    	$('#add_ap').html(data);
	                                        
	                                    }).fail(function ()
	                                    {
	                                    	$('#add_ap').html('There was an error, you might not have access to this feature.');
	                                    });

		          	$('.ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '10pt');
			       	$('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%');                                      
		      	}
	    });  

		$('.button.add').click(function ()
		{		
			var school = $(this).attr('data-school');				
			
			$('#add_ap').attr('data-school', school)							   
				        .dialog('open');
		});


		$('.button.edit_league').click(function()
		{
			var button_object = $(this);
			var ap_id = button_object.attr('data-ap-id');

			$('<div></div>')
			    .appendTo('body')			    
			    .dialog(
			    {	      		    
	      			resizable: false,
	      			height: 415,
	      			width: 500,
	      			modal: true,
	      			title: 'Edit Activity Program League',
			        buttons:
			      		[
			      			{
			        			text : "Save",
			        			'class' : 'float_left',
			        			icons : { primary : 'ui-icon-disk'},
			        			click : function()
			        					{                   
											$(this).dialog("close");											

											var view_data = $('form').serializeArray();
											view_data.push({name : 'ap_id', value : ap_id});

											console.log(view_data);

											var request = $.ajax(
											{
											    type : 'POST',
											    url : 'http://www.osaa.org/schools/edit-activity-program-league',
											    data : view_data,
											    dataType : 'html'
											});											

											request.always(function (data)
											{
											    location.reload();
											});											

											return true;
								        }
							},
							{
			        			text : "Cancel",
			        			'class' : 'float_right',
			        			icons : { primary : 'ui-icon-cancel'},
			        			click : function()
			        					{
			          						$(this).dialog("close");
			          						$(this).remove();
			          						return false;
			        					}
			        		}
			        	],      
			      	open : function ()
				    	{  
				       		var dialog_object = $(this);

				       		dialog_object.html("<div class='ajax_loader' style='width:16px; height:11px; margin:4em auto; background-image: url(http://www.osaa.org/images/icons/ajax_loader2.gif); background-repeat:no-repeat;'></div>");          

				          	var jqxhr = $.ajax({
				          							type : 'GET',
				          							url : 'http://www.osaa.org/schools/edit-activity-program-league',
				          							data : { 'ap_id' : ap_id},
				          							dataType : 'html'
				          						})
				          						.done(function (data)
												{
			                                    	dialog_object.html(data);
			                                        
			                                    }).fail(function (jqXHR, status, error)
			                                    {			                                    	
			                                    	var response = jqXHR.responseText;
			                                    	var errorData = $.parseJSON(response);			                                    	
			                                    	console.log(errorData);
			                                    	dialog_object.html('<h3 style="margin: 0.5em 0;">' + errorData.error.type + '</h3>' + errorData.error.message + '<br /><br /><span style="font-size: 9pt;">Line ' + errorData.error.line + ' in ' + errorData.error.file);

			                                    	if (dialog_object.html() == '')
			                                    	{
			                                    		dialog_object.html('There was an error.');
			                                    	}
			                                    });
			                

				          	$('.ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '10pt');
					       	$('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%');                                      
				      	}
			    });
		});
	<?php endif; ?>

<?php $__env->stopSection(); ?>

<?php $__env->startSection('page_functions'); ?>	

    <?php if (Helpers::strEqual($information['member_type'], 'Full Member')): ?>
		<a href="<?php echo url('/schools/full-members'); ?>" class="back_to_schools_list" style="font-size:9pt;">All Member Schools</a>
    <?php else: ?>
    	<a href="<?php echo url('/schools/associate-members'); ?>" class="back_to_schools_list" style="font-size:9pt;">All Associate Schools</a>
    <?php endif; ?>

<?php $__env->stopSection(); ?>


<?php $__env->startSection('main_content'); ?>    		
	
	<?php if (Session::has('success')): ?>

		<div class="success_bar">
			<div class="message">				
				<?php echo Session::get('success'); ?>
			</div>			
		</div>

	<?php endif; ?> 


	<div style="float:left; width:128px; margin-right: 40px; text-align: left;">
		<?php
			$image_url = ImagesController::getImageURL($information['school']->short_name, 'logo', '128x128');
		?>
		<?php if (!is_null($image_url)): ?>
			<img src="<?php echo $image_url; ?>" alt="" title="<?php echo $information['school']->name; ?> Logo" class="tooltip" style="width:128px; height:128px;" />
		<?php else: ?>		
			<img src="<?php echo asset('images/no_logo.png'); ?>" alt="" title="No School Logo Available" class="tooltip" style="width:128px; height:128px;" />
		<?php endif; ?>
		
		<br /><br />
		
		<h4>Mascot</h4>
		<?php echo $information['mascot']->name; ?>


	</div>


	
	
	<div class="columns">

		<div class="fourth">

			<h4>School Type</h4>
			<?php if (Helpers::strEqual($information['school']->school_type, 'PRI')): ?>
				Private School
			<?php elseif (Helpers::strEqual($information['school']->school_type, 'CHR')): ?>
				Public School - Charter
			<?php else: ?>
				Public School
			<?php endif; ?>

			<br /><br />
			
			<?php if (Helpers::strEqual($information['member_type'], 'Full Member')): ?>
	    		<h4>Regular District</h4>
	    		<?php echo preg_replace('/\(.*\)/', '', $information['league']->slug); ?> <?php echo $information['league']->name; ?>

	    		<br /><br />
	    	<?php endif; ?>

	    	<h4>Phone</h4>
	    	<?php if ($information['main_phone']): ?>				
				<?php echo Helpers::displayPhone($information['main_phone']->number, $information['main_phone']->extension); ?>
			<?php endif; ?>

			<br /><br />

			<h4>Fax</h4>
			<?php if ($information['fax']): ?>				
				<?php echo Helpers::displayPhone($information['fax']->number, $information['fax']->extension); ?>
			<?php endif; ?>
	    </div>

	    <div class="fourth" style="width: 30%; overflow: hidden; text-overflow: ellipsis;">
			<h4>Website</h4>
			<?php if (!Helpers::strEqual($information['school']->website, 'none')): ?>
				<a href="<?php echo $information['school']->website; ?>" target="_blank"><?php echo $information['school']->website; ?></a>
			<?php else: ?>
				<?php echo $information['school']->website; ?>
			<?php endif; ?>

			<br /><br />

			<h4>School District</h4>
			<?php echo $information['school_district']->name; ?>

			<br /><br />

			<?php if (!is_null($information['map_link'])): ?>
				<a href="<?php echo $information['map_link']; ?>" target="_blank" class="float_right button map_link tooltip" title="View school on a map or get directions." style="font-size:8pt; margin-right:20px;">Map</a> 
			<?php endif; ?>
			
			<h4>Address</h4>
			<?php if (!is_null($information['address'])): ?>
				<?php echo $information['address']->line_1; ?><br />
				
				<?php if (!Helpers::strIsEmpty ($information['address']->line_2)): ?>
					<?php echo $information['address']->line_2; ?>
					<br />
				<?php endif; ?>

				<?php echo $information['address']->city; ?>, <?php echo $information['address']->state; ?> <?php echo $information['address']->zip; ?>

			<?php endif; ?>


	    </div>

		<?php if (Helpers::strEqual($information['member_type'], 'Full Member')): ?>
		    <div class="fourth">
		    	
		    	<div class="float_right" style="position: relative;">
		    			<h4>Hy-Tek Code</h4>
		    			<div style="margin-top: 0.25em; font-family: monospace; letter-spacing: 2px; font-size: 12pt;"><?php echo $information['school']->hytek_code; ?></div>

		    		<?php if (Auth::check() and Auth::user()->isOsaaUser()): ?>

		    			<br />

			    		<h4><img src="<?php echo asset('images/icons/shield_16px.png'); ?>" alt="" title="" style="vertical-align: middle;" /> Key Code</h4>
			    		<div style="margin-top: 0.25em; font-family: monospace; letter-spacing: 2px; font-size: 12pt;"><span style="padding-bottom: 0.25em; border-bottom: 1px solid #7d7b7d;"><?php echo substr($information['school']->key_code, 0, 4); ?></span><?php echo substr($information['school']->key_code, 4, 4); ?></div>
			    		<div style="font-size: 7pt; color: #7d7b7s; padding-top: 0.5em;">(Coaches)</div>
			    	
			    	<?php endif; ?>
		    	</div>

		    	<h4>Classification</h4>
		    	<?php echo $information['classification']; ?>

		    	<br /><br />

		    	<h4>Colors</h4>
		    	<?php if (count ($information['colors']) > 0): ?>
					<div style="">			
						<?php foreach ($information['colors'] as $color): ?>		
							
							<div class="" style="float:left; width:24px; height:24px; background-color:#<?php echo $color->hex; ?>; margin-right:4px; border:1px solid #d9e1e0;"></div>
							
							<div class="" style="height: 24px; line-height: 24px; margin-bottom: 8px;">
								<?php echo $color->name; ?>
							</div>							

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


				<?php if (Auth::check() and Auth::user()->canAccessSchoolTask($information['school']->id, 'ADMIN')): ?>

					<br /><br />

		        	<a href="<?php echo url('/schools/' . $information['school']->id . '/edit'); ?>" class="button edit" style="font-size:9pt;">Edit School Information</a>

		        <?php endif; ?>


		    	
		    </div>
		<?php else: ?>

			<div class="fourth">				
				<?php if (Auth::check() and Auth::user()->canAccessSchoolTask($information['school']->id, 'ADMIN')): ?>					

					<br />

		        	<a href="<?php echo url('/schools/' . $information['school']->id . '/edit'); ?>" class="button edit" style="font-size:9pt;">Edit School Information</a>

		        <?php endif; ?>		    	

		    </div>

		<?php endif; ?>

	</div>	

	<br class="clear" /><br />

	<?php if (Auth::check() and Auth::user()->canAccessSchoolTask($information['school']->id, 'ADMIN')): ?>
		<div class="add_staff_contact" data-school-id="<?php echo $information['school']->id; ?>">Add Staff Contact</div>
	<?php endif; ?>

	<h2>Contact Information</h2>
	
	<?php if (!is_null($information['school_district_staff']) or !is_null($information['school_staff'])): ?>		

		<table class="school_contacts">			

			<thead class="head ui-widget-header">
				<tr>
					<th class="role">Position</th>
					<th class="name">Name</th>
					<th class="phone">Phone</th>
					<th class="email">Email</th>
					<th class="action"></th>						
				</tr>
			</thead>

			<tbody>

				<?php if (!is_null($information['school_district_staff'])): ?>
				<?php foreach ($information['school_district_staff'] as $staff): ?>

					<tr class="contact">
						<td class="role"><?php echo $staff->display_role; ?></td>
						<td class="name"><?php echo $staff->display_name; ?></td>
						<td class="phone"><?php echo $staff->display_phone; ?></td>
						<td class="email"><?php echo $staff->display_email; ?></td>
						<td class="action" style="text-align: right;">
							<?php if (Auth::check() and Auth::user()->canAccessSchoolTask($information['school']->id, 'ADMIN')): ?>
								<div class="edit_staff_info" title="Edit Contact Information" data-staff-id="<?php echo $staff->id; ?>" data-lookup="school-district/staff/edit"></div>
							<?php endif; ?>
							<div class="staff_info" title="More Information" data-staff-id="<?php echo $staff->id; ?>" data-lookup="school-district/staff"></div>
						</td>
					</tr>

				<?php endforeach; ?>				
				<?php endif; ?>

				<?php if (!is_null($information['school_staff'])): ?>
				<?php foreach ($information['school_staff'] as $staff): ?>

					<tr class="contact">
						<td class="role"><?php echo $staff->display_role; ?></td>
						<td class="name"><?php echo $staff->display_name; ?></td>
						<td class="phone"><?php echo $staff->display_phone; ?></td>
						<td class="email"><?php echo $staff->display_email; ?></td>
						<td class="action" style="text-align: right;">
							<?php if (Auth::check() and Auth::user()->canAccessSchoolTask($information['school']->id, 'ADMIN')): ?>
								<div class="edit_staff_info" title="Edit Contact Information" data-staff-id="<?php echo $staff->id; ?>" data-lookup="schools/staff/edit"></div>
							<?php endif; ?>
							<div class="staff_info" title="More Information" data-staff-id="<?php echo $staff->id; ?>" data-lookup="schools/staff"></div>
						</td>
					</tr>

				<?php endforeach; ?>				
				<?php endif; ?>

			</tbody>

		</table>

	<?php endif; ?>

	

	<?php if (Helpers::strEqual($information['member_type'], 'Full Member')): ?>

		<br />

		<?php if (Auth::check() and Auth::user()->isOsaaUser()): ?>
			<?php if (Helpers::strEqual(Auth::user()->email, array('kellyf@osaa.org', 'meridithp@osaa.org', 'gibbyr@osaa.org', 'peterw@osaa.org'))): ?>		
				<div class="button add float_right"
					 style="font-size: 9pt; position: relative; top: 0.75em; margin-left: 20px;"
					 data-school="<?php echo $information['school']->id; ?>">				 					 
					 Add Activity Program
				</div>

				<div class="button add_coop float_right"
					 style="font-size: 9pt; position: relative; top: 0.75em; margin-left: 20px;"
					 data-school-id="<?php echo $information['school']->id; ?>"
					 title="Add a Coop with <?php echo $information['school']->short_name; ?> as the host school."> 
					 Add Coop
				</div>
			<?php endif; ?>
		<?php endif; ?>

		<?php if (Auth::check() and Auth::user()->canAccessSchoolTask($information['school']->id, 'ADMIN') and count($information['aps']) > 0): ?>
			<a href="<?php echo url('/schools/' . $information['school']->id . '/edit-staff'); ?>" class="edit_activity_staff" style="float: right;" title="Edit Coaches &amp; Team Staff">Manage Staff</a>
		<?php endif; ?>

		<h2>Sports / Activities</h2>

		<table class="activity_programs">
			
			<thead>
				<tr class="head ui-widget-header">
					<th class="activity">Activity</th>
					<th class="coach">Head Coach</th>
					<th class="league">League</th>
					<th class="coop">Coop</th>
					<th class="teams">Teams</th>
					<?php if (Auth::check() and Auth::user()->isOsaaUser()): ?>
						<th class="action"></th>
					<?php endif; ?>
				</tr>
			</thead>

			<tbody>
		
				<?php if (count($information['aps']) > 0): ?>
					<?php foreach ($information['aps'] as $ap): ?>		
						<tr class="program">
							<td class="activity">
								<a href="<?php echo url('/teams/' . $ap->id); ?>"><?php echo Helpers::getActivityName($ap->activity); ?></a>
								<?php if (Auth::check() and Auth::user()->isOsaaUser()): ?>
									<span style="float: right; font-weight: normal; font-size: 8.5pt; margin-right: 2em; color: #999999;">(<?php echo $ap->id; ?>)</span>
								<?php endif; ?>
							</td>

							<td class="coach">
								<?php if (!is_null($ap->head_coach)): ?>
									
									<?php if (is_null($ap->head_coach->school_staff)): ?>
										TBD
									<?php else: ?>
										<?php echo $ap->head_coach->school_staff->getDisplayName(); ?>
									<?php endif; ?>
									
									<div class="staff_info" style="float: right; top: 0.4em; margin-right: 15px;" title="More Information" data-staff-id="<?php echo $ap->head_coach->id; ?>" data-lookup="schools/activity-staff"></div>

									<?php /* 
									<?php if (Auth::check() and Auth::user()->canAccessSchoolTask($information['school']->id, 'ADMIN')): ?>
										<div class="edit_staff_info" style="float: right; top: 0.4em; margin-right: 8px;" title="Edit Contact Information" data-staff-id="<?php echo $ap->head_coach->id; ?>" data-lookup="schools/activity-staff/edit"></div>
									<?php endif; ?>
									 */ ?>

								<?php else: ?>

									TBD

								<?php endif; ?>
							</td>

							<td class="league">
								<?php /*  Remove year block from league name if not an OSAA user  */ ?>
								<?php if (Auth::check() and Auth::user()->isOsaaUser()): ?>
									<?php echo $ap->league_name; ?>
								<?php else: ?>
									<?php echo preg_replace('/\ \(.*\)/', '', $ap->league_name); ?>
								<?php endif; ?>

								<?php /*  Show league editor if authorized OSAA user  */ ?>
								<?php if (Auth::check() and Auth::user()->isOsaaUser()): ?>
									<?php if (Helpers::strEqual(Auth::user()->email, array('meridithp@osaa.org', 'gibbyr@osaa.org', 'peterw@osaa.org', 'kellyf@osaa.org'))): ?>
										<div class="button edit_league"
											 style="font-size: 9pt; float: right; top: 0.4em; margin-right: 15px;"
											 title="Edit League Assignment"
											 data-ap-id="<?php echo $ap->id; ?>">
										</div>
									<?php endif; ?>
								<?php endif; ?>
							</td>

							<td class="coop">
								<?php if ($ap->cooperation_name): ?>
									<?php echo $ap->cooperation_name; ?>
								<?php endif; ?>
							</td>

							<td class="teams" style="text-align: right;">
								<?php echo $ap->teams_list; ?>
							</td>

							<?php if (Auth::check() and Auth::user()->isOsaaUser()): ?>							
								<td class="action">
									<?php if (is_null($ap->cooperation)): ?>

										<?php if (Helpers::strEqual(Auth::user()->email, array('kellyf@osaa.org', 'meridithp@osaa.org', 'gibbyr@osaa.org', 'peterw@osaa.org'))): ?>
											<div class="button delete tooltip confirm" data-ap="<?php echo $ap->id; ?>" title="Delete this activity program" data-confirm="Are you sure you want to drop this activity program?<br /><div style='font-weight: bold; text-align: center; margin: 0.75em 0;'><?php echo $ap->name; ?><div style='display: inline-block; width: 4em;'></div><?php echo Helpers::getActivityName($ap->activity); ?></div><div style='width: 450px; margin: 0 auto; padding: 1em 0; text-align: center;'><img src='<?php echo asset('images/icons/database_records_128px.png'); ?>' /><img src='<?php echo asset('images/icons/right_arrow_64px.png'); ?>' style='position: relative; top: -25px; margin: 0 15px;' /><img src='<?php echo asset('images/icons/trash_128px.png'); ?>' /><br class='clear' /></div><b>The following actions will be preformed in the database:</b><br /><ul style='margin-left: 4em; font-size: 9pt;'><li>Delete all contests/meets involving this activity program</li><li>Delete all events linked to this activity program</li><li>Delete all teams associated with this activity program</li><li>Unlink this activity program from the school offering</li><li>Delete this activity program</li></ul><br /><div class='ui-state-error' style='padding:5px;'><div class='ui-icon ui-icon-alert float_left' style='margin-right: 0.5em; position: relative; top: 2px;'></div>Once dropped, this action cannot be undone!</div>"></div>
										<?php endif; ?>
									<?php endif; ?>
								</td>
							<?php endif; ?>

						</tr>
					<?php endforeach; ?>

				<?php else: ?>

					<tr>
						<?php if (Auth::check() and Auth::user()->isOsaaUser()): ?>
							<td colspan="6">
						<?php else: ?>
							<td colspan="5">
						<?php endif; ?>
							There are not activity programs offered by this high school.
						</td>
					</tr>

				<?php endif; ?>

			</tbody>

		</table>
	<?php endif; ?>

	<br />

	<div id="confirm_delete_ap" style="display: none;" title="Confirmation"></div>

	<div id="add_ap" style="display: none;" title="Create New Activity Program"></div>
	
<?php $__env->stopSection(); ?>
