<?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;
    	}  

    	.page_functions {
    		width: auto !important;
    	}

    	/* Schools Menu */
    	#schools_menu.ui-menu {
    		position: absolute;
    		width: 200px;
    		max-height: 30em;
    		overflow-x: hidden;
    		overflow-y: scroll;
    	}

        ul#schools_menu.ui-menu {
            padding: 0 !important;
            z-index: 200;
        }

        #schools_menu .ui-menu-item {
        	text-align: left;
        	white-space: nowrap;
        }

        /* Help Dialog */
        .help_dialog {
            font-size: 10pt;
        }

        .help_dialog h1 {
            font-size: 14pt;
            color: #005fa9 !important;
            margin: 1em 0 1em 0;
        }

        .help_dialog h2 {
            font-size: 12pt;
            color: #1C43A6 !important;
            margin: 1em 0 0.5em 0;
        }

        .help_dialog h3 {
            font-size: 10pt;
            color: #000000 !important;
            margin: 0.75em 0 0em 0;
        }

        .help_dialog h4.line {
        	border-bottom: 1px solid #005fa9;
        	margin-bottom: 0.5em;
        	padding-bottom: 0.25em;
        }

        .help_dialog ul, ol {
            margin-left: 28px;
        }

        .help_dialog dl dt {
            float: left;
            width: 200px;
            text-align: right;
            margin-right: 20px;
            font-weight: bold;
            clear: both;
        }

        .help_dialog label {
            font-weight: bold;
            width: 100px;
            display: inline-block;
        }

        .help_dialog label.disabled {
        	color: #cccccc;
        }

        .help_dialog input[type="checkbox"] {
        	vertical-align: middle;
        }    

        .help_dialog .activities {        	
        	white-space: nowrap;
        }

        .help_dialog .activities input {
        	margin-right: 6px;
        }

        .help_dialog .activities .season_options,
        .help_dialog .all_activities_options {
        	font-size: 8pt;        	
        }

        .help_dialog .activities .season_options img,
        .help_dialog .all_activities_options img {
        	width: .75em;
        	height: .75em;
        	margin-right: 4px;
        }

    </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();


	<?php /*  $('.back_to_schools_list').button ({ icons : { primary : 'ui-icon-circle-triangle-n'}});  */ ?>
	$('.back_to_schools_list').button ({ icons : { primary : 'ui-icon-arrowreturnthick-1-w'}});
	$('.prev_school_button').button({'icons' : { 'primary' : 'ui-icon-triangle-1-w'}, 'text' : false});
	$('.next_school_button').button({'icons' : { 'primary' : 'ui-icon-triangle-1-e'}, 'text' : false});
	
	$('.disabled').button('disable');

    // All schools menu
    $('#schools_menu')
		.menu()
        .css({'font-size' : '9pt'})
        .hide()
        
    $(document).click(function(event)
    {
    	$('#schools_menu').hide();
    	$('.list_school_button').button('option', 'icons', { 'primary' : 'ui-icon-triangle-2-n-s'}); 
	});

	$('.list_school_button')
		.button({'icons' : { 'primary' : 'ui-icon-triangle-2-n-s'}, 'text' : false})
		.click(function(event)
        {
            var menu_button = $(this);

            event.preventDefault();
            event.stopPropagation();

            var menu = $('#schools_menu');

            if (menu.is(':visible'))
           	{
           		menu.hide();
           		menu_button.button('option', 'icons', { 'primary' : 'ui-icon-triangle-2-n-s'});           		
           	}
           	else
           	{
            	menu_button.button('option', 'icons', { 'primary' : 'ui-icon-triangle-1-s'});
            	menu.show()
                .position({'my' : 'right top',
                           'at' : 'right bottom',
                           'of' : '.list_school_button'});                    
            }
        });


	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,
	      			<?php if (Auth::user()->isOsaaUser()): ?>
	      				height: 585,
	      			<?php else: ?>
	      				height: 475,
	      			<?php endif; ?>	      			
	      			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; ?>

	/*
	 * School schedule setup
	 */

	$('#download_list')
		.css({'position' : 'relative',
			  'top' : '9px',
			  'float' : 'right',
			  'left' : '0'});

	// Download drop-down menu
    $('#grabber_list')
        .menu()
        .css({'display' : 'none',
              'z-index' : '200',
              'position' : 'absolute',
              'left' : '0',
              'top' : '25px',
              'margin' : '0',
              'padding' : '0',
              'font-size' : '9pt',
			  'width' : '150px'});   

	$('#grabber_list a').on('click', function(event)
	{
		if ($(this).is('[data-event="prevent-default"]'))
		{
			event.preventDefault();
		}
		else
		{
			event.stopPropagation();
		}
	});

    $('#grabber_list li ul')
        .css({'margin' : '0',
              'padding' : '0',
              'width' : '190px'});

    $('#grabber_list img')
        .css({'position' : 'relative',
              'top' : '2px',
              'margin-right' : '6px'});

    $('#grabber_button')
        .button({ icons : { primary : 'ui-icon-document', secondary : 'ui-icon-triangle-1-s'}})
        .css({'float' : 'right',
              'font-size' : '9pt',
          	  'margin-right' : '20px'})
        .click(function (event)
        {
            if ($('#grabber_list').is(':visible'))
            {
                $('#grabber_list').slideUp(200);
                $(this).button({icons : { primary : 'ui-icon-document', secondary : 'ui-icon-triangle-1-s'}});
            }
            else
            {
                $('#grabber_list').slideDown(200);
                $(this).button({icons : { primary : 'ui-icon-document-b', secondary : 'ui-icon-triangle-1-n'}});
            }

            event.stopPropagation();
        });

    $(document).on('click', function() 
    {
    	if ($('#grabber_list').is(':visible'))
        {
            $('#grabber_list').slideUp(200);
            $('#grabber_button').button({icons : { primary : 'ui-icon-document', secondary : 'ui-icon-triangle-1-s'}});
        }
	});

	$('[data-action="school-schedule"]').on('click', function(event)
	{
		event.preventDefault();
		$('#grabber_button').click();

		$('<div></div>')
        .appendTo('body')
        .dialog(
        {                       
            draggable : true,
            resizable : false,
            modal : true,
            height : 550,
            width : 600,                    
            title : 'School Schedule',
            buttons: [                                
                {
                    text : "Download",
                    'class' : "float_left",                            
                    'data-autofocus' : 'true',
                    icons : { primary : 'ui-icon-document'},
                    click : function()
                    {
                        // Get the form
                        var form = $('form[name="download-schedule"]', $(this))[0];	                        

                        <?php /*  $('<div><div>')
                            .addClass('ui-widget-overlay ui-front')
                            .appendTo('body');
                          
                        $('<div><div>').appendTo('body')
                            .css('width', '225px')
                            .css('height', '170px')
                            .css('text-align', 'center')
                            .css('padding', '0.5em')
                            .position({my : "center center", at : "center center", of : window})
                            .addClass('ui-dialog ui-widget ui-widget-content ui-corner-all ui-front')
                            .html('<br />Saving...<br /><br /><img src="http://www.osaa.org/images/icons/ajax_loader3.gif" /><div style="font-size: 8pt; line-height: 105%; margin-top: 2em;">Please wait while your form is saved...</div>');  */ ?>

                        form.submit();
                    }
                },                                             
                {
                    text : "Cancel",
                    'class' : "float_right",                            
                    icons : { primary : 'ui-icon-cancel'},                            
                    click : function()
                    {
                        // Close the dialog box
                        $(this).dialog("close");   
                    }
                }
            ],
            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>");

                    $(".ui-dialog-buttonpane button:contains('Download')").button("disable");	                    

                    var jqxhr = $.ajax(
                        {
                            type : 'GET',
                            url : '<?php echo url('/schools/' . $information['school']->id . '/download-schedule'); ?>',
                            dataType : 'html'
                        })
                        .done(function (returned_data)
                        {                               
                            dialog_object.html(returned_data);

                            $(".ui-dialog-buttonpane button:contains('Download')").button("enable").focus();
                        })                                                                            
                        .fail(function (jqXHR, status, error)
                        {                                                   
                            var response = jqXHR.responseText;
                            var errorData = $.parseJSON(response);
                            console.log(errorData);
                            dialog_object.html("There was an error loading the information.<br /><br />" + errorData.error.message);	                              
                        })              
                        .complete(function ()
                        {
                            // Limit options for specific formats
                            $('#format').on('change', function()
                            {
                            	var format = $('option:selected', $(this)).val();

                            	$('input[data-limit-to-format]').each(function(index)
                            	{
                            		var item = $(this);
                            		var item_format = item.attr('data-limit-to-format');

                            		if (item_format != format)
                            		{
                            			item.attr('disabled', 'disabled');
                            			$('label[for="' + item.attr('id') + '"]').addClass('disabled');
                            		}
                            		else
                            		{
                            			item.removeAttr('disabled');
                            			$('label[for="' + item.attr('id') + '"]').removeClass('disabled');
                            		}
                            	});
                        	});

                        	function setupDatePicker(duration)
                        	{
                        		if (duration == 'week')
                        		{
                        			var options = {
								    	'dateFormat' : 'm/d/yy',
								        'showOtherMonths' : true,
								        'selectOtherMonths' : true
								   	};
								   	var label_text = 'Week Containing';
								   	var value = '<?php echo date('n/j/Y', time()); ?>';

								   	$('label[for="range"]').text(label_text);

								    var field = $('<input />')
								   		.attr('type', 'text')
								   		.attr('name', 'range')
								   		.attr('id', 'range')
								   		.css({'width':'125px'});

								   	$('#range').replaceWith(field);

		                        	$('#range').val(value);			                        	
		                        	$('#range').datepicker(options);
                        		}
                        		else if (duration == 'month')
                        		{
                        			var options = {
								    	'dateFormat' : 'MM, yy',
								        'showOtherMonths' : true,
								        'selectOtherMonths' : true
								   	};
								   	var label_text = 'Month Of';									   	
								   	var value = '<?php echo date('F, Y', time()); ?>';

								   	var field = $('<input />')
								   		.attr('type', 'text')
								   		.attr('name', 'range')
								   		.attr('id', 'range')
								   		.css({'width':'125px'});

								   	$('#range').replaceWith(field);

								   	$('label[for="range"]').text(label_text);
		                        	$('#range').val(value);			                        	
		                        	$('#range').datepicker(options);
	                        	}
	                        	else if (duration == 'season')
	                        	{
	                        		var current_year = <?php echo intval(Session::get('year')); ?>;
	                        		var label_text = current_year + '-' + ((current_year + 1).toString()).substring(2) + ' Season';
		                        	
	                        		var options = [
	                        			$('<option></option>').attr('value', 'F').text('Fall ' + current_year),
	                        			$('<option></option>').attr('value', 'W').text('Winter ' + (current_year.toString()).substring(2) + '-' + ((current_year + 1).toString()).substring(2)),
	                        			$('<option></option>').attr('value', 'S').text('Spring ' + (current_year + 1))
	                        		];

	                        		var current_season = "<?php echo substr(Helpers::getCurrentSeason(), 0, 1); ?>";		                        		

	                        		var field = $('<select></select>')
	                        			.attr('name', 'range')
								   		.attr('id', 'range')
								   		.css({'width':'125px'})
								   		.append(options);

								   	$('#range').replaceWith(field);

								   	$('#range option[value="' + current_season + '"]').attr('selected', 'selected');

								   	$('label[for="range"]').text(label_text);		                        		
	                        	}
	                        	else
	                        	{
	                        		console.log('Unknown duration.');
	                        	}		                        	
	                        }

	                        $('#duration').on('change', function()
	                        {
	                        	var duration = $('option:selected', $(this)).val();
	                        	setupDatePicker(duration);
	                    	});
	                    	setupDatePicker('week');

	                    	// All/clear activity links
	                    	$('.season_options a[data-action]', dialog_object)
	                    		.on('click', function(event)
	                    		{
	                    			event.preventDefault();

	                    			var link = $(this);
	                    			var action = link.attr('data-action');
	                    			var season = link.parents('.season');

	                    			// Select all 
	                    			if (action == 'all-season')
	                    			{
	                    				$('input.activity_option', season).prop('checked', true);
	                    			}

	                    			// Clear
	                    			if (action == 'clear-season')
	                    			{
	                    				$('input.activity_option', season).prop('checked', false);
	                    			}
	                    		});

	                    	// All/clear activity links
	                    	$('.all_activities_options a[data-action]', dialog_object)
	                    		.on('click', function(event)
	                    		{
	                    			event.preventDefault();

	                    			var link = $(this);
	                    			var action = link.attr('data-action');
	                    			var activities = $('.activities', dialog_object);

	                    			// Select all 
	                    			if (action == 'all-activities')
	                    			{
	                    				$('input.activity_option', activities).prop('checked', true);
	                    			}

	                    			// Clear
	                    			if (action == 'clear-activities')
	                    			{
	                    				$('input.activity_option', activities).prop('checked', false);
	                    			}
	                    		});

							$(document).on('mousemove','#ui-datepicker-div .ui-datepicker-calendar tr',function() {$(this).find('td a').addClass('ui-state-hover'); });
							$(document).on('mouseleave','#ui-datepicker-div .ui-datepicker-calendar tr',function() {$(this).find('td a').removeClass('ui-state-hover'); });
                        });                            

                    $('.ui-dialog-buttonpane', dialog_object.parents('.ui-dialog')).css({'padding' : '0 0.5em', 'font-size' : '9pt', 'position' : 'relative'});
                    $('.ui-dialog-buttonpane .ui-dialog-buttonset', dialog_object.parents('.ui-dialog')).css({'width' : '100%'});                            
                },
            close : function ()
                {
                    var dialog_object = $(this);
                    $(dialog_object).remove();
                }
        });
	});

	<?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: 525,
	      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 (!is_null($information['prev_school_in_order'])): ?>
    	<a href="<?php echo url('/schools/' . $information['prev_school_in_order']->id); ?>" class="prev_school_button" style="font-size: 9pt; height: 2em;" title="<?php echo $information['prev_school_in_order']->short_name; ?>"></a>
    <?php elseif (Helpers::strEqual($information['member_type'], 'Full Member')): ?>
    	<a href="#" class="prev_school_button disabled" style="font-size: 9pt; height: 2em;"></a>
    <?php endif; ?>

    <?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 if (count($information['list_of_other_schools']) > 0): ?>
    	<a href="#" class="list_school_button" style="font-size: 9pt; height: 2em;"></a>

    	<ul id="schools_menu" style="display: none;">
            <?php foreach ($information['list_of_other_schools'] as $school_id => $school_name): ?>
            	<li><a href="<?php echo url('schools/' . $school_id); ?>"><?php echo $school_name; ?></a></li>
            <?php endforeach; ?>
        </ul>
    <?php endif; ?>   

    <?php if (!is_null($information['next_school_in_order'])): ?>
    	<a href="<?php echo url('/schools/' . $information['next_school_in_order']->id); ?>" class="next_school_button" style="font-size: 9pt; height: 2em;" title="<?php echo $information['next_school_in_order']->short_name; ?>"></a>
    <?php elseif (Helpers::strEqual($information['member_type'], 'Full Member')): ?>
    	<a href="#" class="next_school_button disabled" style="font-size: 9pt; height: 2em;"></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; ?>

		<?php if (count($information['social_media']) > 0): ?>
        <br /><br />
        <div class="social_media_handles">
            <?php foreach ($information['social_media'] as $handle): ?>
                <?php
                	if (Helpers::strEqual($handle->platform, 'FACEBOOK'))
                	{
                		$social_media_image = asset('/images/icons/' . strtolower($handle->platform) . '_32px.png');
                	}
                	else
                	{
                		$social_media_image = asset('/images/icons/' . strtolower($handle->platform) . '_2_32px.png');
                	}
                ?>
                <a href="<?php echo $handle->link; ?>" target="_blank" style="margin-right: 6px;"><img src="<?php echo $social_media_image; ?>" alt="" title="<?php echo $handle->handle; ?>" style="" /></a>
            <?php endforeach; ?>
        </div>
    <?php endif; ?>


	</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; ?>
			
			<?php if (!is_null($information['mail_address'])): ?>

				<h4>Physical 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; ?>

				<br /><br />

				<h4>Mailing Address</h4>
				<?php if (!is_null($information['mail_address'])): ?>
					<?php echo $information['mail_address']->line_1; ?><br />
					
					<?php if (!Helpers::strIsEmpty ($information['mail_address']->line_2)): ?>
						<?php echo $information['mail_address']->line_2; ?>
						<br />
					<?php endif; ?>

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

				<?php endif; ?>


			<?php else: ?>

				<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; ?>
			<?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('krisw@osaa.org', '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; ?>

		<div id="download_list">				
	        <div id="grabber_button">Download</div>
	        <ul id="grabber_list">            
	            <li><a href="#" data-action="school-schedule"><img src="<?php echo asset('/images/icons/schedule_16px.png'); ?>" alt="" title="" />Schedules</a></li>	
	        </ul>  
	    </div>		

		<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('krisw@osaa.org', '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('krisw@osaa.org', '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(); ?>
