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

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

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

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

    <style type="text/css">
    	table {border-collapse: collapse; width: 100%;}
    	th {text-align: left;}
    	tr {height: 2em;}    	
    	h3 { color: #990000 !important;}

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

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

    	/* Activity Icon */
    	.activity_icon {
    		float: left;
    		width: 64px;
    		height: 64px;
    		position: relative;
    		top: -1em;
    	}

    	/* Form Status */
    	.form_status {
    		font-size: 9pt;
    		float: right;
    		width: 250px;
    		height: 4em;
    		position: relative;
    		top: -1.5em;
    		text-align: right;
    		color: #999999;
    		line-height: 1.1em;
    	}

    	.form_status .state {
    		font-weight: bold;
    		color: #000000;
    	}

    	.form_status dl {
    		clear: both;
    		width: 100%;
    		padding-top: 5px;
    	}

    	.form_status dl dt {
    		width: 100px !important;
    		padding-right: 15px;
    	}

    	.form_status dl dd {
    		text-align: left;
    	}

    	/* Status Table */
        .odd {
            background-color: #dddddd;
        }

        .status_table {
            border-collapse: collapse;
            width: 100%;
            font-size: 10pt;
        }

        .status_table thead {
            background-color: #005FA9;
            color: #ffffff;
        }

        .status_table thead th {            
            padding: 4px 2px;
            text-align: left;
        }

        .status_table tbody tr {
            line-height: 3em;
            page-break-inside: avoid;
        }

        .status_table img {
        	vertical-align: middle;
        }

    	/* Coach Table */
        .odd {
            background-color: #dddddd;
        }

        .coach_table {
            border-collapse: collapse;
            width: 100%;
            font-size: 10pt;
        }

        .coach_table thead {
            background-color: #005FA9;
            color: #ffffff;
        }

        .coach_table thead th {            
            padding: 4px 2px;
            text-align: left;
        }

        .coach_table tbody tr {
            line-height: 3em;
        }

        /* Certification */
        .certification {
        	float: left;
        	font-size: 7pt;
        	line-height: 1em;
        	width: 50px;
        	text-align: center;
        }

        .certification .title {
        	font-weight: bold;
        }

        .certification .completed {
        	color: #7d7b7d;
        }

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

<?php $__env->startSection('jquery_init'); ?>
	$('.button').button();
	$('.button.notext').button({text:false});
	$('.button.close').button({ icons : { primary : 'ui-icon-circle-close'}});
	$('.button.switch').button({ icons : { primary : 'ui-icon-transferthick-e-w'}});
	$('.button.back').button({ icons : { primary : 'ui-icon-arrowthick-1-w'}});
	$('.button.delete').button({ icons : { primary : 'ui-icon-closethick'}});
	$('.button.add').button({ icons : { primary : 'ui-icon-plusthick'}});
	$('.button.edit').button({ icons : { primary : 'ui-icon-pencil'}});	
	
	$('.button_set').buttonset();
	$('.button_set label').addClass('ui-corner-all');
	
	$('.tooltip').tooltip();	 

	
	$('.date_picker').datepicker({'dateFormat' : 'mm/dd/yy',
								  'minDate' : '11/01/13',
								  'maxDate' : '1/24/14'});

	
	$('[required]').after('<span class="required_marker">*</span>');
	

	/* Limit input to numbers only */	
	$('.numbers_only').bind('input', function()
	{
  	    $(this).val($(this).val().replace(/[^0-9]/gi, ''));
	});	

	/* Limit input to letters only */	
	$('.alphas_only').bind('input', function()
	{
  	    $(this).val($(this).val().replace(/[^A-Za-z]/gi, ''));
	});
	
	// 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);
		})
	});

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

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


		});
	}
	colorRows();

	// Placeholder
	$('[placeholder]').focus(function()
    {
        var input = $(this);
        if (input.val() == input.attr('placeholder'))
        {
            input.val('');
            input.removeClass('placeholder');
        }
    }).blur(function()
    {
        var input = $(this);
        if (input.val() == '' || input.val() == input.attr('placeholder'))
        {
            input.addClass('placeholder');
            input.val(input.attr('placeholder'));
        }
    }).blur();

    $('[placeholder]').parents('form').submit(function()
    {
        $(this).find('[placeholder]').each(function()
        {
            var input = $(this);
            if (input.val() == input.attr('placeholder'))
            {
                input.val('');
            }
        });
    });

    // Shake action items
    function shakeActionImages (object)
    {
        var direction;
        if ($(object).has('[data-direction]'))
        {
            var direction = $(object).attr('data-direction');
        }
        
        if (typeof direction == 'undefined')        
        {
            var direction = 'left';
        }        

        $(object).effect("shake", {direction : direction, distance : 5, times : 1}, 600, function ()
        {
            $(this).delay(Math.floor(Math.random() * 4000) + 2000);
            shakeActionImages($(this));
        });        
    }

    $('img.action_item').each(function()
    {
        var img = $(this);
        shakeActionImages(img);
    });
	

	<?php if (Auth::check() and Auth::user()->isOsaaUser()): ?>
		// Download drop-down menu
	    $('#grabber_list')
	        .menu()
	        .css({'display' : 'none',
	              'z-index' : '200',
	              'position' : 'absolute',
	              'right' : '0',
	              'top' : '23px',
	              'margin' : '0',
	              'padding' : '0',
	              'width' : '150px'});   

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

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

	    $('.grabber_button')
	        .button({ icons : { secondary : 'ui-icon-triangle-1-s'}})
	        .css({'float':'right',
	              'font-size':'8pt'})
	        .click(function (event)
	        {
	            if ($('#grabber_list').is(':visible'))
	            {
	                $('#grabber_list').slideUp(400);
	                $(this).button({icons : { secondary : 'ui-icon-triangle-1-s'}});
	            }
	            else
	            {
	                $('#grabber_list').slideDown(400);
	                $(this).button({icons : { secondary : 'ui-icon-triangle-1-n'}});
	            }   
	        });
	<?php endif; ?>


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

		/* saveFormData
		 *
		 * Given a form field and a value, this function will do a
		 * JSON POST request to save the form's information.  The optional
		 * third parameter will determine if the page will be reloaded or not.
		 */
		function saveFormData(field, value, type, reload)
		{
			// Ensure the field and value parameters are provided
			if (typeof field == 'undefined' || typeof value == 'undefined' || typeof type == 'undefined')
			{
				alert('Scripting error.  Unable to save form data.');
			}

			// Get the optional reload parameter
			reload = typeof reload !== 'undefined' ? reload : false;

			// Get the form ID (same across all pages for this form)
			var form_id = <?php echo $information['submission']->id; ?>;

			$('*').css({'cursor':'wait'});

			var jqxhr = $.ajax(
			{
				type : 'POST',
				url : '<?php echo url('/forms/activity-program-forms'); ?>/' + form_id + '/update',
				data : { 'field' : field,
						 'value' : value,
						 'type'  : type },
				dataType : 'html'
			})
			.done(function(returned_data)
			{                               
				// Success
				console.log("Successfully saved {'" + form_id + "|" + field + "' : '" + value + "'}");
				
				var info = $.parseJSON(returned_data);

				$('#updated_at').html(info.updated_at);
				$('#updated_by').html(info.updated_by);

				if (info.force_reload)
				{
					reload = true;
				}

			})
			.fail(function(jqXHR, status, error)
			{                                                   
				// Error
				var response = jqXHR.responseText;
				var errorData = $.parseJSON(response);
				console.log(errorData);
				alert("There was an error saving this form's data.\n\n" + errorData.error.message + "\n\nPlease try again.  Please note, that if you try to reload this page, your unsaved data to be lost.");
			})
			.complete(function ()
			{
				// Reload if necessary
				if (reload)
				{
					location.reload();
				}

				$('*').css({'cursor':''});
			});
		}	

		/* updateRosterSize
		 *
		 * Update the size of the number of spaces for the roster participants.
		 */
		function updateRosterSize()
		{
			var max = $('input[name="sub_division"]:checked').attr('data-max-roster');
			
			if (max < 20)
			{
				for (var i = max; i < 20; i++)
				{
					//$('#roster tbody tr:nth-child(' + i + ')').hide();
					$('input[name="participant[' + i + '][name]"]').parents('tr').hide();
				}
			}
			else
			{
				$('#roster tbody tr').show();
			}

			return;
		}

		updateRosterSize();

		// Sub-Division option
		$('input[name="sub_division"]').click(function ()
		{		
			updateRosterSize();

			var item = $('input[name="sub_division"]:checked');
			var value = item.val();

			saveFormData('sub_division', value, 'string', false);
		});	
		
		// Reserve seating option
		$('input[name="reserve_seating"]').change(function()
		{
			var item = $(this);
			var value = item.is(':checked');

			saveFormData('reserve_seating', value, 'bool', false);
		});

		// Sanctioned competitions option
		$('select[name^="competition"]').change(function(event)
		{
			var item = $(this);
			var id = item.attr('data-id');
			var selected = $(':selected', item);
			var value = selected.val();

			// Ensure the selections are different if not empty
			if (id == '0')
			{
				var other = $('select[name^="competition"][data-id="1"]');
			}		
			else
			{
				var other = $('select[name^="competition"][data-id="0"]');
			}

			var other_value = $(':selected', other).val();
			
			if (other_value == value && value != '')
			{
				alert('The sanctioned competition options must be different.');				
				item.val($.data(item, 'current'));
				return false;
			}

			saveFormData('competitions[' + id + ']', value, 'int', false);
		});

		// Alternates
		$('[name^="alternate"]').blur(function(event)
		{
			var item = $(this);
			var id = item.attr('data-id');
			var part = item.attr('data-part');

			if (part == 'grade')
			{
				var selected = $(':selected', item);
				var grade = selected.val();				

				var name_field = $('[name^="alternate"][data-part="name"][data-id="' + id + '"');
				var name = name_field.val();
			}
			else
			{
				var name = item.val();
				
				var grade_field = $('[name^="alternate"][data-part="grade"][data-id="' + id + '"');
				var selected = $(':selected', grade_field);
				var grade = selected.val();			
			}

			if (grade == '' || grade == ' ')
			{
				grade = null;
			}
			if (name == '')
			{
				name = '';
			}

			var data = '{"name":"' + name + '","grade":' + grade + '}';

			saveFormData('alternates[' + id + ']', data, 'object', false);
		});
		
		// Do not allow special characters in alternates' names
		$('input[name^="alternate"][data-part="name"]').bind('input', function()
		{
	  	    $(this).val($(this).val().replace(/[^A-Za-z \-'\.]/gi, ''));
		});

		// Choreographers
		$('input[name^="choreographer"]')
			.blur(function(event)
			{
				var item = $(this);
				var id = item.attr('data-id');
				var value = item.val();				

				saveFormData('choreographers[' + id + ']', value, 'string', false);
			})		
			.bind('input', function()
			{
		  	    $(this).val($(this).val().replace(/[^A-Za-z \-'\.]/gi, ''));
			});

		// Routine theme
		$('input[name="routine_theme"]').blur(function()
		{
			var item = $(this);				
			var value = item.val();				
			
			saveFormData('routine_theme', value, 'string', false);
		});

		// Participants
		$('[name^="participant"]')
			.blur(function(event)
			{
				var item = $(this);
				var field_name = item.attr('name');

				var matches = field_name.match(/participant\[([0-9]+)\]\[(.*)\]/);

				var id = matches[1];
				var part = matches[2];				

				if (part == 'name')
				{
					var name_item = item;
				}
				else
				{
					var name_item = $('input[name="participant[' + id + '][name]"]');
				}
				
				if (part == 'grade')
				{
					var grade_item = item;
				}
				else
				{
					var grade_item = $('select[name="participant[' + id + '][grade]"]');
				}

				if (part == 'is_captain')
				{
					var captain_item = item;
				}
				else
				{
					var captain_item = $('input[name="participant[' + id + '][is_captain]"]');
				}

				var name = name_item.val();
				var grade = $(':selected', grade_item).val();
				var is_captain = captain_item.is(':checked');

				if (grade == '' || grade == ' ')
				{
					grade = 'null';
				}
				if (name == '')
				{
					name = 'null';
				}
				else
				{
					name = '"' + name + '"';
				}
				if (is_captain)
				{
					is_captain = 'true';
				}
				else
				{
					is_captain = 'false';
				}

				var data = '{"name":' + name + ',"grade":' + grade + ',"is_captain":' + is_captain + '}';
				console.log(data);

				saveFormData('participants[' + id + ']', data, 'object', false);
			});
		
		// Do not allow special characters in participant names
		$('input[name^="participant"]').bind('input', function()
			{
		  	    $(this).val($(this).val().replace(/[^A-Za-z \-'\.]/gi, ''));
			});

		// Delete team photo button
		$('.delete_photo')
			.button({'icons':{'primary':'ui-icon-trash'}})
			.css({'font-size':'8pt'})
			.click(function ()
			{
				$('<div></div>')
	                .appendTo('body')
	                .dialog({                       
	                    modal : true,
	                    draggable : false,
	                    resizable : false,
	                    height : 275,	                    
	                    width : 400,	                    
	                    title : 'Confirm Team Photo Removal',
	                    buttons: [
	                    {
					        text : "Yes",
                            'class' : "float_left",
                            icons : { primary : 'ui-icon-check'},
                            click : function()
                            {					          
								
								var team = <?php echo $information['team']->id; ?>;

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

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

	                            dialog_object.html('<br />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>');

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

	                            $(dialog_object).remove();
	                        }                
	                });
	        }); 

	    <?php if (is_null($information['team_photo'])): ?>
	    	$('.delete_photo').button('disable');
	    <?php endif; ?>

	    // Upload team photo button
		$('.upload_photo')
			.button({'icons':{'primary':'ui-icon-plusthick'}})
			.css({'font-size':'8pt',
				  'margin-right':'50px'})
			.click(function ()
			{
				$('<div></div>')
	                .appendTo('body')
	                .dialog({                       
	                    modal : true,
	                    draggable : false,
	                    resizable : false,
	                    height : 500,	                    
	                    width : 335,	                    
	                    title : 'Upload Team Photo',
	                    buttons: [
	                    {
					        text : "Upload",
                            'class' : "float_left",
                            icons : { primary : 'ui-icon-disk'},
                            click : function()
                            {					          
								var dialog_object = $(this);
								
								var form = $('form', dialog_object);

								$('<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-dialog-buttons')
                                               .html('<br />Working...<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 upload and process.</div>');

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

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

	                            var jqxhr = $.ajax(
	                                      {
	                                          type : 'GET',
	                                          url : '<?php echo url('teams/' . $information['team']->id . '/upload-photo-form'); ?>?return_url=forms/registration/che?activity_program=<?php echo $information['activity_program']->id; ?>',
	                                          dataType : 'html'
	                                      })
	                                      .done(function (returned_data)
	                                      {                               
	                                          dialog_object.html(returned_data);
	                                      })
	                                      .fail(function (jqXHR, status, error)
	                                      {                                                   
	                                          var response = jqXHR.responseText;
	                                          var errorData = $.parseJSON(response);
	                                          console.log(errorData);
	                                          alert ("There was an error accessing the team photo upload form.\n\nThis page will be reloaded.");
	                                          location.reload();
	                                      })
	                                      .complete(function ()
	                                      {
	                                          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')                                                  
                                                  .css({'font-size':'9pt',
                                              			'margin-top':'0.5em'})
                                                  .change(function()
		                                              {
		                                                  readURL(this);
		                                              });
	                                      });     

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

	                            $(dialog_object).remove();
	                        }                
	                });
	        });
      

		// Training Course Information
		$('.cert_info')
			.css({'vertical-align' : 'middle',
				  'position' : 'absolute',
				  'left' : '100px'})
			.hover(function ()
			{
				$(this).css({'cursor' : 'pointer'});
			},
			function ()
			{
				$(this).css({'cursor' : ''});
			})
			.click(function(event)
	        {
	            event.preventDefault();

	            $('<div></div>')
	                .appendTo('body')
	                .dialog(
	                {                       
	                    draggable : true,
	                    resizable : false,
	                    height : 600,	                    
	                    width : 700,	                    
	                    modal : false,
	                    title : 'Training Course Information',
	                    open : function ()
	                        {  
	                            var dialog_object = $(this);

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

	                            var jqxhr = $.ajax(
	                                      {
	                                          type : 'GET',
	                                          url : '<?php echo url('help/training-courses?ajax=true'); ?>',
	                                          dataType : 'html'
	                                      })
	                                      .done(function (returned_data)
	                                      {                               
	                                          dialog_object.html(returned_data);
	                                      })
	                                      .fail(function (jqXHR, status, error)
	                                      {                                                   
	                                          var response = jqXHR.responseText;
	                                          var errorData = $.parseJSON(response);
	                                          console.log(errorData);
	                                          alert ("There was an error looking up help information.\n\nThis page will be reloaded.");
	                                          location.reload();
	                                      })
	                                      .complete(function ()
	                                      {
	                                           
	                                      });                            
	                            
	                        },
	                    close : function ()
	                        {
	                            var dialog_object = $(this);

	                            $(dialog_object).remove();
	                        }                
	                });


	        });

	<?php endif; ?>
	

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

   		$('.edit_form_button')
   			.button({'icons' : {'primary' : 'ui-icon-pencil'},
   		             'text' : false})
   			.css({'font-size' : '8pt',
   			      'position' : 'absolute',
   			      'right' : '36px',
   			      'top' : '12px',
   			      'width' : '16px',
   			      'height' : '16px'})
   			.click(function ()
   			{
   				var ap_id = $(this).attr('data-ap-id');   				

   				window.location.href = '<?php echo url('/forms/registration/che'); ?>?activity_program=' + ap_id;
   			});

   		$('.drop_form_button')
   			.button({'icons' : {'primary' : 'ui-icon-trash'},
   		             'text' : false})
   			.css({'font-size' : '8pt',
   			      'position' : 'absolute',
   			      'right' : '10px',
   			      'top' : '12px',
   			      'width' : '16px',
   			      'height' : '16px'})
   			.click(function ()
   			{
				var ap_id = $(this).attr('data-ap-id'); 
				var ap_name = $(this).attr('data-ap-name'); 

   				$('<div></div>')
	                .appendTo('body')
	                .dialog({                       
	                    modal : true,
	                    draggable : false,
	                    resizable : false,
	                    height : 275,	                    
	                    width : 400,	                    
	                    title : 'Confirm Team Drop',
	                    buttons: [
	                    {
							text : "Cancel",                            
	                        'class' : "float_right",                            
	                        icons : { primary : 'ui-icon-cancel'},
	                        click : function()
	                        {
					        	$(this).dialog( "close" );					            
					        }
					    },
	                    {
					        text : "Drop Team",
                            'class' : "float_left",
                            icons : { primary : 'ui-icon-check'},
                            click : function()
                            {	
								$(this).dialog("close");

								$('<div></div>')
					                .appendTo('body')
					                .dialog({                       
					                    modal : true,
					                    draggable : false,
					                    resizable : false,
					                    height : 280,	                    
					                    width : 425,	                    
					                    title : 'Are You Sure?',
					                    buttons: [
					                    {
											text : "No",                            
					                        'class' : "float_right",                            
					                        icons : { primary : 'ui-icon-cancel'},
					                        click : function()
					                        {
									        	$(this).dialog( "close" );					            
									        }
									    },
					                    {
									        text : "Yes",
				                            'class' : "float_left",
				                            icons : { primary : 'ui-icon-check'},
				                            click : function()
				                            {	
												$.ajax({
													type : "POST",
													url  : '<?php echo url('/forms/drop-ap-team'); ?>',
													data : { 'activity_program' :  ap_id,											 
															 'activity_form' : <?php echo $information['activity_form']->id; ?>},
													success : function()
													{
														location.reload();
													}
												});

												$(this).dialog("close");																
									    	}
									    }],					                    
					                    open : function ()
					                        {  
					                            var dialog_object = $(this);

					                            dialog_object.html('<br />Are you really sure?<br /><br /><div class="ui-state-error" style="padding:5px;"><div class="ui-icon ui-icon-alert float_left margin-right:1em;"></div>Last chance.  Are you really, really sure you want to drop ' + ap_name + '.</div>');

					                            $('.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');                                     
                                      			$('.ui-widget-content').css('border-color', '#dddddd');
                                      			
                                      			$('.ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '10pt');
				  								$('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%');
					                        },
					                    show : { effect : "shake",
					                             duration : 200},
					                    close : function ()
					                        {
					                            var dialog_object = $(this);

					                            $(dialog_object).remove();
					                        }                
					                });								
					    	}
					    }],
	                    open : function ()
	                        {  
	                            var dialog_object = $(this);

	                            dialog_object.html('<br />Are you sure you want to drop ' + ap_name + ' from the schedule?<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 drop this team, it will no longer exist in the database.  This procedure cannot be undone.</div>');

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

	                            $(dialog_object).remove();
	                        }                
	                });

   				
   			});

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

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

	<?php if (!is_null($information['activity_program'])): ?>
		<a href="<?php echo url('/forms/registration/che'); ?>" class="button back tooltip" style="font-size:9pt; margin-right: 8px;" title="Discard any unsaved changes and go back to the team selection page.">Back</a>				
		
	<?php else: ?>
		<a href="<?php echo $information['return_url']; ?>" class="button close tooltip" style="font-size:9pt; margin-right: 8px;" title="Discard any unsaved changes and close this form.">Close</a>		
	<?php endif; ?>

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


<?php $__env->startSection('main_content'); ?>    
	
	<?php /*  Success Bar  */ ?>
 	<?php if (Session::has('success')): ?>
		<div class="success_bar">
			<div class="message">				
				<?php echo Session::get('success'); ?>
			</div>			
		</div>
	<?php endif; ?>


	<?php if ($information['is_past_due']): ?>
		<div class="online_form_late ui-state-error ui-corner-all">
			<span class="ui-icon ui-icon-alert" style="display:inline-block; position:relative; top:2px;"></span>
			This form was due by <?php echo date('g:i A l, F j, Y', strtotime($information['activity_form']->due_at)); ?> and is now past the deadline.  Please submit your entries now before the form closes and becomes unavailable.
		</div>
	<?php endif; ?>

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

		<br />

		<?php /*  Need to select an activity program  */ ?>

		<h1>Select School</h1>

		<br />

		<div class="online_form_instructions ui-corner-all">
			<span class="ui-icon ui-icon-info" style="display:inline-block; position:relative; top:2px;"></span>
			<b>Instructions</b> <br />
			<ol>
				<li>Begin by selecting your school from the drop-down list.</li>
				<li>Click <b>Next</b> to continue with the selection.</li>			
				<li><b>Note:</b> All entries must be submitted by <?php echo date('g:i A l, F j, Y', strtotime($information['activity_form']->due_at)); ?> using this online form.</li>
			</ol>

			<br />

			For questions, contact <?php echo $information['staff']->first_name; ?> <?php echo $information['staff']->last_name; ?> at (503) 682-6722 x233 or by e-mail to <?php echo Helpers::obfuscateEmailLink ($information['staff']->email); ?>.  For technical assistance, you can email <?php echo Helpers::obfuscateEmailLink ("support@osaa.org"); ?>.
		</div>		

		<br />

		<h2>Available Schools</h2>		
		
		<?php echo Form::open(array('url'    => url('/forms/registration/' . strtolower($information['activity']->slug)),
						    'method' => 'get',
						    'style'  => 'position: relative;')); ?>		
			
			<?php echo Form::select('activity_program', $information['aps_list'], null, array('style' => 'font-size: 12pt; min-width: 315px;')); ?>

			<?php echo Form::submit('Next', array('class' => 'button',
										  'style' => 'font-size: 9pt; margin-left: 30px;')); ?>			

			<img src="<?php echo asset('/images/icons/waiver_action_icon_48px.png'); ?>" class="action_item" alt="" title="" style="position: absolute; top: -12px; left: 425px;" data-direction="left" />			
			

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

		<br class="clear" /><br />
		<div class="horizontal_divider" style="width: 100%;"></div>
		<br />

    	<?php if (Auth::check() and Auth::user()->isOsaaUser()): ?>
			<div style="font-size: 8pt; float: right; position: relative;">
		        
		        <img src="<?php echo asset('/images/icons/shield_16px.png'); ?>" alt="" title="" style="float: left; margin: 2px 10px 0 0;" />
		        <div class="grabber_button">Print/Download</div>

	            <ul id="grabber_list">	                
	                <li>
	                	<a href="<?php echo url('/reports/che-entries/all'); ?>" target="_blank"><img src="<?php echo asset('/images/icons/csv_file_16px.png'); ?>" alt="" title="" />Entries</a>
	                </li>
	                <li>
	                	<a href="<?php echo url('/reports/che-entries/program'); ?>?split=1" target="_blank"><img src="<?php echo asset('/images/icons/pdf_file_16px.png'); ?>" alt="" title="" />Program (1/2)</a>
	                </li>
	                <li>
	                	<a href="<?php echo url('/reports/che-entries/program'); ?>?split=2" target="_blank"><img src="<?php echo asset('/images/icons/pdf_file_16px.png'); ?>" alt="" title="" />Program (2/2)</a>
	                </li>
	                <li>
	                	<a href="<?php echo url('/reports/che-entries/check-in'); ?>" target="_blank"><img src="<?php echo asset('/images/icons/print_16px.png'); ?>" alt="" title="" />Check-In Forms</a>
	                </li>
	                <li>
	                	<a href="<?php echo url('/reports/che-entries/labels'); ?>" target="_blank"><img src="<?php echo asset('/images/icons/print_16px.png'); ?>" alt="" title="" />Packet Labels</a>
	                </li>
	            </ul>  

		    </div>
	    <?php endif; ?>

    	<h2>Registration Status</h2>		
		
		<p>
			The following list shows the registration status for each school.  If a school is not listed, it has not started its registration process.
		</p>

		<table class="status_table">
			<thead>
				<tr>
					<th>School</th>
					<th>Status</th>
					<th>Head Coach</th>
					<?php if (Auth::check() and Auth::user()->isOsaaUser()): ?>						
						<th class="text_center"># Participants</th>
						<th class="text_center"># Alternates</th>
						<th class="text_center"># Coaches</th>
						<th class="text_center">Total # Passes</th>
					<?php endif; ?>
					<th class="text_center">Photo</th>
				</tr>
			</thead>

			<tbody>
				<?php foreach ($information['apfs'] as $apf): ?>
					
					<tr>
						<td style="position: relative;">
							<?php if (Auth::user()->isOsaaUser()): ?>
								
								<div class="edit_form_button" data-ap-id="<?php echo $apf->ap_id; ?>"></div>

								<div class="drop_form_button" data-ap-id="<?php echo $apf->ap_id; ?>" data-ap-name="<?php echo $apf->ap_name; ?>"></div>								
							
							<?php endif; ?>

							<?php echo $apf->ap_name; ?>
						</td>
						<td>
							<?php if ($apf->registered): ?>
								<img src="<?php echo asset('images/icons/finished_16px.png'); ?>" alt="" title="" />
								Complete
							<?php else: ?>
								<img src="<?php echo asset('images/icons/incomplete_16px.png'); ?>" alt="" title="" />
								In Progress
							<?php endif; ?>
						</td>
						<td>
							<?php if (!is_null($apf->head_coach)): ?>
								<?php if (Auth::check() and Auth::user()->isOsaaUser()): ?>
									<a href="mailto:<?php echo Helpers::obfuscateEmailAddress($apf->head_coach->school_staff->email); ?>"><?php echo $apf->head_coach->school_staff->getDisplayName(); ?></a>
								<?php else: ?>
									<?php echo $apf->head_coach->school_staff->getDisplayName(); ?>
								<?php endif; ?>
							<?php endif; ?>
						</td>
						<?php if (Auth::check() and Auth::user()->isOsaaUser()): ?>						
							<td class="text_center">
								<?php if($apf->registered): ?>
									<?php echo $apf->number_participants; ?>
								<?php else: ?>
									- -
								<?php endif; ?>
							</td>
							<td class="text_center">
								<?php if($apf->registered): ?>
									<?php echo $apf->number_alternates; ?>
								<?php else: ?>
									- -
								<?php endif; ?>
							</td>
							<td class="text_center">
								<?php if($apf->registered): ?>
									<?php echo $apf->number_coaches; ?>
								<?php else: ?>
									- -
								<?php endif; ?>
							</td>
							<td class="text_center">
								<?php if($apf->registered): ?>
									<?php echo $apf->total_passes; ?>
								<?php else: ?>
									- -
								<?php endif; ?>
							</td>
						<?php endif; ?>
						<td class="text_center">
							<?php if (!is_null($apf->team_photo)): ?>
								<img src="<?php echo asset('images/icons/check_16px.png'); ?>" alt="" title="A team photo has been uploaded." class="tooltip" />
							<?php else: ?>
								<img src="<?php echo asset('images/icons/missing_16px.png'); ?>" alt="" title="No team photo has been uploaded." class="tooltip" />
							<?php endif; ?>
						</td>
					</tr>

				<?php endforeach; ?>
				
			</tbody>

		</table>

		<br />

		

	<?php else: ?>
		
		<?php /*  An activity program is selected  */ ?>
		<br />

		<!-- Activity Logo -->
		<img src="<?php echo asset('images/icons/cheerleader_64px.jpg'); ?>" alt="" title="" class="activity_icon" />
		
		<!-- Timestamps/Submitter/Status Info -->		
		<div class="form_status">
			<div style="float: left;">
				Form #<?php echo $information['submission']->id; ?>
			</div>
			<div style="float: right;">
				<?php if ($information['submission']->data->complete): ?>
					<img src="<?php echo asset('images/icons/check_mark_16px.png'); ?>" alt="" title="" style="width: 16px; vertical-align: middle;" /><span class="state"> Complete</span>
				<?php else: ?>
					<img src="<?php echo asset('images/icons/incomplete_16px.png'); ?>" alt="" title="" style="width: 16px; vertical-align: middle;" /><span class="state"> Incomplete</span>
				<?php endif; ?>
			</div>
			<dl>
				<dt>Created</dt>
				<dd><?php echo date('g:i a m/d/Y', strtotime($information['submission']->created_at)); ?></dd>

				<?php if (!is_null($information['submission']->submitted_at)): ?>
					<dt>Submitted</dt>
					<dd><?php echo date('g:i a m/d/Y', strtotime($information['submission']->submitted_at)); ?></dd>
				<?php endif; ?>

				<dt>Modified</dt>
				<dd id="updated_at"><?php echo date('g:i a m/d/Y', strtotime($information['submission']->updated_at)); ?></dd>

				<dt>User</dt>
				<dd id="updated_by"><?php echo $information['submitter']->getDisplayFullName(); ?></dd>
			</dl>
		</div>

		<h1><?php echo $information['activity_program']->name; ?></h1>

		<br />

		<div class="online_form_instructions ui-corner-all">
			<span class="ui-icon ui-icon-info" style="display:inline-block; position:relative; top:2px;"></span>
			<b>Instructions</b> <br />
			<ol>
				<li>Required fields are noted with a red asterisk<span class="required_marker" style="margin-left: 0;">*</span>.</li>			
				<li>Changes are automatically saved.</li>
				<li>When finished, click <b>Submit</b> to turn in your form with the information provided.  A confirmation will be sent to your e-mail address.</li>
				<li>You can re-submit this form as many times as needed until the deadline.</li>
				<li><b>Note:</b> All entries must be submitted by <?php echo date('g:i A l, F j, Y', strtotime($information['activity_form']->due_at)); ?> using this online form.</li>
			</ol>

			<br />

			For questions, contact <?php echo $information['staff']->first_name; ?> <?php echo $information['staff']->last_name; ?> at (503) 682-6722 x233 or by e-mail to <?php echo Helpers::obfuscateEmailLink ($information['staff']->email); ?>.  For technical assistance, you can email <?php echo Helpers::obfuscateEmailLink ("support@osaa.org"); ?>.
		</div>		

		<br />			

		<?php if (Session::has('errors')): ?>                
            <div class="ui-state-error" style="padding: 2px 4px;">
				<span class="ui-icon ui-icon-alert" style="display:inline-block; position:relative; top:2px;"></span>
            	<?php foreach ($errors->all() as $error): ?><?php echo $error; ?> <?php endforeach; ?>
            </div>
            <br />
        <?php endif; ?>        
		
		<?php echo Form::open(array('url'    => url('/forms/submit'),
						    'method' => 'post',
						    'class'  => 'registration_form')); ?>

			<?php echo Form::hidden('form', 'REGISTRATION'); ?>			
			<?php echo Form::hidden('activity', $information['activity']->slug); ?>
			<?php echo Form::hidden('activity_program', $information['activity_program']->id); ?>			
			
			<!-- Sub-Division Select -->
			<h2>Sub-Division <span class="required_marker" style="margin-left: 0;">*</span></h2>	
			<p class="gray note">Please select one of the applicable sub-divisions your team will compete in.</p>
			
			<div class="columns button_set">

				<?php foreach ($information['sub_divisions'] as $number => $sd): ?>

					<div class="sixth">							
						<input type="radio"
			                   id="radio_<?php echo $number; ?>"
			                   name="sub_division"
			                   value="<?php echo $sd->title; ?>"
			                   data-max-roster="<?php echo $sd->max; ?>"
			                   <?php if (!is_null($information['submission']) and Helpers::strEqual($information['submission']->data->sub_division, $sd->title)): ?>
			                   	checked="checked"
			                   <?php endif; ?>
			                   />
			            <label for="radio_<?php echo $number; ?>" style="height: 4em;">
			            	<?php echo $sd->title; ?><br />
			            	<span style="font-weight: normal; font-size: smaller;"><?php echo $sd->size; ?></span>
			           	</label>
					</div>				

				<?php endforeach; ?>

			</div>
			
			<br class="clear" /><br />			
			<div class="horizontal_divider" style="width: 100%;"></div>
			<br />

			<h2>Coaches &amp; Certifications</h2>	
			<p class="gray note">
				The following information is provided by your school's Athletic Director or AD Secretary.  A Head Coach with an e-mail address and a phone number is required for this form to be submitted.  Only one (1) Head Coach will appear in the program with up to four (4) optional Assistant Coaches.  To add, modify, or remove information in this table, contact your AD or AD Secretary.  
			</p>

			<table class="coach_table">
				<thead>
					<tr>
						<th>Position</th>
						<th>Name</th>
						<th>E-Mail</th>
						<th>Phone</th>
						<th style="position: relative; width: 270px;">
							Certifications
							<img src="<?php echo asset('/images/icons/information_16px.png'); ?>" alt="" title="" class="cert_info" />
						</th>
					</tr>
				</thead>

				<tbody>
					<?php if (!is_null($information['ap_staff']->coach)): ?>
						<tr>
							<td>Head Coach</td>
							<td><?php echo $information['ap_staff']->coach->school_staff->getDisplayName(); ?></td>
							<td><?php echo $information['ap_staff']->coach->school_staff->email; ?></td>
							<td style="line-height: 1.1em;">
								<?php if (!is_null($information['ap_staff']->coach->school_staff->work_phone)): ?>
									W: <?php echo $information['ap_staff']->coach->school_staff->getDisplayPhone('WORK'); ?>							
									<?php if (!is_null($information['ap_staff']->coach->school_staff->mobile_phone)): ?>
										<br />
									<?php endif; ?>
								<?php endif; ?>
								<?php if (!is_null($information['ap_staff']->coach->school_staff->mobile_phone)): ?>
									M: <?php echo $information['ap_staff']->coach->school_staff->getDisplayPhone('MOBILE'); ?>
								<?php endif; ?>
							</td>
							<td>
								<?php foreach ($information['course_list'] as $course_slug): ?>

									<?php
										$record = $information['ap_staff']->coach->school_staff->getCertificationStatus($course_slug);
										switch($record->status)
										{
											case 1: 	$img = 'check';
														break;
											case 0: 	$img = 'almost';
														break;
											default:	$img = 'missing';
										}
									?>

									<div class="certification">
										<div class="title">
											<?php echo $record->training_course->short_name; ?>
										</div>
										<img src="<?php echo asset('/images/icons/' . $img . '_16px.png'); ?>" alt="" title="" />
										<?php if ($record->status >= 0): ?>
											<div class="completed">
												<?php echo date('n-Y', strtotime($record->completed_on)); ?>
											</div>
										<?php endif; ?>
									</div>

								<?php endforeach; ?>
							</td>
						</tr>
					<?php else: ?>
						<tr class="ui-state-error" style="border: none;">
							<td colspan="5" style="font-weight: bold;">
								You will not be able to submit this form until your Athletic Director or AD Secretary supplies the name, e-mail, and a phone number of the Head Coach.
							</td>
						</tr>
					<?php endif; ?>

					<?php if (count($information['ap_staff']->asst_coaches) > 0): ?>

						<?php foreach ($information['ap_staff']->asst_coaches as $i => $asst_coach): ?>

							<tr>
								<td>Assistant Coach</td>
								<td><?php echo $asst_coach->school_staff->getDisplayName(); ?></td>
								<td><?php echo $asst_coach->school_staff->email; ?></td>
								<td style="line-height: 1.1em;">
									<?php if (!is_null($asst_coach->school_staff->work_phone)): ?>
										W: <?php echo $asst_coach->school_staff->getDisplayPhone('WORK'); ?>							
										<?php if (!is_null($asst_coach->school_staff->mobile_phone)): ?>
											<br />
										<?php endif; ?>
									<?php endif; ?>
									<?php if (!is_null($asst_coach->school_staff->mobile_phone)): ?>
										M: <?php echo $asst_coach->school_staff->getDisplayPhone('MOBILE'); ?>
									<?php endif; ?>
								</td>
								<td>
									<?php foreach ($information['course_list'] as $course_slug): ?>

										<?php
											$record = $asst_coach->school_staff->getCertificationStatus($course_slug);
											switch($record->status)
											{
												case 1: 	$img = 'check';
															break;
												case 0: 	$img = 'almost';
															break;
												default:	$img = 'missing';
											}
										?>

										<div class="certification">
											<div class="title">
												<?php echo $record->training_course->short_name; ?>
											</div>
											<img src="<?php echo asset('/images/icons/' . $img . '_16px.png'); ?>" alt="" title="" />
											<?php if ($record->status >= 0): ?>
												<div class="completed">
													<?php echo date('n-Y', strtotime($record->completed_on)); ?>
												</div>
											<?php endif; ?>
										</div>

									<?php endforeach; ?>
								</td>
							</tr>
						<?php endforeach; ?>				
					<?php endif; ?>

				</tbody>

			</table>			

			<h3>Championship Seating</h3>
			<div style="float: right; width: 910px; font-weight: bold;">
				<?php echo Form::label('reserve_seating', 'Reserve seats for coaches in the center section behind the judges?'); ?>
			</div>
			<div style="float: left; width: 100px; margin-right: 10px; text-align: right;">
				<?php echo Form::checkbox('reserve_seating',
								  true,
								  (!is_null($information['submission']) and property_exists($information['submission']->data, 'reserve_seating') and $information['submission']->data->reserve_seating)); ?>
			</div>

			<br /><br />
			<div class="horizontal_divider" style="width: 100%;"></div>
			<br />


			<h2>Sanctioned Competition Requirement</h2>	
			<p class="gray note">In order to verify your team is qualified for state, please select the two competitions that your team competed in.</p>

			<div class="float_right" style="width: 50%;">
				<span class="ui-icon ui-icon-info" style="display:inline-block; position:relative; top:2px;"></span>
				Teams are required to have attended two OSAA sanctioned competitions prior to state.  This competition may be attended after the registration deadline of <?php echo date('l, F j, Y', strtotime($information['activity_form']->due_at)); ?>.<br /><br />
				If a competition is not included on these lists, then it is not an OSAA sanctioned competition and cannot be counted towards this qualification requirement.  Refer to the <a href="<?php echo url('/activities/che/information/calendar'); ?>" target="_blank">OSAA Cheerleading Sanctioned Calendar</a>.
			</div>			

			

			<b>1<sup>st</sup> Competition <span class="required_marker" style="margin-left: 0;">*</span></b><br />
			<dl>				
				<dt><?php echo Form::label('competition_1', 'Select:', array('style' => 'font-weight: normal;')); ?></dt>
				<dd><?php echo Form::select('competition_1',
									$information['competitions'],
									$information['submission']->data->competitions[0],
									array('data-id' => 0)); ?></dd>
			<dl>

			<br />

			<b>2<sup>nd</sup> Competition <span class="required_marker" style="margin-left: 0;">*</span></b><br />
			<dl>				
				<dt><?php echo Form::label('competition_2', 'Select:', array('style' => 'font-weight: normal;')); ?></dt>
				<dd><?php echo Form::select('competition_2',
								    $information['competitions'],
									$information['submission']->data->competitions[1],
									array('data-id' => 1)); ?></dd>	
			<dl>		

			<br class="clear" /><br />			
			<div class="horizontal_divider" style="width: 100%;"></div>
			<br />



			<h2>Program Information</h2>	
			<p class="gray note">This information will be included in the program.  Make any changes as necessary.</p>

			<div class="float_right" style="width: 50%;">
				<span class="ui-icon ui-icon-info" style="display:inline-block; position:relative; top:2px;"></span>
				Enter names in "First Last" format.  Name fields only allow you to type in letters or special characters (periods, hyphens, apostrophes, and spaces.)  The program will automatically sort your team roster when it's printed.

				<br /><br />

				<span class="ui-icon ui-icon-alert" style="display:inline-block; position:relative; top:2px;"></span>
				This roster is a unique roster for the championships.  Team rosters entered via your team page will not be reflected in this roster.

				<br /><br />

				<h3>Alternates</h3>
				<p class="gray note">You can optionally list up to two (2) alternates to be included on the roster.</p>

				<table id="alternates" style="width: 60%;">
					<thead>
						<tr>
							<th>Name</th>
							<th style="width: 65px;">Grade</th>							
						</tr>
					</thead>

					<tbody>									

						<tr>
							<td>
								<?php echo Form::text('alternate[0][name]',
											  (!is_null($information['submission'])) ? $information['submission']->data->alternates[0]->name : null,
											  array('style' => 'width: 95%;', 'data-id' => '0', 'data-part' => 'name')); ?>
							</td>
							<td>
								<?php echo Form::select('alternate[0][grade]',
												$information['grades_list'],
												(!is_null($information['submission'])) ? $information['submission']->data->alternates[0]->grade : null,
												array('data-id' => '0', 'data-part' => 'grade')); ?>
							</td>							
						</tr>	

						<tr>
							<td>
								<?php echo Form::text('alternate[1][name]',
											  (!is_null($information['submission'])) ? $information['submission']->data->alternates[1]->name : null,
											  array('style' => 'width: 95%;', 'data-id' => '1', 'data-part' => 'name')); ?>
							</td>
							<td>
								<?php echo Form::select('alternate[1][grade]',
												$information['grades_list'],
												(!is_null($information['submission'])) ? $information['submission']->data->alternates[1]->grade : null,
												array('data-id' => '1', 'data-part' => 'grade')); ?>
							</td>							
						</tr>	

					</tbody>

				</table>

				<br /><br />

				<h3>Choreographers</h3>
				<p class="gray note">You can optionally list up to two (2) choreographers to be included in the program.</p>

				<table id="choreographer" style="width: 60%;">
					<thead>
						<tr>
							<th>Name</th>							
						</tr>
					</thead>

					<tbody>									

						<tr>
							<td>
								<?php echo Form::text('choreographer[0]',
											  $information['submission']->data->choreographers[0],
											  array('style' => 'width: 95%;', 'data-id' => 0)); ?>
							</td>													
						</tr>	

						<tr>
							<td>
								<?php echo Form::text('choreographer[1]',
											  $information['submission']->data->choreographers[1],
											  array('style' => 'width: 95%;', 'data-id' => 1)); ?>
							</td>							
						</tr>	

					</tbody>

				</table>

				<br /><br />

				<h3>Routine Theme</h3>
				<p class="gray note">You can optionally include what the theme is for your routine to be included in the program.</p>

				<?php echo Form::label('routine_theme', 'Routine Theme', array('style' => 'font-weight: bold;')); ?><br />
				<?php echo Form::text('routine_theme',
							  (!is_null($information['submission'])) ? $information['submission']->data->routine_theme : null,
							  array('style' => 'width: 300px;')); ?>
				

			</div>			

			<h3>Team Roster</h3>

			<table id="roster" style="width: 45%;">
				<thead>
					<tr>
						<th>Name</th>
						<th style="width: 65px;">Grade</th>
						<th style="width: 80px;">Captain?</th>
					</tr>
				</thead>

				<tbody>			
					<?php
						$i = -1;
					?>		

					<?php if (count($information['submission']->data->participants) > 0): ?>

						<?php foreach ($information['submission']->data->participants as $i => $participant): ?>
							<tr data-id="<?php echo $i; ?>">
								<td>
									<?php echo Form::text('participant[' . $i . '][name]', $participant->name, array('style' => 'width: 95%;')); ?>
								</td>
								<td>
									<?php echo Form::select('participant[' . $i . '][grade]', $information['grades_list'], $participant->grade); ?>
								</td>
								<td style="text-align: center;">
									<?php echo Form::checkbox('participant[' . $i . '][is_captain]', 1, $participant->is_captain); ?>
								</td>
							</tr>	
							
						<?php endforeach; ?>


					<?php endif; ?>

					<?php for (++$i; $i < 20; $i++): ?>					
						<tr data-id="<?php echo $i; ?>">
							<td>
								<?php echo Form::text('participant[' . $i . '][name]', null, array('style' => 'width: 95%;')); ?>
							</td>
							<td>
								<?php echo Form::select('participant[' . $i . '][grade]', $information['grades_list'], null); ?>
							</td>
							<td style="text-align: center;">
								<?php echo Form::checkbox('participant[' . $i . '][is_captain]', 1, false); ?>
							</td>
						</tr>						
					<?php endfor; ?>
				</tbody>
				
			</table>
					
			<br class="clear" /><br />			
			<div class="horizontal_divider" style="width: 100%;"></div>
			<br />

			<h2>Team Photo</h2>
			

			<div class="float_right" style="width: 38%;">
				<span class="ui-icon ui-icon-info" style="display:inline-block; position:relative; top:2px;"></span>
				<?php if (!is_null($information['team_photo'])): ?>
					Your team's photo is displayed to the left.  If you want to change this photo, use the buttons below.  Uploading another tem photo will replace this photo.<br />
				<?php else: ?>
					There is no photo on file for this team.  Use the button below to upload a new team photo.  You do not have to include a team photo to submit this form.  You can always upload a team photo at any time from your team editor.
				<?php endif; ?>
				<br /><br />
				<h3>Team Photo Management</h3>
				Image file specifications:
				<ul style="font-size: 9pt;">
					<li>Max file size: less than 4 MB</li>
					<li>Image extensions: .jpg, .jpeg., .gif, or .png</li>
					<li>Preferred aspect radio: 1.29:1</li>
					<li>Maximum dimensions: 1255px wide by 970px high</li>
					<li>Minimum width: adjusted to 1150px</li>					
				</ul>

				<br /><br />			

				<div class="upload_photo">Upload Photo</div>

				<div class="delete_photo">Delete Photo</div>
								
			</div>
			
			<?php if (!is_null($information['team_photo'])): ?>
				<img src="<?php echo $information['team_photo']; ?>?t=<?php echo time(); ?>" alt="" title="" style="max-width: 600px;" />						
			<?php else: ?>
				<div style="width: 600px; height: 300px; text-align: center; border: 1px solid #d9e1e0;">
					<br/><br /><br />
					<b>No Team Photo Found</b>	
					<br /><br />
					<span style="font-size: 6.5pt;">So...here's a picture of a robot.</span>
					<br /><br />
					<div style="font-size: 6.5pt; width: 190px; margin: 0 auto; line-height: 1.5em;">						
						<img src="<?php echo asset('images/logos/r66y.jpg'); ?>" alt="" title="" style="float: left; margin-right: 10px;" />
						<br /><br /><br />
						<i>My name is Prometheus, model #R-66Y. You can call me Robo.</i>
					</div>
				</div>
			<?php endif; ?>

			<br class="clear" /><br />			
			<div class="horizontal_divider" style="width: 100%;"></div>
			<br /><br />

			<div style="float: right; width: 80%; position: relative;">
				Click <b>Submit</b> to turn in your form with the information provided.  A confirmation will be sent to your e-mail address.  You can re-submit this form as many times as needed until the deadline.

				<img src="<?php echo asset('/images/icons/waiver_action_icon_48px.png'); ?>" class="action_item" alt="" title="" style="position: absolute; top: -12px; left: -80px;" data-direction="left" />
			</div>

			<?php echo Form::submit('Submit', array('class' => 'button',
										    'style' => 'font-size: 11pt;')); ?>


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

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

	<?php endif; ?>

	<div id="submissions_report" style="display: none;"></div>

	<div id="entries_report" style="display: none;"></div>

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

