<?php $__env->startSection('page_title'); ?>
    OSAA - Team Editor
<?php $__env->stopSection(); ?>

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

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

	<script src="<?php echo asset('scripts/jquery.timepicker.min.js'); ?>" type="text/javascript"></script> 	
    <script src="<?php echo asset('/scripts/jquery.maskedinput.min.js'); ?>" type="text/javascript"></script>

	<style type="text/css">
		.ui-autocomplete {
			max-height: 200px;
			overflow-y: auto;
			/* prevent horizontal scrollbar */
			overflow-x: hidden;
		}
		/* IE 6 doesn't support max-height
		* we use height instead, but this forces the menu to always be this tall
		*/
			* html .ui-autocomplete {
			height: 200px;
		}


		 .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_alert {
            position: fixed;
            top: 600px;
            left: 0;
            width: 100%;
            padding: 0.25em 0;
            line-height: 1.5em;
            background-color: rgba(255, 238, 178, 0.0);
            border-bottom: 2px solid rgba(211, 177, 42, 0.50);
            border-top: 2px solid rgba(211, 177, 42, 0.50);
            z-index: 500;

        }

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

		.odd {
            background-color: #f2f2f2;
        }

        .team_schedule_holder {
            position: relative;
        }

        .copy_schedule_holder {
            position: absolute;
            right: 1.4em;
            top: 2.75em;
        }


        /* Copy Feature Dialog */
        .copy_dialog {
            font-size: 10pt;
        }

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

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

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

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

        .copy_dialog dl dt {
            float: left;
            width: 200px;
            text-align: right;
            margin-right: 20px;
            font-weight: bold;
            clear: both;
        }
        
	</style>

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

<?php $__env->startSection('jquery_init'); ?>
	$('.tooltip').tooltip();
	$('.tooltip.above').tooltip({ position : {my: "left bottom-15", at: "left top", collision: "flipfit"}});
	$('.tooltip.right').tooltip({ position : {my: "left+15 middle", at: "right middle", collision: "flipfit"}});

	$('.button').button();		
	$('.button.notext').button({text:false});
	$('.button.edit').button({ icons : { primary : 'ui-icon-pencil'}});
	$('.button.delete').button({ icons : { primary : 'ui-icon-closethick'}});
	$('.button.drop').button({ icons : { primary : 'ui-icon-circle-close'}});
	$('.button.cancel').button({ icons : { primary : 'ui-icon-circle-minus'}});
	$('.button.trash').button({ icons : { primary : 'ui-icon-trash'}});
	$('.button.clipboard').button({ icons : { primary : 'ui-icon-clipboard'}});
	$('.button.print').button({ icons : { primary : 'ui-icon-print'}});
	$('.button.add').button({ icons : { primary : 'ui-icon-plusthick'}});
	$('.button.next').button({ icons : { secondary : 'ui-icon-triangle-1-e'}});
	$('.button.add_teams').button({ icons : { secondary : 'ui-icon-triangle-1-e'}});	
	$('.button.join').button({ icons : { secondary : 'ui-icon-triangle-1-e'}});
	$('.button.next_add').button({ icons : { secondary : 'ui-icon-plus'}});
	$('.button.add_more_team_spots').button({ icons : { primary : 'ui-icon-plus'}});
	$('.button.create').button({ icons : { secondary : 'ui-icon-triangle-1-e'}});
	$('.button.search').button({ icons : { secondary : 'ui-icon-triangle-1-e'}});
	$('.button.reset').button({ icons : { primary : 'ui-icon-triangle-1-w'}});
	$('.button.submit_scores').button({ icons : { primary : 'ui-icon-circle-arrow-e' }});	
	$('.home_button').button({ icons : { primary : 'ui-icon-home'}, text : false}).css('height', '24px').css('margin-top', '3px');
	$('.team_view_button').button({ icons : { primary : 'ui-icon-bookmark'}}).css('margin-right', '10px').css('margin-top', '3px');
	$('.oos_button').button({ icons : { primary : 'ui-icon-note' }}).css('margin-right', '10px').css('margin-top', '3px');
    

    <?php if (Auth::user()->isOsaaUser() and Helpers::strEqual(Auth::user()->email, array('gibbyr@osaa.org', 'kellyf@osaa.org', 'krisw@osaa.org'))): ?>

        /*
         * Drop team button
         */
        $('.drop_team_button')
            .button({ icons : { primary : 'ui-icon-circle-minus' }})
            .css('margin-right', '10px').css('margin-top', '3px')
            .on('click', function(event)
            {
                event.preventDefault();

                var link = $(this);
                
                var data = {
                    team_id : link.attr('data-team-id'),
                    team_level : link.attr('data-team-level'),
                    ap_name : link.attr('data-ap-name'),
                    activity : link.attr('data-activity'),
                    redirect : "<?php echo url('/teams/' . $information['activity_program']->id); ?>"
                };    
        
                $('<div></div>')
                    .appendTo('body')
                    .dialog(
                    {                       
                        dialogClass : 'drop_team_confirm',
                        modal : true,
                        draggable : true,
                        resizable : false,
                        height : 375,
                        width : 600,                    
                        title : 'Confirmation',
                        show : {effect : "shake", duration : 200},
                        buttons: [
                            {
                                text : "Cancel",
                                'class' : "float_right",                                
                                icons : { primary : 'ui-icon-cancel'},
                                click : function()
                                        {
                                            // Close the dialog box
                                            $(this).dialog("close"); 
                                        }
                            },
                            {
                                text : "Drop Team",
                                'class' : "float_left",
                                icons : { primary : 'ui-icon-check'},
                                click : function()
                                        {
                                            $('<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 ui-di    buttons')
                                                .html('<br />Deleting...<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, this may take a while to process...</div>');

                                            // Submit the change
                                            var jqxhr = $.ajax(
                                                {
                                                    type : 'POST',
                                                    url : '<?php echo url('/teams'); ?>/' + data.team_id + '/delete',
                                                    data : data,
                                                    dataType : 'html'
                                                })
                                                .done(function (return_data)
                                                {                                                
                                                    // Reload
                                                    window.location.href= data.redirect;
                                                })
                                                .fail(function (jqXHR, status, error)
                                                {                                                   
                                                    var response = jqXHR.responseText;
                                                    var errorData = $.parseJSON(response);
                                                    console.log(errorData);
                                                    console.log(response);
                                                    alert ("There was an error saving changes.\n\nThis page will be reloaded.");
                                                    location.reload();
                                                });
                                        }
                            }                            
                        ],
                        open : function ()
                            {  
                                var dialog_object = $(this);

                                var html = '<div style="font-size: 10pt; margin: 1em 0;">';
                                html += '<span class="ui-icon ui-icon-alert" style="display: inline-block; vertical-align: middle; margin-right: 4px;"></span>';
                                html += '<b>Are you sure you want to drop the ' + data.team_level + ' level ' + data.activity  + ' team for ' + data.ap_name + '?</b>';
                                html += '<br /><br />';
                                html += 'The following actions will be taken:<ul style="padding-left: 40px;">';                                
                                html += '<li>All contests involving this team will be deleted and removed from the database.</li>';
                                html += '<li>This team will be removed from the database.</li>';
                                html += '</ul><br /><br />';
                                html += '<div class="small gray">This cannot be undone.  If you drop this team, it cannot be reinstated.  All scheduling data for this team will be lost.</div>';
                                html += '</div>';

                                dialog_object.html(html);
                                
                                $('.drop_team_confirm .ui-widget-header').css('background', '#f6a828 url(http://download.jqueryui.com/themeroller/images/ui-bg_gloss-wave_35_f6a828_500x100.png) 50% 50% repeat-x').css('border-color', '#f6a828');                                
                                $('.drop_team_confirm .ui-widget-content').css('border-color', '#dddddd');
                                
                                $('.drop_team_confirm .ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '9pt');
                                $('.drop_team_confirm .ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%');   
                            },
                        close : function ()
                            {
                                var dialog_object = $(this);
                                $(dialog_object).remove();
                            }                
                    });                        

            });
    <?php endif; ?>
	
	$('.button_set').buttonset();
	$('.button_set label').addClass('ui-corner-all');

	$('#related_teams').buttonset();

	$('#related_teams input').click(function() {
		var link_location = $(this).attr('data-href');
		
		if (!$(this).attr('checked'))
		{
			window.location = link_location;
		}
	});

	$('#add_team').button({icons : {primary : 'ui-icon-plusthick'}, text : false});

	$('.tabs').tabs({
		beforeActivate : function (event, ui)
		{
			if (ui.newTab.is('[data-escape]'))
			{
				event.preventDefault();
				window.location = ui.newTab.attr('data-escape');				
			}	
		}
	});


	$('.submit_button').button();

	$('#event_date, #event_date2').datepicker({'dateFormat' : 'mm/dd/yy', 'minDate' : '<?php echo $information['first_event_at']; ?>', 'maxDate' : '<?php echo $information['last_event_at']; ?>'});
	
	$('#event_time, #event_time2').timepicker({ 'timeFormat': 'h:i A' , 'step' : 15, 'maxTime' : '10:00pm'});


    $('[data-format="height"]').mask("9-9?9");

	/*
	$('.add_contest .close').click(event, function () {
        
        var panel = $(event.target).parent();

        var state = panel.attr('data-state');


        if (state == 'expand')
        {
            panel.css('height', panel.attr('data-min'));
            panel.attr('data-state', 'collapse'); 

            panel.children('*').css({'visibility' : 'hidden', 'display' : 'none'});
            panel.children('.close').css({'visibility' : 'visible', 'display' : 'block'});

            panel.children('.close').removeClass ('ui-icon-triangle-1-n');
            panel.children('.close').addClass ('ui-icon-triangle-1-s');            

        }
        
        if (state == 'collapse')
        {
            panel.css('height', panel.attr('data-max'));
            panel.attr('data-state', 'expand'); 

            panel.children('*').css({'visibility' : 'visible', 'display' : 'block'});           

            panel.children('.close').removeClass ('ui-icon-triangle-1-s');
            panel.children('.close').addClass ('ui-icon-triangle-1-n');
        }
    });
    */

    $('#contest_type').buttonset();

    function updateOOSState ()
    {
		if ($('#is_oos_opponent:checked').length > 0)
    	{
    		$('#state').removeAttr('disabled');   		
    	}
    	else
    	{
    		$('#state').attr('disabled', 'disabled');
    	}  
	}

	function updateOOSState2 ()
    {
		if ($('input[name="host_is_oos"]:checked').length > 0)
    	{
    		$('#state').removeAttr('disabled');   		
    	}
    	else
    	{
    		$('#state').attr('disabled', 'disabled');
    	}  
	}

	function updateOOSState3 ()
    {
		if ($('input[name="other_team_is_oos"]:checked').length > 0)
    	{
    		$('#state2').removeAttr('disabled');   		
    	}
    	else
    	{
    		$('#state2').attr('disabled', 'disabled');
    	}  
	}

	updateOOSState ();
	updateOOSState2 ();
	updateOOSState3 ();

    $('#is_oos_opponent').change(function ()
    {
    	updateOOSState ();
    });

    $('input[name="host_is_oos"]').change(function ()
    {
    	updateOOSState2 ();
    });

    $('input[name="other_team_is_oos"]').change(function ()
    {
    	updateOOSState3 ();
    });


    $('#is_endowment').change (function ()
    {
    	if ($('#is_endowment:checked').length > 0)
    	{
    		$("input[name='event_status']").attr('value', 'PND');
    		$('.event_status_text').html('<span style="color:#990000;"><b>Pending / Needs Approval</b></span>');
    		$('.event_status_note').html('Once you create this contest, it must be approved by the OSAA office; it will appear on your schedule as pending<br />');

    	}
    	else
    	{
    		$("input[name='event_status']").attr('value', 'SCHD');
    		/*
    		$('.event_status_text').html('<span style="color:#0d581b;"><b>Ready to be scheduled</b></span>');
    		$('.event_status_note').html('Once you create this contest, it will be added to your schedule');
    		*/
    		$('.event_status_text').html('');
    		$('.event_status_note').html('');
    	}   	

	});
 
 	$('#swap_home_away').button({text : false, icons : { primary : 'ui-icon-shuffle'}});

 	var availableOpponents = [
      <?php echo $information['available_opponents']; ?>
    ];

    var availableLocations = [
      <?php echo $information['available_locations']; ?>
    ];

    var availableTournaments = [
      <?php echo $information['available_tournaments']; ?>
    ];
    
    $('.school_autocomplete').autocomplete(
    {
    	source : availableOpponents
	});


    $("#opponent" ).autocomplete({
        source : availableOpponents,        
        change : function (event, ui)
    	{    	
	    	if ($('#swapped').val() > 0)
	    	{
	    		$("input[name='home_team_name']").attr('value', $(this).val());
	    	}
	    	else
	    	{
				$("input[name='away_team_name']").attr('value', $(this).val());
	    	}

	    	updateTeamDesignations ();

	    	return true;
		}});

	$('#location').autocomplete({source : availableLocations});
	$('#location2').autocomplete({source : availableLocations});
	$('#tournament').autocomplete({source : availableTournaments});


    function updateTeamDesignations ()
    {
    	var home_team = $("input[name='home_team_name']").attr('value');
    	var away_team = $("input[name='away_team_name']").attr('value');

    	if (home_team != null)
    	{
    		$('#home_team_name').html(home_team.replace(/(<([^>]+)>)/ig,""));
    	}
    	if (away_team != null)
    	{
    		$('#away_team_name').html(away_team.replace(/(<([^>]+)>)/ig,""));   	
    	}
	}	    

	updateTeamDesignations ();

	$('#swap_home_away').click(function ()
	{
		var home_team = $("input[name='home_team_name']").attr('value');
    	var away_team = $("input[name='away_team_name']").attr('value');
		
		$("input[name='home_team_name']").attr('value', away_team);
		$("input[name='away_team_name']").attr('value', home_team);

		updateTeamDesignations ();

		$('#swapped').val($('#swapped').val() * -1);
	});

	
	$('#is_neutral_location, #is_endowment, #is_tournament, #is_oos_opponent').button();

	$('#is_tournament').change(function ()
	{
		if ($('#is_tournament:checked').length > 0 && $('#is_neutral_location:checked').length < 1)
    	{
    		$('#is_neutral_location').click();
    	}    	
	});

	$('#tournament').change(function ()
	{
		if ($(this).val() != "" && $('#is_tournament:checked').length < 1)
		{
			$('#is_tournament').click();
		}
	});

	// Success bar
    $('.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);
      })
    });
    $('.success_bar_alert').animate({ 'top' : 32, 'background-color' : 'rgba(255, 238, 178, 1.0)'}, 1600, 'easeOutQuad', function ()
    {   
      $(this).delay(8000).fadeOut(4000);

      $(this).hover(function ()
      {
        $(this).stop(true).css('opacity', '1.0');
      },
      function ()
      {
        $(this).fadeOut(4000);
      })
    });

    $('.edit_contest_button')
        .button({ icons : {primary : 'ui-icon-pencil'},
                  text : false})
        .css({'width' : '16px',
        	  'height' : '16px', 
              'position' : 'relative',
              'top' : '-1px',
              'margin-left' : '4px'})
        .tooltip()
        .attr('title', 'Click to edit this contest.');
	
    // New schedule formatting  
    function colorRows ()
    {       
        $('table.schedule').each(function ()
        {
            var i = 0;
  
            $('tbody tr[data-status]', $(this)).each(function ()
            {
                if (i % 2 == 1)
                {
                    $(this).addClass('odd');

                    if ($(this).next().is('tr'))
                    {
                        $(this).next().addClass('odd');
                    }
                }
                else
                {
                    $(this).removeClass('odd');
                    if ($(this).next().is('tr'))
                    {
                        $(this).next().removeClass('odd');
                    }
                }
                i = i + 1;
            });     
        });
    }   
    colorRows(); 
  
    $('[data-status="CXL"]').css({'background-color' : '#cacaca', 'color' : '#ffffff !important;'});
    $('[data-status="CXL"] a').css({'background-color' : '#cacaca', 'color' : '#ffffff !important;'});
    $('[data-status="CXL"] .gray').css({'background-color' : '#cacaca', 'color' : '#ffffff !important;'});
  
    $('[data-status="PPD"]').css({'background-color' : '#b5a5fb', 'color' : '#ffffff !important;'});
    $('[data-status="PPD"] a').css({'background-color' : '#b5a5fb', 'color' : '#ffffff !important;'});
    $('[data-status="PPD"] .gray').css({'background-color' : '#b5a5fb', 'color' : '#ffffff !important;'});
  
    $('[data-status="LIVE"]').css({'background-color' : '#effff1', 'color' : '#222222 !important;'});
    $('[data-status="LIVE"] a').css({'background-color' : '#effff1', 'color' : '#222222 !important;'});
    $('[data-status="LIVE"] .gray').css({'background-color' : '#effff1', 'color' : '#222222 !important;'});
  
    $('[data-status="PND"]').css({'background-color' : '#fff7da', 'color' : '#222222 !important;'});
    $('[data-status="PND"] a').css({'background-color' : '#fff7da', 'color' : '#222222 !important;'});
    $('[data-status="PND"] .gray').css({'background-color' : '#fff7da', 'color' : '#222222 !important;'});
  
    $('[data-status="DEL"]').css({'background-color' : '#ad2c2c', 'color' : '#ffffff !important;'});
    $('[data-status="DEL"] a').css({'background-color' : '#ad2c2c', 'color' : '#ffffff !important;'});
    $('[data-status="DEL"] .gray').css({'background-color' : '#ad2c2c', 'color' : '#ffffff !important;'});

    $('.event_notes').css({'font-size' : '9pt'});

    $('.contest_viewer').dialog({ autoOpen : false,                                  
                                  buttons : [ { text : 'Done', 'class' : 'float_right', click : function () { $(this).dialog('close'); }}
                                              <?php if (Auth::check()): ?>
                                              , { text : 'Edit Contest',  'class' : 'float_left', 'style' : 'margin-left:5px;', icons : { primary : 'ui-icon-pencil' }, click : function () { window.location = ('/contests/' + $(this).attr('data-contest') + '/edit?ap=<?php echo $information['activity_program']->id; ?>'); }},
                                              { text : 'Submit Scores',  'class' : 'float_left', 'style' : 'margin-left:10px;', icons : { primary : 'ui-icon-circle-arrow-e' }, click : function () { window.location = ('/contests/' + $(this).attr('data-contest') + '/submit-scores'); }}
                                              <?php endif; ?> ],
                                  draggable : false,                                                                   
                                  height: 'auto',                                   
                                  modal : true,
                                  open : function ()
                                  {                                                                          
                                      
                                      var contest = $(this).attr('data-contest');
                                      $('.contest_viewer').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 : '/contests/' + contest + '?mode=ajax', dataType : 'html' })
                                                   .done(function (data)
                                                   {
                                                        $('.contest_viewer').html(data);
                                                        $('.button').button();
                                                    })
                                                   .fail(function () { $('.contest_viewer').html('There was an error.'); });

                                      $('.ui-dialog-buttonpane').css('padding', '0').css('font-size', '8pt');
                                      $('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%');                                      
                                  },
                                  resizable : false,
                                  show : { effect : 'highlight', delay : 0, duration : 400, easing : 'easeInOutSine' },
                                  title : 'OSAA <?php echo Helpers::getActivityName($information['activity_program']->activity); ?>', 
                                  width : 900                                 
                                });

    $('.contest_details').click(function ()
    {        
        $('.contest_viewer').attr('data-contest', $(this).attr('data-contest')).dialog('open');
    })
    .hover(function()
    {
        $(this).css({'cursor':'pointer'});
    }, function()
    {
        $(this).css({'cursor':'auto'});
    });




	$("#add_a_school").button(
		{
			icons : {
						primary : 'ui-icon-circle-plus'
					}
		}
	).click(function ()
	{
		var n = $('input.other_school').size();		

		var label = $('<label>').attr('for', 'other_school_' + (n +1)).attr('class', 'input_label').html('School:&nbsp;');
		var input = $('<input>').attr('style', 'width:325px').attr('class', 'school_autocomplete other_school').attr('name', 'other_school_' + (n +1)).attr('type', 'text');
		input.autocomplete(
	    {
	    	source : availableOpponents
		});		
		
		$('#other_schools').append(label);
		$('#other_schools').append(input);
		$('#other_schools').append('<br /><br />');
	});

	function colorRows2()
	{
		var rows = 0;
		$('table.roster tbody tr').each(function (row)
		{
			if (row % 2 == 0)
			{
				$(this).css('background-color', '#ffffff');
			}
			else
			{
				$(this).css('background-color', '#f2f2f2');
			}

			row = row + 1;
		});
	}	

	colorRows2();

	$('.button.delete').click(function ()
	{
		var row_id = $(this).attr('data-player');
		$('#player_' + row_id).remove();
		colorRows2();
	});

	$('.button.add.player').click(function ()
	{
		var next_id = $('tbody tr').size() - 2;
		
		var row = $('#new_player_row').clone();

		row.attr('id', 'player_' + next_id)
		   .removeAttr('style');		

		$('input', row).each(function ()
		{
			$(this).attr('name', $(this).attr('name').replace('_X', '_' + (next_id)));
			if ($(this).val() == "X")
			{
				$(this).val(next_id);
			}					
		});
		$('select', row).each(function ()
		{
			$(this).attr('name', $(this).attr('name').replace('_X', '_' + (next_id)));							
		});

		$('.tooltip', row).tooltip();
		$('.tooltip.right', row).tooltip({ position : {my: "left+15 middle", at: "right middle", collision: "flipfit"}});

		$('.button.delete', row).button({ icons : { primary : 'ui-icon-closethick'}, text : false})
						        .attr('data-player', next_id)
						        .tooltip()
						        .click(function ()
										{
											var row_id = $(this).attr('data-player');
											$('#player_' + row_id).remove();
											colorRows2();
										});
		
		
		row.appendTo($('#new_player_row').parent());	

        $('[data-format="height"]', row).mask("9-9?9");

		colorRows2();	
		
	});







    
    function readURL(input)
    {
        if (input.files && input.files[0])
        {
            var reader = new FileReader();
            
            reader.onload = function (e)
            {
                $('#preview').attr('src', e.target.result);                
            }
            
            reader.readAsDataURL(input.files[0]);
        }
    }
    
    $('#photo').change(function()
    {
        readURL(this);
    });

	$('#image_uploading').hide();

    $('#upload_photo').click(function ()
    {   	
    	$('#image_uploading').show();    	    	
	});	 

	$('#confirm_delete_dialog').dialog(
	{
      autoOpen: false,
      resizable: false,
      height:275,
      width: 400,
      modal: true,
      buttons: {
        "Yes": function() {
          
			var team = $(this).attr('data-team');

			$.ajax(
			{
				type : "POST",
				url  : '<?php echo url('/teams/remove-photo'); ?>',
				data : { 'team' : team },
				success : function()
				{
					/*location.reload();*/ 

					/* Get the team photo container */
					var p = $('#existing_team_photo').parent();

					/* Remove the team photo and the delete button */
					$('#existing_team_photo').remove();
					$('#delete_photo_button').remove();

					/* Add in the no image found template HTML */
					$(p).html("<div style='width: 100%; height: 400px; text-align: center; border: 1px solid #d9e1e0;'><br/><br /><br /><br /><b>No Team Photo Found</b><br /><br /><br />Use the photo upload form to the left<br />to upload a team photo.</div>");

				}
			});

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

			return true;
        },
        "No": function() {
          $(this).dialog( "close" );
          return false;
        }
      }
    });  

	$('#delete_photo_button').click(function ()
	{	
		$('#confirm_delete_dialog').dialog('open');
	});

	$('#confirm_delete_dialog_meet').dialog(
	{
      autoOpen: false,
      resizable: false,
      height:260,
      width: 400,
      modal: true,
      buttons: {
        "Yes": function() {
          	
        	var team = $(this).attr('data-team');
        	var meet = $(this).attr('data-meet');

			$.ajax(
			{
				type : "POST",
				url  : '<?php echo url('/meets/delete'); ?>',
				data : { 'team' : team,
						 'meet' : meet },
				success : function()
				{
					location.reload();					
				}
			});

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

			return true;
        },
        "No": function() {
          $(this).dialog( "close" );
          return false;
        }
      }
    });  

	$('.button.delete[data-action="delete"]').click(function ()
	{	
		$('#confirm_delete_dialog_meet').attr('data-meet', $(this).attr('data-meet'))
										.dialog('open');
	});

	$('#confirm_drop_dialog_meet').dialog(
	{
      autoOpen: false,
      resizable: false,
      height:225,
      width: 400,
      modal: true,
      buttons: {
        "Yes": function() {
          	
        	var team = $(this).attr('data-team');
        	var meet = $(this).attr('data-meet');

			$.ajax(
			{
				type : "POST",
				url  : '<?php echo url('/meets/drop'); ?>',
				data : { 'team' : team,
						 'meet' : meet },
				success : function()
				{
					location.reload();					
				}
			});

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

			return true;
        },
        "No": function() {
          $(this).dialog( "close" );
          return false;
        }
      }
    });  

	$('.button.cancel[data-action="drop"]').click(function ()
	{	
		$('#confirm_drop_dialog_meet').attr('data-meet', $(this).attr('data-meet'))
									  .dialog('open');
	});



	// Click next button during stage 1
	$('.button.next[data-stage="1"]').click(function ()
	{
		// Ensure meet type is selected
		if ($('input[name="meet_type"]:checked').size() != 1)
		{
			alert ('You must select the type of the meet to continue.');
			return false;
		}

		// Ensure host team is selected
		if ($('input[name="host_team"]').val() == "")
		{
			alert ('You must enter in the hosting team\'s name.');
			return false;
		}

		$('.error').effect("drop", { direction : "right"}, "slow");

		// Transition to the next stage
		$('[name="directions"]').effect("drop", { direction : "right"}, "slow", function ()
		{
			// Meet type is DUAL
			if ($('input[name="meet_type"]:checked').val() == 'DUAL')
			{
				// Show the host name (safeified)
				$('[name="hosting_team_name"]').html($('input[name="host_team"]').val().replace(/<\/?[^>]+(>|$)/g, ""));

				// Do not allow the other team to be OOS if the host is OOS
				if ($('input[name="host_is_oos"]:checked').length > 0 || $('input[name="host_team"]').val() != '<?php echo str_replace('\'', '\\\'', $information['activity_program']->name); ?>')
		    	{
		    		$('input[name="other_team_is_oos"]').attr('disabled' , 'disabled');   		
		    		$('input[name="other_team"]').val('<?php echo str_replace('\'', '\\\'', $information['activity_program']->name); ?>').attr('disabled', 'disabled');

		    	}		    	

				// Show the dual meet creator
				$('[name="dual_creator"]').fadeIn();
			}
			else
			{
				// Show the host name (safeified)
				$('[name="hosting_team_name"]').html($('input[name="host_team"]').val().replace(/<\/?[^>]+(>|$)/g, ""));

				if ($('input[name="host_team"]').val() == '<?php echo str_replace('\'', '\\\'', $information['activity_program']->name); ?>' || $('input[name="host_is_oos"]:checked').length > 0)
				{
					// Show the invitational meet creator (since this is the host team or the host is OOS)
					$('[name="inv_creator"]').fadeIn();
				}
				else
				{
					// Show the invitational meet finder
					$('.button.next_add').button('disable');
					$('.button.join').button('disable');
					
					$('select[name="available_meets"]').parent().append("<div class='ajax_loader' style='width:16px; height:11px; background-image: url(http://www.osaa.org/images/icons/ajax_loader2.gif); background-repeat:no-repeat; position: absolute; top: 2em; left: 1em;'></div>");

					$('[name="inv_finder"]').fadeIn();

					// Get a list of meets for this host team
					var name = $('input[name="host_team"]').val().replace('/<\/?[^>]+(>|$)/g', "");

					$('#returned_result_count').html('(Searching...)');
					
					var jqxhr = $.ajax(
					{
						type : 'GET',
						url : '/teams/get-meets?name=' + name + '&activity=<?php echo $information['activity_program']->activity; ?>',
						dataType : 'html'
					});
					
					jqxhr.done(function (data)
					{
                    	var list = $.parseJSON(data);
                    	
                    	for (var i = 0; i < list.length; i++)
                    	{
                    		var id = list[i].id;
                    		var value = list[i].value;
                    		
                    		$('select[name="available_meets"]').append('<option value="' + id + '">' + value + '</option>');
	                    }
						
						var c = list.length;

						$('#returned_result_count').html('(Found ' + c + ' to choose from)');
                    });

                    jqxhr.fail(function ()
                   	{
                   		$('#returned_result_count').html('(Unable to find any)');
                    });

                    jqxhr.always(function ()
                    {
                     	$('.button.next_add').button('enable');
                     	$('.ajax_loader').hide();                     	
                 	});

				}
			}
		});

		// Disable the first form options
		$('[name="meet_type"]').button("disable");
		$('[name="host_team"]').attr('disabled', 'disabled');
		$('[name="host_is_oos"]').attr('disabled', 'disabled');
		$('[name="state"]').attr('disabled', 'disabled');		
	});


	// Create button is clicked from the invitational meet finder
	$('.button.next_add[data-from="INV_F"]').click(function ()
	{
		$('select[name="available_meets"]').children().remove();
		$('#returned_result_count').html('');

		// Show the host name (safeified)
		$('[name="hosting_team_name"]').html($('input[name="host_team"]').val().replace(/<\/?[^>]+(>|$)/g, ""));

		// Do not allow the other team to be OOS if the host is OOS
		if ($('input[name="host_is_oos"]:checked').length > 0 || $('input[name="host_team"]').val() != '<?php echo str_replace('\'', '\\\'', $information['activity_program']->name); ?>')
    	{
    		$('input[name="other_team_is_oos"]').attr('disabled' , 'disabled');   		
    		$('input[name="other_team"]').val('<?php echo str_replace('\'', '\\\'', $information['activity_program']->name); ?>').attr('disabled', 'disabled');
    	}	

		// Transition to the next stage
		$('[name="inv_finder"]').effect("drop", { direction : "right"}, "slow", function ()
		{				
			$('.button.join').button('disable');
			$('.button.next_add').button('disable');	

			// Show the inv meet creator
			$('[name="inv_creator"]').fadeIn();		
		});
	});


	// Add teams button is clicked from the invitational meet creator
	$('.button.add_teams[data-from="INV"]').click(function ()
	{
		// Make sure we have the required information
		var d = $('#event_date2').val().replace(/<\/?[^>]+(>|$)/g, "");

		if (d.match(/^\d{2}\/\d{2}\/\d{4}$/) == null)
		{
			alert ('You must enter the meet date in MM/DD/YYYY format.');
			return false;
		}
		

		var n = $('#meet_name').val().replace(/<\/?[^>]+(>|$)/g, "");

		if (n == '')
		{
			alert ('You must enter the meet name.');
			return false;
		}

		// Show the meet name (safeified)
		$('[name="new_inv_meet_name"]').html(n);
		$('[name="new_inv_meet_date"]').html(d);


		// Add the host to the list of participating schools
		var h = $('input[name="host_team"]').val().replace(/<\/?[^>]+(>|$)/g, "");
		
		if ($('input[name="host_is_oos"]:checked').length > 0)
    	{
    		h = h + ' (' + $('input[name="state"]:selected').val() + ')';
    	}

		var e = '<?php echo str_replace('\'', '\\\'', $information['activity_program']->name); ?>';

		$('input[name="add_team[0]"]').val(h);

		if (h != e)
		{
			$('input[name="add_team[1]"]').val(e);
		}


		// Transition to the next stage
		$('[name="inv_creator"]').effect("drop", { direction : "right"}, "slow", function ()
		{				
			// Show the add team view
			$('[name="inv_creator2"]').fadeIn();		
		});
	});


	// Reset button is clicked from the dual meet creator
	$('.button.reset[data-from="DUAL"]').click(function ()
	{		
		$('#meet_adder').trigger('reset');
		$('input[name="other_team_is_oos"]').removeAttr('disabled');
		$('input[name="other_team"]').removeAttr('disabled');

		// Transition to the previous stage
		$('[name="dual_creator"]').effect("drop", { direction : "right"}, "slow", function ()
		{
			// Enable the first form options
			$('[name="meet_type"]').button("enable");
			$('[name="host_team"]').removeAttr('disabled');
			$('[name="host_is_oos"]').removeAttr('disabled');
			$('[name="state"]').attr('disabled', 'disabled');		

			// Show the dual meet creator
			$('[name="directions"]').fadeIn();		
		});
	});

	// Reset button is clicked from the individual meet creator
	$('.button.reset[data-from="INV"]').click(function ()
	{		
		$('#meet_adder').trigger('reset');
		$('input[name="other_team_is_oos"]').removeAttr('disabled');
		$('input[name="other_team"]').removeAttr('disabled');

		// Transition to the previous stage
		$('[name="inv_creator"]').effect("drop", { direction : "right"}, "slow", function ()
		{
			// Enable the first form options
			$('[name="meet_type"]').button("enable");
			$('[name="host_team"]').removeAttr('disabled');
			$('[name="host_is_oos"]').removeAttr('disabled');
			$('[name="state"]').attr('disabled', 'disabled');		

			// Show the dual meet creator
			$('[name="directions"]').fadeIn();		
		});
	});

	// Reset button is clicked from the individual meet creator
	$('.button.reset[data-from="INV2"]').click(function ()
	{		
		$('#meet_adder').trigger('reset');
		$('input[name="other_team_is_oos"]').removeAttr('disabled');
		$('input[name="other_team"]').removeAttr('disabled');

		// Transition to the previous stage
		$('[name="inv_creator2"]').effect("drop", { direction : "right"}, "slow", function ()
		{
			// Enable the first form options
			$('[name="meet_type"]').button("enable");
			$('[name="host_team"]').removeAttr('disabled');
			$('[name="host_is_oos"]').removeAttr('disabled');
			$('[name="state"]').attr('disabled', 'disabled');		

			// Show the dual meet creator
			$('[name="directions"]').fadeIn();		
		});
	});

	// Reset button is clicked from the invitational meet finder
	$('.button.reset[data-from="INV_F"]').click(function ()
	{		
		$('#meet_adder').trigger('reset');
		$('input[name="other_team_is_oos"]').removeAttr('disabled');

		$('select[name="available_meets"]').children().remove();
		$('#returned_result_count').html('');

		// Transition to the previous stage
		$('[name="inv_finder"]').effect("drop", { direction : "right"}, "slow", function ()
		{
			// Enable the first form options
			$('[name="meet_type"]').button('enable');
			$('[name="host_team"]').removeAttr('disabled');
			$('[name="host_is_oos"]').removeAttr('disabled');
			$('[name="state"]').attr('disabled', 'disabled');	
			$('.button.join').button('disable');
			$('.button.next_add').button('disable');	

			// Show the dual meet creator
			$('[name="directions"]').fadeIn();		
		});
	});

	
	$('select[name="available_meets"]').change(function ()
	{
		$('.button.join').button('enable');
	});

	$('.button.add_more_team_spots').click(function ()
	{
		$('[data-holder="teams"]').append('<br /><br />');

		var i = $('input[type="text"]', '[data-holder="teams"]').size();


		var row = $('<input>').attr('style', 'width:215px')
						      .attr('class', 'school_autocomplete')
						      .attr('name', 'add_team[' + i + ']')
						      .attr('type', 'text');
		
		row.autocomplete(
	    {
	    	source : availableOpponents
		});	
		

		$('[data-holder="teams"]').append(row);

		$('[name="add_team[' + i + ']"').focus();
	});

	
	// Join an invitational
	$('.button.join[data-from="INV_F"]').click(function ()
	{
		$('#meet_adder').append('<input type="hidden" name="action" value="join_inv" />');		
		$('#meet_adder').trigger('submit');
	});


	// Create a dual
	$('.button.create[data-from="DUAL"]').click(function ()
	{
		// Make sure we have the required information		
		var d = $('#event_date').val().replace(/<\/?[^>]+(>|$)/g, "");

		if (d.match(/^\d{2}\/\d{2}\/\d{4}$/) == null)
		{
			alert ('You must enter the meet date in MM/DD/YYYY format.');
			return false;
		}		

		var n = $('#other_team').val().replace(/<\/?[^>]+(>|$)/g, "");		

		if (n == '')
		{
			alert ('You must enter the name of the other team participating in this meet.');
			return false;
		}

		$('[name="meet_type"]').button('enable');
		$('[name="host_team"]').removeAttr('disabled');
		$('[name="other_team"]').removeAttr('disabled');
		$('[name="host_is_oos"]').removeAttr('disabled');
		$('#state').removeAttr('disabled');

		$('#meet_adder').append('<input type="hidden" name="action" value="create_dual" />');		
		$('#meet_adder').trigger('submit');
	});

	// Create an invitational
	$('.button.create[data-from="INV"]').click(function ()
	{
		$('[name="meet_type"]').button('enable');
		$('[name="host_team"]').removeAttr('disabled');
		$('[name="host_is_oos"]').removeAttr('disabled');
		$('#state').removeAttr('disabled');

		$('#meet_adder').append('<input type="hidden" name="action" value="create_inv" />');		
		$('#meet_adder').trigger('submit');
	});


	<?php if (!Auth::user()->isOsaaUser()): ?>
        <?php foreach (array('A', 'EX', 'PO') as $type): ?>

            <?php if (Input::old('contest_type') != $type): ?>
                var item = $('input[type="radio"][name="contest_type"][value="<?php echo $type; ?>"]');

                item.attr('disabled', 'disabled');
                item.button('disable');
            <?php endif; ?>

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


    /*
     * Create contest expander
     */
    var expand_create = $('h4[data-action="expand_create"]');    
    var expand_help = $('.help[data-action="expand_create"]');
    var expand_image = $('img', expand_create);
    var create_section = $('.add_contest');
    expand_create
        .css({'cursor' : 'pointer'})
        .on('click', function(event)
        {
            event.preventDefault();

            if (create_section.is(':visible'))
            {
                create_section.slideUp(400);
                expand_help.slideDown(400);
                expand_image.attr('src', '<?php echo asset('/images/icons/bullet_arrow_right.png'); ?>');
            }
            else
            {
                create_section.slideDown(400);
                expand_help.slideUp(400);
                expand_image.attr('src', '<?php echo asset('/images/icons/bullet_arrow_down.png'); ?>');
            }
        });


    /*
     * Copy team schedule feature
     */    
    $('#copy_schedule_list')
        .menu()
        .css({'display' : 'none',
              'z-index' : '200',
              'position' : 'absolute',
              'font-size' : '9pt',
              'right' : '0',
              'top' : '23px',
              'margin' : '0',
              'padding' : '0',            
              'width' : '175px'});
     $('#copy_schedule_list li ul')
        .css({'margin' : '0',
              'padding' : '0',
              'width' : '160px'});
    $('#copy_schedule_list img')
        .css({'position' : 'relative',
              'top' : '2px',
              'margin-right' : '6px'});
    $('.copy_schedule')
        .button({ icons : { secondary : 'ui-icon-triangle-1-e'}})
        .css({'float':'right',
              'font-size':'8pt'})
        .click(function (event)
        {
            if ($('#copy_schedule_list').is(':visible'))
            {
                $('#copy_schedule_list').slideUp(400);
                $(this).button({icons : { secondary : 'ui-icon-triangle-1-e'}});
            }
            else
            {
                $('#copy_schedule_list').slideDown(400);
                $(this).button({icons : { secondary : 'ui-icon-triangle-1-s'}});
            } 

            event.stopPropagation();  
        });
    $(document).on('click', function(event)
    {
        var list = $("#copy_schedule_list");
        
        if (list.is(':visible'))
        {
            list.slideUp(400);
            $('.copy_schedule').button({icons : { secondary : 'ui-icon-triangle-1-e'}});
            event.stopPropagation();
        }
    });
    $('[data-copy-to-level]').on('click', function(event)
    {
        // Do not follow link
        event.preventDefault();

        // Get the clicked link
        var link = $(this);
        
        // Get the target level information
        var target_level = {
            'slug' : link.attr('data-copy-to-level'),
            'name' : link.attr('data-level-name')
        };

        // Show copy schedule dialog
        $('<div></div>')
            .appendTo('body')
            .dialog(
            {                       
                draggable : false,
                resizable : false,
                height : 600,                
                width : 750,                
                modal : true,
                title : 'Copy Varsity Schedule to ' + target_level.name + ' Team',                    
                dialogClass : 'copy_schedule_dialog',
                buttons: [
                {
                    text : "Cancel",
                    'class' : "float_right",                            
                    icons : { primary : 'ui-icon-cancel'},
                    click : function()
                    {
                        // Cancel button is clicked

                        // Close the dialog box
                        $(this).dialog("close");                                     
                    }
                },
                {
                    text : "Copy",
                    'class' : "float_left start_copy_button",
                    icons : { primary : 'ui-icon-copy'},
                    click : function()
                    {                                                       
                        var dialog_object = $(this);

                        // Copy button is clicked

                        // Show a confirmation box
                        $('<div></div>')
                        .appendTo('body')
                        .dialog(
                        {                       
                            modal : true,
                            draggable : true,
                            resizable : false,
                            title : 'Confirmation',
                            dialogClass : 'confirm_dialog',
                            height : 250,
                            width : 400, 
                            buttons: [
                                {
                                    text : "No",
                                    'class' : "float_right",                            
                                    icons : { primary : 'ui-icon-cancel'},
                                    click : function()
                                    {
                                        // Confirmation not received

                                        // Close the confirmation dialog box
                                        $(this).dialog("close");                                         
                                    }
                                },
                                {
                                    text : "Yes",
                                    'class' : "float_left",
                                    icons : { primary : 'ui-icon-check'},
                                    click : function()
                                    {                                                       
                                        // Confirmation received

                                        // Close the confirmation dialog box
                                        $(this).dialog('close');

                                        // Disable the buttons                                        
                                        var buttons = [
                                            {
                                                text : "Finish",
                                                'class' : "float_right copy_schedule_buttons",
                                                'data-autofocus' : "true",
                                                icons : { primary : 'ui-icon-check'},
                                                click : function()
                                                        {
                                                            // Show the loading window
                                                            $('<div><div>')
                                                                .attr('data-loading', 1)
                                                                .addClass('ui-widget-overlay ui-front')
                                                                .appendTo('body');
                                                                  
                                                            $('<div><div>').appendTo('body')
                                                                .attr('data-loading', 1)
                                                                .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 />Reloading...<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 page is reloaded ...</div>');

                                                            location.reload();
                                                        }
                                            }
                                        ];

                                        // Update the button options
                                        dialog_object.dialog('option', 'buttons', buttons);

                                        // Disable the buttons
                                        $('.copy_schedule_buttons').button('disable');

                                        // Hide the close button
                                        $('.ui-dialog-titlebar-close', '.copy_schedule_dialog').css({'display' : 'none'}); 
  
                                        // Change the title
                                        dialog_object.dialog('option', 'title', 'Copying Varsity Schedule to ' + target_level.name + ' Team');                                       
  
                                        // Remove excluded contest rows
                                        $('tr[data-include="0"]', '.copy_schedule_dialog').fadeOut(400, function() { $(this).remove() });

                                        // Get the rows to process
                                        var rows = $('tr[data-include="1"]', '.copy_schedule_dialog');
                                        var total = rows.length;         

                                        // Ensure there are contests selected to copy
                                        if (total < 1)
                                        {
                                            alert('You have not selected any contests to copy.');
                                            location.reload();
                                        }                               

                                        // Lock in the rows of contests to be copied and update their icons
                                        $('img.toggle_copy_inclusion', rows).attr('src', '<?php echo asset('/images/icons/ajax_loader2.gif'); ?>');
                                        $('img.toggle_copy_inclusion', rows).unbind('click').css({'cursor' : 'auto'});
                                        $('input[type="text"]', rows).attr('readonly', 'readonly').attr('disabled', 'disabled');

                                        // Setup count variables
                                        var error_count = 0;
                                        var index = 0;
                                        var stage = 0;                                        
                                        
                                        // Get the current height of the instructions text element
                                        var previous_height = $('.instructions', dialog_object).height();

                                        // Update the instruction text
                                        var html = '<br /><img src="http://www.osaa.org/images/icons/ajax_loader3.gif" alt="" title="" class="copy_status_icon" style="float: left; margin: 0 10px 10px 0; width: 64px; height: 64px;" /><b><span class="copy_status_title">Copying Schedule...</span></b><br /><br /><span class="copy_status_text">Please wait while your Varsity schedule is copied to your ' + target_level.name + ' schedule.  This may take a while to process.  Do not close this dialog or use your browser\'s back button.</span><br /><br /><b>Progress:</b><br /><div class="sync_progressbar" style="height: 1.5em;"></div>';
                                        $('.instructions', dialog_object).html(html);

                                        // Setup the progress bar
                                        var progress_bar = $('.sync_progressbar', dialog_object);
                                        progress_bar.progressbar({ value : stage, max : total});

                                        // Return the instructions to the correct height
                                        $('.instructions', dialog_object).height(previous_height);

                                        // Define a function to copy a contest from a row of data
                                        function copyContest(index)
                                        {
                                            // Get the row
                                            var row = $(rows[index]);

                                            // Get the data object
                                            var data = {
                                                contest_id : row.attr('data-contest-id'),
                                                time : $('input[name="time"]', row).val(),
                                                dismiss_time : $('input[name="dismiss_time"]', row).val(),
                                                depart_time : $('input[name="depart_time"]', row).val(),
                                                return_time : $('input[name="return_time"]', row).val(),
                                                designation : row.attr('data-designation'),
                                                target_team : row.attr('data-target-team-id'),
                                                target_level : target_level.slug
                                            };

                                            // Submit data to be copied to target team's schedule
                                            var jqxhr = $.ajax(
                                            {
                                                type : 'POST',
                                                url : '<?php echo url('teams'); ?>/' + <?php echo $information['team']->id; ?> + '/contests/' + row.attr('data-contest-id') + '/copy',
                                                dataType : 'html',
                                                data : data
                                            })
                                            .done(function (returned_data)
                                            {                               
                                                var error_returned = false;
                                                
                                                try
                                                {
                                                    var returned_status = $.parseJSON(returned_data);

                                                    if (returned_status.status != 'OK')
                                                    {
                                                        error_returned = true;
                                                    }
                                                }
                                                catch (err)                                                
                                                {
                                                    error_returned = true;
                                                }                                                                                               

                                                if (!error_returned)                                                
                                                {
                                                    // Turn this row green and update its icon
                                                    $('img.toggle_copy_inclusion', row).attr('src', '<?php echo asset('/images/icons/check_mark_16px.png'); ?>').attr('title', 'This contest was successfully copied.');
                                                    row.css({'background' : '#c9ffc9'}); 
                                                }
                                                else
                                                {
                                                    // Turn this row red and update its icon
                                                    $('img.toggle_copy_inclusion', row).attr('src', '<?php echo asset('/images/icons/alert_16px.png'); ?>').attr('title', 'There was an error while attempting to copy this contest.');
                                                    row.css({'background' : '#f3cdc6'});                                                

                                                    error_count += 1;
                                                }   
                                                
                                            })
                                            .fail(function (jqXHR, status, error)
                                            {                                                   
                                                // Turn this row red and update its icon
                                                $('img.toggle_copy_inclusion', row).attr('src', '<?php echo asset('/images/icons/alert_16px.png'); ?>').attr('title', 'There was an error while attempting to copy this contest.');
                                                row.css({'background' : '#f3cdc6'});                                                

                                                error_count += 1;
                                            })
                                            .always(function ()
                                            {
                                                index += 1;

                                                stage += 1;                                                
                                                progress_bar.progressbar('value', stage);

                                                // Done?
                                                if (index == rows.length)
                                                {                                                    
                                                    if (error_count == 0)
                                                    {
                                                        // No errors
                                                        $('.ui-progressbar-value', progress_bar).css({'background' : '#2ae44d'});

                                                        dialog_object.dialog('option', 'title', 'Copied Varsity Schedule to ' + target_level.name + ' Team');
                                                        $('.copy_status_icon', dialog_object).attr('src', '<?php echo asset('/images/icons/success_64px.png'); ?>');
                                                        $('.copy_status_title', dialog_object).html('Schedule Successfully Copied');
                                                        $('.copy_status_text', dialog_object).html('The Varsity schedule was successfully copied to your ' + target_level.name + ' schedule.  The contests highlighted in green were copied successfully. Click <b>Finish</b> to reload this page.');
                                                    }
                                                    else
                                                    {
                                                        // There were errors
                                                        $('.ui-progressbar-value', progress_bar).css({'background' : '#ff0000'});

                                                        dialog_object.dialog('option', 'title', 'Copy Varsity Schedule to ' + target_level.name + ' Team');
                                                        $('.copy_status_icon', dialog_object).attr('src', '<?php echo asset('/images/icons/yield_icon_72px.png'); ?>');
                                                        $('.copy_status_title', dialog_object).html('Finished with Errors');
                                                        $('.copy_status_text', dialog_object).html('There were errors while the Varsity schedule was copied to your ' + target_level.name + ' schedule.  The contests highlighted in red were not copied successfully. Click <b>Finish</b> to reload this page.');
                                                    }
                                                    
                                                    // Enable the finish button
                                                    $('.copy_schedule_buttons').button('enable');                                                    
                                                    
                                                    // Focus on the autofocus element
                                                    dialog_object.parent().find('[data-autofocus]').focus();                                                
                                                }
                                                else
                                                {                                                    
                                                    copyContest(index);
                                                }
                                            });
                                        }

                                        copyContest(index);
                                    }
                                }                        
                            ],                                 
                            open : function ()
                            {
                                var html = '<br /><span class="ui-icon ui-icon-alert float_left" style="vertical-align: middle;"></span>Are you sure you wan to copy the selected Varsity contests to your ' + target_level.name + ' schedule?';

                                $(this).html(html);
                                
                                $('.ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '9pt');
                                $('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%');                       
                                
                                $('.confirm_dialog .ui-widget-header').css('background', '#f6a828 url(http://download.jqueryui.com/themeroller/images/ui-bg_gloss-wave_35_f6a828_500x100.png) 50% 50% repeat-x').css('border-color', '#f6a828');                                     
                                $('.confirm_dialog.ui-widget-content').css('border-color', '#f6a828'); 
                            },
                            close : function ()
                            {
                                $(this).remove();                        
                            }                
                        });  
                    }
                }],
                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').css('padding', '0 0.5em').css('font-size', '9pt');
                    $('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%');   

                    var jqxhr = $.ajax(
                    {
                        type : 'GET',
                        url : '<?php echo url('teams'); ?>/' + <?php echo $information['team']->id; ?> + '/copy-schedule?target-level=' + target_level.slug,
                        dataType : 'html'
                    })
                    .done(function (returned_data)
                    {                               
                        dialog_object.html(returned_data);
                    })
                    .fail(function (jqXHR, status, error)
                    {                                                   
                        try 
                        {
                            var response = jqXHR.responseText;
                            var errorData = $.parseJSON(response);                                                      
                            dialog_object.html('<h3 style="margin: 0.5em 0;">' + errorData.error.type + '</h3>' + errorData.error.message + '<br /><br /><span style="  font-ze: 9pt;">Line ' + errorData.error.line + ' in ' + errorData.error.file);                                          
                        }
                        catch(err)
                        {
                            dialog_object.html('There was an error.');
                        }

                        // Disable the submit button if there was an error                        
                        $('.start_copy_button').button('disable');
                    })
                    .complete(function ()
                    {
                        // Form logic and bindings
                        $('[data-format="contest_time"]', dialog_object).timepicker({ 'timeFormat': 'h:i A' , 'step' : 15, 'maxTime' : '10:00pm'});

                        $('img.toggle_copy_inclusion', dialog_object)
                            .css({'cursor' : 'pointer'})
                            .on('click', function(event)
                            {
                                var img = $(this);
                                var row = img.parents('tr');

                                var include = row.attr('data-include');

                                if (include == 1)
                                {
                                    // Exclude
                                    img.attr('src', '<?php echo asset('/images/icons/not_selected_16px.png'); ?>');
                                    row.attr('data-include', 0);
                                    row.addClass('odd');
                                }
                                else
                                {
                                    // Include
                                    img.attr('src', '<?php echo asset('/images/icons/check_16px.png'); ?>');
                                    row.attr('data-include', 1);
                                    row.removeClass('odd');
                                }

                            });                        

                    });                        
                },
                close : function ()
                {
                    var dialog_object = $(this);
                    $(dialog_object).remove();
                }                
            });
        
    });
  
<?php $__env->stopSection(); ?>

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

    
	<div class="ui-icon ui-icon-arrowreturnthick-1-e" style="display:inline-block; position:relative; top:3px;"></div>

	<div id="related_teams" style="font-size:8pt; margin-right:4px; display:inline-block;">
		<?php
		    foreach ($information['related_teams'] as $team)
		    {
		    	echo '<input type="radio" id="radio' . $team->level . '" name="team_select" data-href="' . url('/teams/' . $team->id . '/edit') . '"';
		    	
		    	if ($information['team']->id == $team->id)
		    	{
		    		echo 'checked="checked"';
		    	}		    	
		    	echo ' /><label for="radio' . $team->level . '" class="tooltip" title="Jump to the ' . strtolower (Helpers::getLevelName ($team->level)) . ' team">' . $team->level . '</label>';
	    	}	    
	    ?>	    	    
  	</div>

	<?php if (Auth::user()->canAccessTeamTask($information['activity_program']->id, 'ADMIN', true) and $information['activity_program']->countTeams() < 5 and $information['activity_program']->getActivityType() == 'TS'): ?>                                    
  		<a id="add_team" class="tooltip" title="Add another team" style="height:23px; margin:0 0 0 1px;" href="<?php echo url('teams/add/' . $information['activity_program']->id); ?>"></a>
  	<?php endif; ?>

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


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

	<?php /*  Success Bar  */ ?>
    <?php if (Session::has('success') or Session::has('success_alert')): ?>
        <div class="success_bar<?php echo (Session::has('success_alert')) ? '_alert' : null; ?>">
            <div class="message">       
                <?php if (Session::has('success')): ?>
                    <?php echo Session::get('success'); ?>
                <?php else: ?>
                    <?php echo Session::get('success_alert'); ?>
                <?php endif; ?>
            </div>      
        </div>
    <?php endif; ?>

	<div class="tabs edit_team">
		<ul style="padding-left:5px;">
			<?php if (Helpers::strEqual (Helpers::getActivityType($information['activity_program']->activity), array('TS', 'IS'))): ?>
				<li><a href="#tabs-1">Schedule</a></li>
			<?php endif; ?>
			<li><a href="#tabs-2">Roster</a></li>
			<li><a href="#tabs-3">Team Photo</a></li>
			<?php if (Helpers::strEqual($information['activity_program']->activity, 'BBL')): ?>
				<li data-escape="<?php echo url('/teams/' . $information['activity_program']->id); ?>#tabs-pitch-counts"><a href="#">Pitch Counts</a></li>
			<?php endif; ?>

			<a href="/account#tabs-0" class="home_button float_right tooltip" title="Return to my school page."></a>

            <?php if (Auth::user()->isOsaaUser() and Helpers::strEqual(Auth::user()->email, array('gibbyr@osaa.org', 'kellyf@osaa.org'))): ?>

                <a href="#" class="drop_team_button float_right tooltip" title="Remove this team." style="font-size: 9pt;" data-team-id="<?php echo $information['team']->id; ?>" data-team-level="<?php echo $information['team']->level; ?>" data-ap-name="<?php echo $information['activity_program']->name; ?>" data-activity="<?php echo Helpers::getActivityName($information['activity_program']->activity); ?>">Drop Team</a>

            <?php endif; ?>


			<?php if ($information['team']->level == 'V'): ?>

				<a href="<?php echo url('/teams/' . $information['team']->id . '/edit/out-of-state'); ?>" class="oos_button float_right tooltip" title="Manage your out-of-state opponents' records (if applicable.)" style="font-size:9pt;">Out-of-State Management</a>

			<?php endif; ?>

			<a href="<?php echo url('/teams/' . $information['activity_program']->id); ?>" class="team_view_button float_right tooltip" title="View this team as the general public would see it." style="font-size:9pt;">Public View</a>			

		</ul>
		
		<?php if (Helpers::strEqual (Helpers::getActivityType($information['activity_program']->activity), array('TS', 'IS'))): ?>
		<div id="tabs-1" style="position: relative;">
			
			<?php
				$contest_or_meet = (Helpers::strEqual (Helpers::getActivityType($information['activity_program']->activity), 'ts')) ? 'contest' : 'meet';		
			?>

			<h2><?php echo ucfirst($contest_or_meet); ?> Schedule</h2>            			

			<?php if (Helpers::strEqual($contest_or_meet, 'contest')): ?>                
                        
                <?php /*  Schedule Functions (Download/Copy)  */ ?>
                <div class="copy_schedule_holder">                
                    <div class="copy_schedule" data-team="<?php echo $information['team']->level; ?>">Schedule Functions</div>
                    <ul id="copy_schedule_list">                            
                        
                        <li><a href="<?php echo url('/teams/' . $information['team']->id . '/schedule'); ?>" target="_blank"><img src="<?php echo asset('/images/icons/csv_file_16px.png'); ?>" alt="" title="" />Download <?php echo $information['team']->level; ?> Schedule</a></li>                            
                      
                        <?php if (count($information['related_teams']) > 1): ?>
                            <li><a href="<?php echo url('/teams/' . $information['team']->id . '/multi-schedule'); ?>" target="_blank"><img src="<?php echo asset('/images/icons/csv_file_16px.png'); ?>" alt="" title="" />Download All Schedules</a></li>
                        <?php endif; ?>

                        <?php if (Helpers::strEqual($information['team']->level, 'V')): ?>
                            <?php foreach ($information['related_teams'] as $other_team): ?>
                                <?php if (Helpers::strEqual($other_team->level, $information['team']->level)) continue; ?>
                                <li><a href="#" data-copy-to-level="<?php echo $other_team->level; ?>" data-level-name="<?php echo Helpers::getLevelName ($other_team->level); ?>" data-team-id="<?php echo $other_team->id; ?>"><img src="<?php echo asset('/images/icons/copy_schedule_16px.png'); ?>" alt="" title="" />Copy to <?php echo $other_team->level; ?> Team</a></li>
                            <?php endforeach; ?>
                        <?php endif; ?>

                    </ul>  
                </div>                


                <h4 data-action="expand_create">
                    <img src="<?php echo asset('/images/icons/bullet_arrow_right.png'); ?>" alt="" title="" style="vertical-align: top;" />
                    Add a <?php echo ucfirst($contest_or_meet); ?>
                </h4>
                <div class="help small gray note" data-action="expand_create">Click to expand the section to add a new contest.</div>


				<?php if (Auth::user()->canAccessTeamTask($information['activity_program']->id, 'ADMIN', true) or true): ?>

					<?php /*  Add a contest  */ ?>				    
					<div class="section add_contest" <?php if (!Session::has('errors')): ?> style="display: none;" <?php endif; ?>>

						<?php echo Form::open(array('url' => url('/contests/create'), 'class' => 'addContest')); ?>

						<?php if (Session::has('errors')): ?>                
			                <div class="error ui-state-error"><span class="ui-icon ui-icon-alert box_icon"></span><?php foreach ($errors->all() as $error): ?><?php echo $error; ?> <?php endforeach; ?></div>
			            <?php endif; ?>

			          	<?php echo Form::hidden('team', $information['team']->id); ?>
			          	<?php echo Form::hidden('activity_program', $information['activity_program']->id); ?>	          		          	

			            <?php echo Form::hidden('event_type', 'CNTST'); ?>
			            <?php echo Form::hidden('event_status', 'SCHD'); ?>	           
			           
			            <?php echo Form::hidden('home_team_name', $information['home_team_name']); ?>
			            <?php echo Form::hidden('away_team_name', ' '); ?>

			            <?php echo Form::hidden('swapped', Input::old('swapped', -1), array('id' => 'swapped')); ?>

			            
			            <div style="float:right; width:500px; height:42px; line-height:21px;">
			            	
			            	<b>Home: </b><span id="home_team_name"></span><br />
			            	<b>Away: </b><span id="away_team_name"></span>         	
			            	
			            </div>


						<?php echo Form::label('event_date', 'Date:', array('class' => 'input_label', 'style' => '')); ?>
						<?php echo Form::text('event_date', null, array('style' => 'width:100px;')); ?>
						<img src="<?php echo asset('images/icons/help_24px.png'); ?>" alt="?" class="tooltip" title="Select the date when this contest starts using the date picker." style="position:relative; top:3px; width:16px; height:16px;" />

						<div style="display:inline-block; width:25px;"></div>

						<?php echo Form::label('event_time', 'Time:', array('class' => 'input_label', 'style' => '')); ?>
						<?php echo Form::text('event_time', '7:00 PM', array('class' => 'tooltip', 'style' => 'width:80px;', 'title' => 'Select from the drop-down list what time the contest starts.  Or, leave the time black if the start time is unknown.')); ?>

						<?php echo Form::select('time_zone',
				                        array('PT' => 'Pacific', 'MT' => 'Mountain', 'CT' => 'Central', 'ET' => 'Eastern'),
				                        'PT',
				                        array('style' => 'width: 75px; font-size: 8pt;')); ?>
										
						<div id="swap_home_away" class="tooltip" title="Swap the home and away team designations"></div>

						<br />
						<div class="small gray note">Date format: MM/DD/YYYY</div>

						<br />
						
						<?php echo Form::label('opponent', 'Opponent: ', array('class' => 'input_label')); ?>	           
			            <?php echo Form::text('opponent', null, array('style' => 'width:325px;')); ?>	            

			            <img src="<?php echo asset('images/icons/help_24px.png'); ?>" alt="?" class="tooltip" title="Enter in your opponent school's name.  A drop-down list will appear with suggestions.  Tab or click out of the box to confirm selection.  Leave blank for TBD opponents." style="position:relative; top:3px; width:16px; height:16px;" />

			            <div style="display:inline-block; width:15px;"></div>

			            <?php echo Form::select('opponent_level', array('V' => 'V', 'JV' => 'JV', 'JV2' => 'JV2', 'FR' => 'FR', 'FR2' => 'FR2'), $information['team']->level, array('style' => 'width:60px;', 'class' => '', 'title' => 'Select your opponent\'s level.')); ?>

						<div style="display:inline-block; width:25px;"></div>

			            <?php echo Form::checkbox('is_oos_opponent', true, null, array('id' => 'is_oos_opponent')); ?>
			            <?php echo Form::label('is_oos_opponent', 'Out-of-State', array('style' => 'font-size:10pt;', 'class' => 'tooltip', 'title' => 'If the opponent if an out-of-state opponent, please check this button and specify the opposing team\'s state, province, or territory.')); ?>

			            <div style="display:inline-block; width:15px;"></div>

			            <?php echo Form::label('state', 'State/Province/Territory:', array('class' => 'input_label')); ?>
			            <select style="width:60px;" id="state" name="state" disabled="disabled">
			            <?php

			                $states = DB::select("SELECT slug, name FROM states WHERE slug != 'OR' ORDER BY FIELD(slug, 'WA') DESC, FIELD(slug, 'ID') DESC, FIELD(slug, 'CA') DESC, slug");

			                foreach ($states as $s)
			                {
			                    $name = $s->name;
			                    $slug = $s->slug;	                  	

								
								echo '<option value="' . $slug . '"';

								if ($slug == Input::old('state')) echo ' selected="selected"';

								echo '>' . $slug . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $name . '</option>';	                  	
			                }

			                unset ($states);

			                echo '<option value="Other">Other</option>';

			            ?>
			        	</select>

						<br /><br />


						<b>Contest Type:</b>
						<div class="small gray note" style="display:inline; margin-left:10px;">
			            	Select the category that best describes this contest (some can only be selected by OSAA staff)
			            </div>
						

						<div style="float:right; padding-top:3px;">					
							<br />
							<?php echo Form::checkbox('is_endowment', true, null, array('id' => 'is_endowment')); ?>
							<?php echo Form::label('is_endowment', 'Endowment', array('style' => 'font-size:10pt;', 'class' => 'tooltip', 'title' => 'Is this contest an endowment contest?')); ?>					
						</div>	


						<?php /*  Contest Type  */ ?>
					    <div id="contest_type" style="font-size: 10pt; padding-top: 3px;">
							    
					        <?php foreach ($options['contest_types'] as $index => $contest_type): ?>

					            <input type="radio"
					                   id="radio_<?php echo $index; ?>"
					                   name="contest_type"
					                   value="<?php echo $contest_type->slug; ?>"                   
					                   <?php if (Input::old('contest_type') == $contest_type->slug): ?>
					                       checked="checked"
					                   <?php endif; ?> />                   
					            <label for="radio_<?php echo $index; ?>" class="tooltip" title="<?php echo $contest_type->description; ?>"><?php echo $contest_type->name; ?></label>    

					        <?php endforeach; ?>
					           
						</div>	
					    <?php /*  End Contest Type  */ ?>
						




						<?php /*  <div id="contest_type" style="font-size:10pt; padding-top:3px;">				
						    <input type="radio" id="radio1" name="contest_type" value="J" <?php if (Input::old('contest_type') == 'J'): ?> checked="checked" <?php endif; ?> /><label for="radio1" class="tooltip" title="A jamboree is a shortened contest and is not counted towards contest limitations.">Jamboree</label>    
						    <input type="radio" id="radio5" name="contest_type" value="NL" <?php if (Input::old('contest_type') == 'NL'): ?> checked="checked" <?php endif; ?> /><label for="radio5" class="tooltip" title="Contests between opponents that are not in the same league are considered non-league contests.">Non-League</label>
						    <input type="radio" id="radio6" name="contest_type" value="L" <?php if (Input::old('contest_type') == 'L'): ?> checked="checked" <?php endif; ?> /><label for="radio6" class="tooltip" title="If both opponents are from the same league or special district, then the contest is considered a league contest.">League</label>
						    <input type="radio" id="radio7" name="contest_type" value="LPO" <?php if (Input::old('contest_type') == 'LPO'): ?> checked="checked" <?php endif; ?> /><label for="radio7" class="tooltip" title="Contests played within a league to determine final league placement are considered league playoff contests.">League Playoff</label>
						    <input type="radio" id="radio8" name="contest_type" value="PI" <?php if (Input::old('contest_type') == 'PI'): ?> checked="checked" <?php endif; ?> /><label for="radio8" class="tooltip" title="Play-In games are determined by the 6A, 5A, and 4A classifications.">Play-In</label>
						    <input type="radio" id="radio9" name="contest_type" value="PO" disabled="disabled" /><label for="radio9">Playoff</label>
						</div>  */ ?>			
						
			            <div class="event_status_text" style="display:inline-block; margin-top:5px;"></div>

			            <div class="small gray note event_status_note" style="display:inline; margin-left:10px;"></div>

			            <br />

						<?php echo Form::label('tournament', 'Tournament Name: ', array('class' => 'input_label')); ?>	           
			            <?php echo Form::text('tournament', null, array('style' => 'width:200px;')); ?>

			            <img src="<?php echo asset('images/icons/help_24px.png'); ?>" alt="?" class="tooltip" title="If this contest is part of a tournament, please enter in the tournament name, and be sure to click the 'Tournament' button." style="position:relative; top:3px; width:16px; height:16px;" />
			            <div class="small gray note" style="display:inline-block;">(If in a tournament)</div>



			            <div style="display:inline-block; width:50px;"></div>	            

			           	<?php echo Form::checkbox('is_tournament', true, null, array('id' => 'is_tournament')); ?>
			            <?php echo Form::label('is_tournament', 'Tournament', array('style' => 'font-size:10pt;', 'class' => 'tooltip', 'title' => 'If this contest is being played as part of a tournament, please check this button and provide the tournament name.')); ?>	        	          
						

			            <br /><br />

						<?php echo Form::label('location', 'Alternate Location: ', array('class' => 'input_label')); ?>	           
			            <?php echo Form::text('location', null, array('style' => 'width:200px;')); ?>

			            <img src="<?php echo asset('images/icons/help_24px.png'); ?>" alt="?" class="tooltip" title="If this contest is not being played at the home team's school, please enter in an alternate contest location here.  You can also check the 'Neutral Site' button if the contest is being played at a neutral site." style="position:relative; top:3px; width:16px; height:16px;" />
			            <div class="small gray note" style="display:inline-block;">(Optional)</div>
			           
						<?php /*  Baseball/Softball contests cannot be neutral locations  */ ?>
						<?php if (!Helpers::strEqual ($information['activity_program']->activity, array('BBL', 'SBL'))): ?>

							<div style="display:inline-block; width:50px;"></div>	                     
					       
			 				<?php echo Form::checkbox('is_neutral_location', true, null, array('id' => 'is_neutral_location')); ?>
				            <?php echo Form::label('is_neutral_location', 'Neutral Site', array('style' => 'font-size:10pt;', 'class' => 'tooltip', 'title' => 'If this contest is being played at a neutral site, please check this button.')); ?>

				        <?php endif; ?>

			            <br /><br />

			            <div class="columns">
			            	<div class="third">

					            <?php echo Form::label('dismiss_time', 'Dismiss Time: ', array('class' => 'input_label')); ?>	           
					            <?php echo Form::text('dismiss_time', null, array('style' => 'width: 75px;')); ?>
                                <br class="clear" />
					            <img src="<?php echo asset('images/icons/help_24px.png'); ?>" alt="?" class="tooltip" title="What time are the students dismissed from class on the day of the contest?" style="position:relative; top:3px; width:16px; height:16px;" />
					            <div class="small gray note" style="display:inline-block;">(Optional - HH:MM, i.e. "2:35pm")</div>
					        </div>

					        <div class="third">

					            <?php echo Form::label('depart_time', 'Depart Time: ', array('class' => 'input_label')); ?>	           
					            <?php echo Form::text('depart_time', null, array('style' => 'width: 75px;')); ?>
                                <br class="clear" />
					            <img src="<?php echo asset('images/icons/help_24px.png'); ?>" alt="?" class="tooltip" title="What time are the students departing from the school; when does the bus leave?" style="position:relative; top:3px; width:16px; height:16px;" />
					            <div class="small gray note" style="display:inline-block;">(Optional - HH:MM, i.e. "2:55pm")</div>
					        </div>

                            <div class="third">

                                <?php echo Form::label('return_time', 'Return Time: ', array('class' => 'input_label')); ?>             
                                <?php echo Form::text('return_time', null, array('style' => 'width: 75px;')); ?>
                                <br class="clear" />
                                <img src="<?php echo asset('images/icons/help_24px.png'); ?>" alt="?" class="tooltip" title="What time are the students returning to the school; when does the bus come back after the contest?" style="position:relative; top:3px; width:16px; height:16px;" />
                                <div class="small gray note" style="display:inline-block;">(Optional - HH:MM, i.e. "8:30pm")</div>
                            </div>
					    </div>

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

			            <?php echo Form::submit('Create Contest', array('class' => 'submit submit_button', 'style' => '')); ?>

			            <p style="float:right; margin-right:20px; position:relative; top:5px;">
			            	Be sure to double check your entries before creating this contest.
			            </p>

			            <br /><br />

						

						<?php echo Form::close(); ?>				

					</div>
				<?php else: ?>
					<p>
						You do not have the permissions to add a contest to this schedule.
					</p>
				<?php endif; ?>

				<br />

				<div class="team_schedule_holder">

                    <h4><?php echo Helpers::getLevelName ($information['team']->level); ?> Schedule</h4>                    

    				<table class="schedule" style="width:100%;">
    					<thead class="head" >
    						<tr class="">
    							<th style="font-size: 9pt; border-bottom: 2px solid #1c43a6; width: 30px;">Edit</th>
    							<th style="font-size: 10pt; border-bottom: 2px solid #1c43a6; width: 85px;">Status</th>
    							<th style="font-size: 10pt; border-bottom: 2px solid #1c43a6; width: 110px;" colspan="2">Details</th>			
    							<th style="font-size: 10pt; border-bottom: 2px solid #1c43a6; width: 120px;" colspan="2">Date</th>			
    							<th style="font-size: 10pt; border-bottom: 2px solid #1c43a6; width: 100px;">Start Time</th>
    							<th style="font-size: 10pt; border-bottom: 2px solid #1c43a6; width: 345px;">Opponent</th>
    							<th style="font-size: 10pt; border-bottom: 2px solid #1c43a6; width: 60px;">Dismiss</th>
    							<th style="font-size: 10pt; border-bottom: 2px solid #1c43a6; width: 60px;">Depart</th>			
                                <th style="font-size: 10pt; border-bottom: 2px solid #1c43a6; width: 60px;">Return</th>         
    						</tr>
    					</thead>

    					<tbody>
    						<?php
    							$show_swap_legend = false;

    							// Get a list of displayable statuses
    							$statuses = array(
    								'PND'  => array('Pending', 'Contest is waiting to be approved.', 'images/icons/status_pnd_22px.png'),
    								'SCHD' => array('Scheduled', 'Contest is scheduled for the future.', 'images/icons/status_schd_2_22px.png'), 
    								'CXL'  => array('Canceled', 'Contest has been canceled.', 'images/icons/status_cxl_22px.png'),
    								'PPD'  => array('Postponed', 'Contest has been delayed and postponed to a later date/time.', 'images/icons/status_ppd_22px.png'),
    								'LIVE' => array('Live', 'Contest is live.', 'images/icons/status_live_22px.png'), 
    								'DONE' => array('Done', 'Contest is finished and done.', null), 
    							);

    							// Allow OSAA users to include deleted contests
    							if (Input::has('show-delete') and Auth::check() and Auth::user()->isOsaaUser())
    							{
    								$statuses['DEL'] = array('Deleted', 'Contest has been deleted from this schedule.', 'images/icons/status_del_22px.png');
    							}

    							// Get a list of contest types
    							$types = array(
    								'J'   => array('Jamboree'),
    								'EX'  => array('Exhibition'),
    								'A'   => array('Alumni'),
    								'NL'  => array('Non-League'),
    								'L'   => array('League'),
    								'LPO' => array('League Playoff'),
    								'PI'  => array('Play-In'),
    								'PO'  => array('Playoff'),
    								'PP'  => array('Pool Play')
    							);
    						?>

    						
    						<?php foreach ($information['schedule'] as $item): ?>

    							<?php
    								// Skip this contest if its status is not in the list of displayable statuses
    								if (!Helpers::strEqual($item['status'], array_keys($statuses)))
    								{
    									continue;
    								}
    							?>				

    							<tr style="height: 2em;" data-status="<?php echo $item['status']; ?>">
    								<td>
    									<a href="<?php echo url('contests/' . $item['contest']->id . '/edit?ap=' .  $information['activity_program']->id); ?>" class="edit_contest_button"></a>
    								</td>
    								<td>
    									<?php if (Helpers::strEqual($item['status'], 'DONE')): ?>

    							        	<?php
    								        	$results = 'Done';

    								        	if (!is_null($item['contest']->home_team_score) /*and $item['contest']->is_scoreable*/)
    						                    {
    						                        // Get my team's designation
    						                        $is_home_team = ($information['team']->id == $item['contest']->home_team);                        
    						                        
    						                        // I am the home team
    						                        if ($is_home_team)
    						                        {   
    						                            // Home team wins!
    						                            if ($item['contest']->home_team_score > $item['contest']->away_team_score)
    						                            {
    						                                $win = 'W';      
    						                                $mine = $item['contest']->home_team_score;
    						                                $opp = $item['contest']->away_team_score;
    						                            }                     
    						                            // Home team lost :(
    						                            else if ($item['contest']->home_team_score < $item['contest']->away_team_score)
    						                            {                                
    						                                $win = 'L';   
    						                                $opp = $item['contest']->away_team_score;
    						                                $mine = $item['contest']->home_team_score;                               
    						                            }
    						                            // Otherwise, it's a tie
    						                            else
    						                            {                               
    						                                $win = 'T';
    						                                $mine = $item['contest']->home_team_score;
    						                                $opp = $item['contest']->away_team_score;
    						                            }
    						                        }
    						                        // I am the away team
    						                        else
    						                        {
    						                            // Home team wins :(
    						                            if ($item['contest']->home_team_score > $item['contest']->away_team_score)
    						                            {
    						                                $win = 'L';      
    						                                $opp = $item['contest']->home_team_score;
    						                                $mine = $item['contest']->away_team_score;
    						                            }                     
    						                            // Home team lost!
    						                            else if ($item['contest']->home_team_score < $item['contest']->away_team_score)
    						                            {                                
    						                                $win = 'W';   
    						                                $mine = $item['contest']->away_team_score;
    						                                $opp = $item['contest']->home_team_score;                               
    						                            }
    						                            // Otherwise, it's a tie
    						                            else
    						                            {                               
    						                                $win = 'T';
    						                                $opp = $item['contest']->home_team_score;
    						                                $mine = $item['contest']->away_team_score;
    						                            }
    						                        }                        
    						                           
    						                        if (is_null($item['contest']->is_forfeit))
    						                        {
    						                        	$results = '<b>' . $win . '</b> ' . $mine . '-' . $opp;
    						                        }
    						                        elseif (Helpers::isExcludableForfeit($item['contest']->is_forfeit))
    						                        {
    													$results = '<b>' . $win . '</b> <small>Forfeit</small>';
    						                        }
                                                    else
                                                    {
                                                        $results = '<b>' . $win . '</b> <small>' . $mine . '-' . $opp . ' Forfeit</small>';
                                                    }

    						                        if ($item['contest']->is_swap_designation)
    						                        {
    						                        	$results = '*' . $results;
    						                        	$show_swap_legend = true;
    						                        }
    						                    }
    						                ?>

    						                <?php echo $results; ?>

    									<?php else: ?>

    										<?php if (!is_null($statuses[$item['status']][2])): ?>
    											<img src="<?php echo asset($statuses[$item['status']][2]); ?>" alt="" title="<?php echo $statuses[$item['status']][1]; ?>" class="tooltip" style="vertical-align: middle; width: 18px; height: 18px;" />
    										<?php endif; ?>

    										<?php if ($item['status'] == 'LIVE' and $information['team']->level == 'V' and $item['contest']->is_scoreable): ?>
    									        <a href="<?php echo url('/contests/' . $item['contest']->id . '/submit-scores'); ?>" class="tooltip" style="font-weight: bold;" title="Submit scores for this contest.">
    									    <?php endif; ?>							

    										<div class="status_name" style="font-size: 8pt; display: inline-block;"><?php echo $statuses[$item['status']][0]; ?></div>

    										<?php if ($item['status'] == 'LIVE' and $information['team']->level == 'V' and $item['contest']->is_scoreable): ?>
    											</a>
    										<?php endif; ?>

    									<?php endif; ?>
    								</td>
    								<td>
    									<?php
    										$link_title = 'Click to view details about this contest.';

    										if (Auth::check() and Auth::user()->isOsaaUser())
    										{
    											$link_title .= ' Contest ID = ' . $item['contest']->id;
    										}
    									?>

    									<img src="<?php echo asset('/images/icons/information_24px.png'); ?>" alt="" title="<?php echo $link_title; ?>" class="tooltip contest_details" data-contest="<?php echo $item['contest']->id; ?>" style="vertical-align: middle; width: 18px; height: 18px; float: left; margin: 7px 4px 7px 0;" />
    								</td>
    								<td style="font-size: 8pt; line-height: 1.15em;">
    									<?php echo $types[$item['contest']->contest_type][0]; ?>
    									<?php
                                            // Get playoff round slugs
                                            if (Helpers::strEqual($item['contest']->contest_type, 'PO'))
                                            {
                                                $matchup = matchup::where('contest', '=', $item['contest']->id)->firstOrFail();
                                                $round = round::find($matchup->round);
                                                $round_type = roundtype::where('slug', '=', $round->round_type)->firstOrFail();

                                                echo ' <span class="tooltip" title="' . $round_type->name . ' Round of OSAA Playoffs">(' . $round->round_type . ')</span>';
                                            }
                                        ?>
                                        <?php if ($item['contest']->is_tournament): ?>
    										<br /><span style="color: #0012ff;">Tournament</span>
    									<?php endif; ?>
    									<?php if ($item['contest']->is_endowment): ?>
    										<br /><span style="color: #ad8309;">Endowment</span>
    									<?php endif; ?>
    									<?php if ($item['contest']->is_neutral_location): ?>
    										<br /><span style="color: #37a913;">Neutral Site</span>
    									<?php endif; ?>						
    								</td>
    								<td style="padding: 0 4px 0 4px; font-size: 11pt;">
    									<?php
    										$day = null;

    										switch(date('N', strtotime($item['event']->start_at)))
    										{
    											case 1: $day = 'M'; break;
    											case 2: $day = 'T'; break;
    											case 3: $day = 'W'; break;
    											case 4: $day = 'R'; break;
    											case 5: $day = 'F'; break;
    											case 6: $day = 'S'; break;
    											case 7: $day = 'Su'; break;
    										}
    									?>

    									<?php /*  $item['day']  */ ?>
    									<?php echo $day; ?>
    								</td>
    								<td style="font-size: 11pt;">
    									<a href="<?php echo url('/activities/' . strtolower($item['contest']->activity) . '/schedules?date=' . date('Y-m-d', strtotime($item['date'])) . '&amp;div=' . $item['contest']->division); ?>"><?php echo date('n/j/y', strtotime($item['date'])); ?></a>
    								</td>					
    								<td style="font-size: 11pt;">
    									<?php echo $item['time']; ?>
    								</td>
    								<td style="font-size: 11pt;">
    									<?php echo $item['opponent']; ?>
    								</td>
    								<td style="font-size: 10pt;">
    									<?php if (is_null($item['contest']->{ $item['designation'] . '_dismiss_time' })): ?>
    										
    									<?php else: ?>
    										<?php if (Helpers::strEqual(date('g:i a', strtotime($item['contest']->{ $item['designation'] . '_dismiss_time' })), '12:00 AM')): ?>
    											TBD
    										<?php else: ?>
    											<?php echo Helpers::formatDateTime('%TEAM_SCHEDULE_TIME%', strtotime($item['contest']->{ $item['designation'] . '_dismiss_time' }), $item['event']->time_zone); ?>
    			                			<?php endif; ?>
    									<?php endif; ?>
    								</td>
    								<td style="font-size: 10pt;">
    									<?php if (is_null($item['contest']->{ $item['designation'] . '_depart_time' })): ?>
    										
    									<?php else: ?>
    										<?php if (Helpers::strEqual(date('g:i a', strtotime($item['contest']->{ $item['designation'] . '_depart_time' })), '12:00 AM')): ?>
    											TBD
    										<?php else: ?>
    											<?php echo Helpers::formatDateTime('%TEAM_SCHEDULE_TIME%', strtotime($item['contest']->{ $item['designation'] . '_depart_time' }), $item['event']->time_zone); ?>
    			                			<?php endif; ?>
    									<?php endif; ?>
    								</td>
                                    <td style="font-size: 10pt;">
                                        <?php if (is_null($item['contest']->{ $item['designation'] . '_return_time' })): ?>
                                            
                                        <?php else: ?>
                                            <?php if (Helpers::strEqual(date('g:i a', strtotime($item['contest']->{ $item['designation'] . '_return_time' })), '12:00 AM')): ?>
                                                TBD
                                            <?php else: ?>
                                                <?php echo Helpers::formatDateTime('%TEAM_SCHEDULE_TIME%', strtotime($item['contest']->{ $item['designation'] . '_return_time' }), $item['event']->time_zone); ?>
                                            <?php endif; ?>
                                        <?php endif; ?>
                                    </td>
    							</tr>

                                <?php if (!Helpers::strIsEmpty($item['event']->notes)): ?>
                                    <tr class="event_notes">
                                        <td colspan="11"><?php echo $item['event']->notes; ?></td>
                                    </tr>
                                <?php endif; ?>

    						<?php endforeach; ?>
    						

    						<?php if (count($information['schedule']) == 0): ?>
    							<tr>
    								<td colspan="10">No contests have been added to this schedule, yet.</td>
    							</tr>
    						<?php endif; ?>

    					</tbody>

    				</table>				

                </div>

			<?php else: ?>
				
                <h4>Add a <?php echo ucfirst($contest_or_meet); ?></h4>
                
				<?php echo $__env->make ('teams.meet_scheduler', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
				
				<br />

				<?php $allow_edit = true; ?>
				<?php echo $__env->make ('teams.meet_schedule', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>

			<?php endif; ?>

		</div>
		<?php endif; ?>

		<div id="tabs-2">
			
			<a href="<?php echo url('/teams/' . $information['team']->id . '/roster/3'); ?>" class="button print tooltip float_right" style="font-size:9pt; margin-bottom: 0.75em;" title="Print a roster will all team levels combined as a PDF." target="_blank">Multi-Team Roster</a>

			<a href="<?php echo url('/teams/' . $information['team']->id . '/roster/2'); ?>" class="button print tooltip float_right" style="font-size:9pt; margin-bottom: 0.75em; margin-right: 5px;" title="Print this team roster and team photo as a PDF." target="_blank">Program Photo</a>

			<a href="<?php echo url('/teams/' . $information['team']->id . '/roster'); ?>" class="button print tooltip float_right" style="font-size:9pt; margin-bottom: 0.75em; margin-right: 5px;" title="Print this team roster as a PDF." target="_blank">Media Roster</a>

			<h2>Roster</h2>	
			
			<?php echo Form::open(array('url' => url('/teams/edit-roster'), 'class' => 'editRoster', 'id' => 'editRoster')); ?>
				
				<?php echo Form::hidden('team_id', $information['team']->id); ?>
				<?php echo Form::hidden('return_url', url('/teams/' . $information['team']->id . '/edit#tabs-2')); ?>

				<?php if (Session::has('errors')): ?>                
			        <div class="error ui-state-error"><span class="ui-icon ui-icon-alert box_icon"></span><?php foreach ($errors->all() as $error): ?><?php echo $error; ?> <?php endforeach; ?></div>
			    <?php endif; ?>

				<h4><?php echo Helpers::getLevelName ($information['team']->level); ?> Roster</h4>

				<table class="roster">
					<thead class="head ui-widget-header">
						<tr>
							<td class="tooltip" title="Home Jersey Number">H #</td>
							<td class="tooltip" title="Away/Visiting Jersey Number">A #</td>
							<td class="tooltip" title="Is this player a team captain?">C</td>
							<td class="tooltip" title="Player Name">Name</td>
							<td class="tooltip" title="Position">Position</td>
							<td class="tooltip" title="Alternate Position">Alt Position</td>
							<td class="tooltip" title="Grade">Grade</td>
							<td class="tooltip" title="Height (formatted as ft-in, i.e. '6-0')">Height</td>
							<?php if (Helpers::strEqual ($information['activity_program']->activity, array('FBL', 'WRE'))): ?>
								<td class="tooltip" title="Weight (just numbers, i.e. '150')">Weight</td>						
							<?php endif; ?>
							<td></td>
						</tr>
					</thead>

					<tbody>
						<tr class="small gray note">
							<td>1</td>
							<td>21</td>
							<td></td>
							<td>John Doe</td>
							<td>Position 1</td>
							<td>Position 2</td>
							<td>11</td>
							<td>6-0</td>
							<?php if (Helpers::strEqual ($information['activity_program']->activity, array('FBL', 'WRE'))): ?>
								<td>155</td>
							<?php endif; ?>
							<td></td>
						</tr>
						<tr id="new_player_row" class="sample" style="display:none;">
							<?php echo Form::hidden('player_id_X', 'X'); ?>		    				
							<td><?php echo Form::text('home_number_X',
											  '',
											  array('maxlength' => '3',
											  	    'style' => 'width:50px;')); ?></td>
							<td><?php echo Form::text('away_number_X',
											  '',
											  array('maxlength' => '3',
											  	    'style' => 'width:50px;')); ?></td>
							<td><?php echo Form::checkbox ('is_captain_X',
													'1',
													false,
													array('style' => 'text-align:center; width:25px;')); ?></td>
							<td><?php echo Form::text('name_X',
											  '',
											  array('style' => 'width:250px;')); ?></td>
							<td><?php echo Form::select('position_X',
												$information['position_select']); ?></td>
							<td><?php echo Form::select('position_2_X',
												$information['position_select']); ?></td>
							<td><?php echo Form::select('grade_X',
												$information['grade_select']); ?></td>					
							<td><?php echo Form::text('height_X',
												'',
												array('style' => 'width:50px;', 'data-format' => 'height')); ?></td>
							<?php if (Helpers::strEqual ($information['activity_program']->activity, array('FBL', 'WRE'))): ?>
								<td><?php echo Form::text('weight_X',
												  '',
												  array('style' => 'width:50px;')); ?></td>
							<?php endif; ?>
							<td><div class="button delete notext tooltip" style="width:20px; height:20px; position:relative; top:-1px;" title="Remove this player from the roster." data-player="X"></div></td>
						</tr>

						<?php if (count($information['roster']) > 0): ?>
							<?php foreach ($information['roster'] as $player): ?>
								<tr id="<?php echo 'player_' . $player->id; ?>">
									<?php echo Form::hidden('player_id_' . $player->id, $player->id); ?>
									<td><?php echo Form::text('home_number_' . $player->id,
													  $player->home_number,
													  array('maxlength' => '3',
													  	    'style' => 'width:50px;')); ?></td>
									<td><?php echo Form::text('away_number_' . $player->id,
													  $player->away_number,
													  array('maxlength' => '3',
													  	    'style' => 'width:50px;')); ?></td>
									<td><?php echo Form::checkbox ('is_captain_' . $player->id,
															'1',
															$player->is_captain,
															array('style' => 'text-align:center; width:25px;')); ?></td>
									<td><?php echo Form::text('name_' . $player->id,
													  $player->name,
													  array('style' => 'width:250px;')); ?></td>
									<td><?php echo Form::select('position_' . $player->id,
														$information['position_select'],
														$player->position); ?></td>
									<td><?php echo Form::select('position_2_' . $player->id,
														$information['position_select'],
														$player->position_2); ?></td>
									<td><?php echo Form::select('grade_' . $player->id,
														$information['grade_select'],
														$player->grade); ?></td>					
									<td><?php echo Form::text('height_' . $player->id,
														$player->height,
														array('style' => 'width:50px;', 'data-format' => 'height')); ?></td>
									<?php if (Helpers::strEqual ($information['activity_program']->activity, array('FBL', 'WRE'))): ?>
										<td><?php echo Form::text('weight_' . $player->id,
															$player->weight,
															array('style' => 'width:50px;')); ?></td>
									<?php endif; ?>
									<td><div class="button delete notext tooltip" style="width:20px; height:20px; position:relative; top:-1px;" title="Remove this player from the roster." data-player="<?php echo $player->id; ?>"></div></td>
								</tr>
							<?php endforeach; ?>
						<?php endif; ?>					

					</tbody>

				</table>

				<br />

				<div class="button add player tooltip" style="font-size:9pt;" title="Add a new player to the roster">Add Player</div>

				<br /><br />

				<?php echo Form::submit('Save', array('class' => 'button float_right tooltip', 'style' => 'position: relative; top: -0.5em;', 'title' => 'Save this form\'s information.')); ?>

				<p class="bold">
					To save your changes, click the "Save" button.
				</p>		

				
			<?php echo Form::close(); ?>
		</div>
		
		<div id="tabs-3">
			<h2>Team Photo</h2>		
			
			<?php $image = ImagesController::getImageURL($information['team']->id, 'PHOTO', 'ANY'); ?>

			<?php echo Form::open(array('url'    => url('/teams/add-photo'),
								'method' => 'post',
								'files'  => true,
								'id'	 => 'upload_image_form')); ?>
				<div class="columns">

					<div style="width:31%; float:left; padding:0 2.25% 0 0; position: relative; min-height: 515px;">
						<h3 style="color: #990000;">Upload a New Team Photo</h3>
				
						<?php echo Form::hidden('team', $information['team']->id); ?>
						<?php echo Form::hidden('type', 'PHOTO'); ?>
						<?php echo Form::hidden('return_url', url('/teams/' . $information['team']->id . '/edit#tabs-3')); ?>

						<?php echo Form::file('photo', array('name' => 'photo',
													 'id'   => 'photo')); ?>

						<br />
						<div class="small gray note">(Images must be less than 4 MB in size and with an extension of .jpg, .jpeg., .gif, or .png)</div>		
						<br /><br />

						<h3 style="color: #990000;">Thumbnail Preview</h3>

						<img id="preview" src="" alt="" title="" style="width: 75%; border: 1px solid #d9e1e0; max-width: 325px;" />			
						<br />
						<div class="small gray note">(Preview may not be available in IE or Safari)</div>		

						<br /><br />

						<div style="float: right; margin-right: 100px;">
							<img id="image_uploading" src="<?php echo asset('images/icons/ajax_loader.gif'); ?>" alt="" title=""  />
						</div>
						
						<?php echo Form::submit('Upload Photo', array('class'    => 'button',
															  'style'    => 'font-size: 10pt;',
															  'id'		 => 'upload_photo')); ?>		

						<br /><br />

						<?php if (Session::has('errors')): ?>                
			                <div class="ui-state-error" style="padding: 2px 4px;"><span class="ui-icon ui-icon-alert box_icon"></span><?php foreach ($errors->all() as $error): ?><?php echo $error; ?> <?php endforeach; ?></div>
			            <?php endif; ?>						 

			            <?php if (!is_null($image)): ?>						 	
							<div id="delete_photo_button" class="button trash" style="position: absolute; bottom: 0; font-size: 9pt;">Delete Team Photo</div>
						<?php endif; ?>

					</div>

					
					<div style="width: 64.5%; float: left; padding: 0 0 0 2%; border-left: 1px solid #990000; min-height: 515px;">												
						<?php if (!is_null($image)): ?>
							<img id="existing_team_photo" src="<?php echo $image . '?t=' . time(); ?>" alt="" title="" style="max-width: 630px;" />						
						<?php else: ?>
							<div style="width: 100%; height: 400px; text-align: center; border: 1px solid #d9e1e0;">
								<br/><br /><br /><br />
								<b>No Team Photo Found</b>
								<br /><br /><br />
								Use the photo upload form to the left<br />
								to upload a team photo.
							</div>
						<?php endif; ?>

					</div>

				</div>

			<?php echo Form::close(); ?>

			<br class="clear" />

		</div>

	</div>


	<div class="contest_viewer" style="display:none;">
	    <div class="ajax_loader" style="width:16px; height:11px; margin:0 auto; margin-top:6em; background-image: url('<?php echo asset('/images/icons/ajax_loader2.gif'); ?>'); background-repeat:no-repeat;"></div>
	</div>

	<div id="confirm_delete_dialog" title="Delete Team Photo?" data-team="<?php echo $information['team']->id; ?>">
		Are you sure you want to delete this team photo?<br /><br />
		<div class="ui-state-error" style="padding:5px;">
			<div class="ui-icon ui-icon-alert float_left margin-right:1em;"></div>
			Once you delete this photo, it will no longer exist on our server.
		</div>
	</div>	

	<div id="confirm_delete_dialog_meet" title="Delete Meet?" data-team="<?php echo $information['team']->id; ?>">
		Are you sure you want to delete this meet?<br /><br />
		<div class="ui-state-error" style="padding:5px;">
			<div class="ui-icon ui-icon-alert float_left margin-right:1em;"></div>
			If you delete this meet, it will be dropped from your schedule.  Any other teams participating in this meet will also have this meet removed from their schedules.
		</div>
	</div>

	<div id="confirm_drop_dialog_meet" title="Drom from Meet?" data-team="<?php echo $information['team']->id; ?>">
		Are you sure you want to drop from this meet?<br /><br />
		<div class="ui-state-error" style="padding:5px;">
			<div class="ui-icon ui-icon-alert float_left margin-right:1em;"></div>
			Dropping this meet will remove your team from the list of teams that are participating.
		</div>
	</div>	

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