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

	<script src="http://jwpsrv.com/library/d3LbCBzkEeSiiSIACtqXBA.js"></script>

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

        .status_table img {
        	vertical-align: middle;
        }

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

        .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
	$('[data-placeholder]').focus(function()
    {
        var input = $(this);
        if (input.val() == input.attr('data-placeholder'))
        {
            input.val('');
            input.removeClass('placeholder');
        }
    }).blur(function()
    {
        var input = $(this);
        if (input.val() == '' || input.val() == input.attr('data-placeholder'))
        {
            input.addClass('placeholder');
            input.val(input.attr('data-placeholder'));
        }
    }).blur();

    $('[data-placeholder]').parents('form').submit(function()
    {
        $(this).find('[data-placeholder]').each(function()
        {
            var input = $(this);
            if (input.val() == input.attr('data-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 (!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':''});
			});
		}	

		
		// Sub-Division option
		$('input[name="sub_division"]').click(function ()
		{	
			var item = $('input[name="sub_division"]:checked');
			var value = item.val();

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

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

		// Estimated participants
		$('input[name="estimated_participants"]').blur(function (event)
		{
			var item = $(this);
			var value = item.val();

			saveFormData('estimated_participants', value, 'integer', false);
		});

		// Final number of participants
		$('input[name="final_number_participants"]').blur(function (event)
		{
			var item = $(this);
			var value = item.val();

			saveFormData('final_number_participants', value, 'integer', false);
		});

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

			saveFormData('competition', value, 'int', false);
		});

		// Reserve room option
		$('input[name="reserve_room"]').change(function()
		{
			var item = $(this);
			var value = item.is(':checked');

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

		// Share room with option
		$('input[name="share_room_with"]').blur(function ()
		{	
			var item = $(this);
			var value = item.val();

			saveFormData('share_room_with', value, 'string', false);
		});

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

			if (value == item.attr('data-placeholder'))
			{
				value = '';
			}
			
			saveFormData('music[' + id + ']', value, 'string', false);
		});

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

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

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

				saveFormData('managers[' + id + ']', value, 'string', false);
			})		
			.on('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);
			})		
			.on('input', function()
			{
		  	    $(this).val($(this).val().replace(/[^A-Za-z \-'\.]/gi, ''));
			});

		// Team Intro / Cue Sheet
		$('textarea[name="team_intro"]').blur(function()
		{
			var item = $(this);				
			var value = item.val();				
			
			saveFormData('team_intro', 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; ?>

	    // Delete music file button
		$('.delete_music_file')
			.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 Music File 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-music-file'); ?>',
									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\'s music file?<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 music file, 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['music_file_found'])): ?>
	    	$('.delete_music_file').button('disable');
	    <?php endif; ?>

	    // Upload team photo button
		$('.upload_photo')
			.button({'icons':{'primary':'ui-icon-plusthick'}})
			.css({'font-size':'8pt',
				  'margin-bottom':'2em'})
			.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/dnc?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();
	                        }                
	                });
	        });

	    // Upload music file button
		$('.upload_music_file')
			.button({'icons':{'primary':'ui-icon-plusthick'}})
			.css({'font-size':'8pt',
				  'margin-bottom':'2em'})
			.click(function ()
			{
				$('<div></div>')
	                .appendTo('body')
	                .dialog({                       
	                    modal : true,
	                    draggable : false,
	                    resizable : false,
	                    height : 225,	                    
	                    width : 350,	                    
	                    title : 'Upload Music File',
	                    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-music-file-form'); ?>?return_url=forms/registration/dnc?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 music file upload form.\n\nThis page will be reloaded.");
	                                          location.reload();
	                                      })
	                                      .complete(function ()
	                                      {
	                                          
	                                      });     

	                            $('.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['music_file_found'])): ?>
	    	$('.upload_music_file').button('disable');

	    	jwplayer("jwVideoPlayer")
		    .setup(
		    {
		        file: "<?php echo asset('/music/' . $information['music_file_found']); ?>",		        
		        width: 400,
		        height: 10
		    })
		    .onReady(function ()
		    {
		    	$('#jwVideoPlayer_logo').css('display', 'none');
			});
	    <?php endif; ?>

		// 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()): ?> 

    	// Download drop-down menu
	    $('#grabber_list')
	        .menu()
	        .css({'display' : 'none',
	              'z-index' : '200',
	              'position' : 'absolute',
	              'right' : '0',
	              'top' : '23px',
	              'margin' : '0',
	              'padding' : '0',
	              'width' : '120px'});   

	    $('#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'}});
	            }   
	        });   	

    	$('.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/dnc'); ?>?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/dnc'); ?>" 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 /*  Past Due Notice  */ ?>
	<?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; ?>

	<br />


	<?php /*  Activity Program Form Info  */ ?>
	<?php if (!is_null($information['activity_program'])): ?>
		<img src="<?php echo asset('images/icons/dance_64px.png'); ?>" 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>
	<?php endif; ?>

	<?php /*  Title  */ ?>
	<h1>			
		<?php if (is_null($information['current_stage'])): ?>
			Dance Registration
		<?php else: ?>
			<?php if (!is_null($information['activity_program'])): ?>
				<?php echo $information['activity_program']->name; ?>
			<?php endif; ?>
			<?php echo $information['stages'][$information['current_stage']]->title; ?>
		<?php endif; ?>
	</h1>

	<br />

	<?php /*  Instructions  */ ?>	
	<div class="online_form_instructions ui-corner-all">
		<span class="ui-icon ui-icon-info" style="display:inline-block; position:relative; top:2px;"></span>
		
		<?php if (is_null($information['current_stage'])): ?>
			<b>This Form Is Closed</b>
			<br />
			<p>
				Entires are no longer being accepted.
			</p>
		<?php else: ?>
			<b>Instructions</b>
			<br />
			<ol>
				<?php if (is_null($information['activity_program'])): ?>
					<li><?php echo implode('</li><li>', $information['stages'][$information['current_stage']]->instructions['preselect']); ?></li>
				<?php else: ?>
					<li><?php echo implode('</li><li>', $information['stages'][$information['current_stage']]->instructions['form']); ?></li>
				<?php endif; ?>
			</ol>
		<?php endif; ?>

		<br />

		For questions, contact <?php echo $information['staff']->first_name; ?> <?php echo $information['staff']->last_name; ?> at (503) 682-6722 x239 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 /*  Error Information  */ ?>
	<?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 /*  Stages  */ ?>
    <?php if (is_null($information['activity_program'])): ?>

    	<div class="columns">			
			
			<?php foreach ($information['stages'] as $stage): ?>

				<div class="ui-corner-all"
					 style="float: left;
					 		width: 29%;
					 		border: 1px solid <?php echo $stage->colors[$stage->status]['border']; ?>;
					 	    background-color: <?php echo $stage->colors[$stage->status]['background']; ?>;
					 	    height: 150px;
					 	    text-align: center;
					 	    padding: 1em 0.5em;
					 	    position: relative;
					 	    margin-right: 2.5%;">
					<div style="font-size: 26pt; position: absolute; top: 0.4em; left: 0.15em; color: #d5d7d7;">
						<?php echo $stage->step; ?>
					</div>
					<div style="font-size: 14pt; padding-bottom: 1em; border-bottom: 2px solid #d9e1e0; margin-bottom: 1em;">
						<?php echo $stage->title; ?>
					</div>
					<b>
						<?php if ($stage->status < 0): ?>
							Starts <?php echo date('n/j/Y', strtotime($stage->open_at)); ?>
						<?php elseif ($stage->status > 0): ?>
							Closed <?php echo date('n/j/Y', strtotime($stage->due_at)); ?>
						<?php else: ?>
							Open now through <?php echo date('n/j/Y', strtotime($stage->due_at)); ?>
						<?php endif; ?>
					</b>
					<br /><br />
					<?php echo $stage->body; ?>
				</div>

			<?php endforeach; ?>

		</div>

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

    <?php endif; ?>

    
    <?php /*  Form  */ ?>
    <?php if (is_null($information['activity_program'])): ?>
    	
    	<?php /*  Need to select an activity program  */ ?>		
		<h2>Available Schools</h2>		
		
		<?php echo Form::open(array('url'    => url('/forms/registration/' . strtolower($information['activity']->slug)),
						    'method' => 'GET',
						    'style'  => 'position: relative;')); ?>		
			
			<select style="font-size: 12pt; min-width: 315px;" name="activity_program">
				<?php foreach ($information['aps_list'] as $value => $name): ?>
				
					<?php if (in_array($value, $information['disabled_aps_list'])): ?>
						<option value="<?php echo $value; ?>" disabled="disabled"><?php echo $name; ?></option>
					<?php else: ?>
						<option value="<?php echo $value; ?>"><?php echo $name; ?></option>
					<?php endif; ?>

				<?php endforeach; ?>
			</select>

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

    <?php else: ?>
	
		<?php /*  An activity program is selected  */ ?>
		<?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); ?>
			<?php echo Form::hidden('current_stage', $information['current_stage']); ?>	

			<!-- 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; width: 100%;">
			            	<?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 />

			<!-- Coach Information -->
			<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>

			<?php /*  Coaches Seating (Stage 2)  */ ?>
			<?php if($information['current_stage'] == 1): ?>
				<h3>Coaches Seating</h3>
				<div style="float: right; width: 910px; font-weight: bold;">
					<?php echo Form::label('reserve_seating', 'Select the number of coaches seating you want to reserve.'); ?>
				</div>
				<div style="float: left; width: 100px; margin-right: 10px; text-align: right;">				
					<?php echo Form::select('reserve_seating',
									array(0, 1, 2, 3, 4),
								    (!is_null($information['submission']) and property_exists($information['submission']->data, 'reserve_seating'))
								     ? $information['submission']->data->reserve_seating : 0); ?>
				</div>

			<?php elseif ($information['current_stage'] == 2): ?>
				<h3>Coaches Seating</h3>
				You have previously indicated to reserve <?php echo $information['submission']->data->reserve_seating; ?> seats for coaches.
			<?php endif; ?>

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

			<?php /*  Estimated Number of Participants (Stage 1)  */ ?>
			<?php if($information['current_stage'] == 0): ?>
			
				<h2>Participation Estimate <span class="required_marker" style="margin-left: 0;">*</span></h2>	
					
				<p class="gray note">Please provide a rough estimate of the maximum number of performers your team will be using in one round of the competition.  Remain conscious of the minimum and maximum number allowed for your selected sub-division.</p>
					
				<?php echo Form::label('estimated_participants', 'Approx. Maximum', array('style' => 'font-weight: bold; margin-right: 10px;')); ?>
				<?php echo Form::text('estimated_participants',
							  $information['submission']->data->estimated_participants,
							  array('style' => 'width: 35px;',
							  	    'class' => 'numbers_only', 'maxlength' => '2')); ?>
					
			
			<?php /*  Final Number of Participants (Stage 2)  */ ?>
			<?php elseif($information['current_stage'] == 1): ?>

				<h2>Number of Participants <span class="required_marker" style="margin-left: 0;">*</span></h2>
				<p class="gray note">Please provide the number of performers your team will compete with.</p>

				<div class="columns">
					<div class="half">
						<?php echo Form::label('final_number_participants', 'Number of Participants', array('style' => 'font-weight: bold; margin-right: 10px;')); ?>
						<?php echo Form::text('final_number_participants',
									  $information['submission']->data->final_number_participants,
									  array('style' => 'width: 35px;',
									  	    'class' => 'numbers_only', 'maxlength' => '2')); ?>
					</div>

					<div class="half">
						Your preliminary registration previously indicated a rough estimate of <?php echo $information['submission']->data->estimated_participants; ?> participants.
					</div>
				</div>

			<?php /*  No More Changing of Participants (Stage 3)  */ ?>
			<?php elseif($information['current_stage'] == 2): ?>	 

				<h2>Number of Participants</h2>
				<p class="gray note">This information has already been submitted.</p>

				You previously submitted a total of <?php echo $information['submission']->data->final_number_participants; ?> participants will be competing for your team.				

			<?php endif; ?>

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

			<?php /*  Sanctioned Competition Requirement (Stage 2)  */ ?>
			<?php if($information['current_stage'] == 1): ?>
				
				<h2>Sanctioned Competition Requirement <span class="required_marker" style="margin-left: 0;">*</span></h2>	
				<p class="gray note">In order to verify your team is qualified for state, please select the sanctioned competition 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 one OSAA sanctioned competition prior to state.  This competition may be attended after the registration deadline.<br /><br />
					If a competition is not included on the list, then it might not be an OSAA sanctioned competition.  Refer to the <a href="<?php echo url('/activities/dnc/information/calendar'); ?>" target="_blank">OSAA Dance/Drill Sanctioned Calendar</a> or contact the OSAA.
				</div>			
				
				<?php echo Form::label('competition', 'Competition', array('style' => 'font-weight: bold; margin-right: 10px;')); ?>
				<?php echo Form::select('competition',
								$information['competitions'],
								$information['submission']->data->competition); ?>

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

			<?php elseif ($information['current_stage'] == 2): ?>

				<h2>Sanctioned Competition Requirement</h2>	
				<p class="gray note">You previously indicated your team has competed or will compete in the following sanctioned competition.</p>

				<?php echo Form::label('competition', 'Competition', array('style' => 'font-weight: bold; margin-right: 10px;')); ?>
				<?php echo Form::select('competition',
								$information['competitions'],
								$information['submission']->data->competition,
								array('disabled' => 'disabled')); ?>

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

			<?php endif; ?>

			<?php /*  Accommodations (Stage 2)  */ ?>
			<?php if($information['current_stage'] == 1): ?>

				<h2>Accommodations</h2>
				<div class="columns">				
					<div class="half">

						<h3>Dressing Room</h3>
						<p class="gray note">Would you like to reserve a room for your team?</p>
						
						<div style="float: right; width: 375px; font-weight: bold;">
							<?php echo Form::label('reserve_room', 'Yes, reserve a room'); ?>
						</div>
						<div style="float: left; width: 100px; margin-right: 10px; text-align: right;">
							<?php echo Form::checkbox('reserve_room',
											  true,
											  $information['submission']->data->reserve_room); ?>
						</div>

					</div>
					<div class="half">

						<h3>Share Dressing Room With</h3>
						<p class="gray note">Who would you like to share a room with?</p>
						<?php echo Form::label('share_room_with', 'Team Name', array('style' => 'font-weight: bold; margin-right: 10px;')); ?>
						<?php echo Form::text('share_room_with',
									  $information['submission']->data->share_room_with,
									  array('style' => 'width: 200px;')); ?>
					</div>										
				</div>

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

			<?php elseif($information['current_stage'] == 2): ?>

				<h2>Accommodations</h2>
				<div class="columns">				
					<div class="half">
						<h3>Dressing Room</h3>
						<p>
							You previously indicated your team <b><?php echo ($information['submission']->data->reserve_room) ? 'does' : 'does not'; ?></b> want to reserve a dressing room.
						</p>
					</div>
					<div class="half">
						<h3>Share Dressing Room With</h3>
						<p>							
							You have previously indicated that
							<?php if (Helpers::strIsEmpty($information['submission']->data->share_room_with)): ?>
								you <b>do not want to share the dressing room</b> with any other team.
							<?php else: ?>
								you want to share a dressing room with <b><?php echo $information['submission']->data->share_room_with; ?></b>.
							<?php endif; ?>
						</p>
					</div>										
				</div>

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

			<?php endif; ?>

			<?php /*  Music (Stage 2 or 3)  */ ?>
			<?php if($information['current_stage'] > 0): ?>
				
				<h2>Music</h2>
				
				<h3>Selection/Track Information</h3>
				<p>Please provide information for your music selections.  Provide the selection's song title and the artist in "Title / Artist" format.  You can enter up to 4 music choices.</p>

				<div class="float_right" style="width: 60%;">
					<span class="ui-icon ui-icon-info" style="display:inline-block; position:relative; top:2px;"></span>
					For example:
					<table style="font-size: 10pt;">
						<thead>
							<tr style="font-weight: bold;">
								<td>Song Name/Title</td>
								<td>Artist(s)</td>
								<td>Type Selection As</td>
							</tr>
						</thead>

						<tbody>
							<tr>
								<td><i>Beam Me Up</i></td>
								<td>CAZZETTE</td>
								<td>Beam Me Up / Cazzette</td>
							</tr>
							<tr>
								<td><i>Bad Romance - Radio Edit</i></td>
								<td>Lady Gaga</td>
								<td>Bad Romance (Radio Edit) / Lady Gaga</td>
							</tr>
							<tr>
								<td><i>Silence in Your Heart</i></td>
								<td>Dash Berlin,<br />Chris Madin</td>
								<td>Silence in Your Heart / Dash Berlin, Chris Madin</td>
							</tr>
							<tr>
								<td><i>Tell Me Why (ft. David Waxman)</i></td>
								<td>Supermode</td>
								<td>Tell Me Why (ft. David Waxman) / Supermode</td>
							</tr>
						</tbody>

					</table>
				</div>	

				<dl>

					<dt><?php echo Form::label('music_1', 'Selection 1'); ?></dt>
					<dd><?php echo Form::text('music_1',
								      $information['submission']->data->music[0],
								      array('style' => 'width: 250px;', 'data-placeholder' => 'Title / Artist', 'data-id' => 0)); ?></dd>

					<br />

					<dt><?php echo Form::label('music_2', 'Selection 2'); ?></dt>
					<dd><?php echo Form::text('music_2',
								      $information['submission']->data->music[1],
								      array('style' => 'width: 250px;', 'data-placeholder' => 'Title / Artist', 'data-id' => 1)); ?></dd>

					<br />

					<dt><?php echo Form::label('music_3', 'Selection 3'); ?></dt>
					<dd><?php echo Form::text('music_3',
								      $information['submission']->data->music[2],
								      array('style' => 'width: 250px;', 'data-placeholder' => 'Title / Artist', 'data-id' => 2)); ?></dd>

					<br />

					<dt><?php echo Form::label('music_4', 'Selection 4'); ?></dt>
					<dd><?php echo Form::text('music_4',
								      $information['submission']->data->music[3],
								      array('style' => 'width: 250px;', 'data-placeholder' => 'Title / Artist', 'data-id' => 3)); ?></dd>				
							
				</dl>	

				<br class="clear" />								
				
				<h3>Music File</h3>

				<div class="float_right" style="width: 50%;">					
					<?php if (!is_null($information['music_file_found'])): ?>
						<img src="<?php echo asset('images/icons/check_mark_16px.png'); ?>" alt="" title="" style="position: relative; top: 2px;" /> Your team has uploaded a music file.
					<?php else: ?>
						<img src="<?php echo asset('images/icons/no_form_data_16px.png'); ?>" alt="" title="" style="position: relative; top: 2px;" /> Your team has not uploaded a music file.
					<?php endif; ?>
					<br /><br />
					<h3>Music File Management</h3>
					Music file specifications:
					<ul style="font-size: 9pt;">
						<li>Max file size: less than 12 MB</li>
						<li>Any valid music file: .mp3, .wav, .m4a, etc.</li>
						<li>Larger music files will need compression or re-sampling</li>						
					</ul>

					<br /><br />		

					<div style="float: left; height: 80px; border-right: 1px solid #D9E1E0; padding: 0 15px 0 0; margin: 0 15px 0 0;">
						<img src="http://www.osaa.org/images/icons/upload_file_72px.png" alt="" title="" style="float: left;" />				
					</div>	

					<div class="upload_music_file">Upload File</div><br />
					<div class="delete_music_file">Delete File</div>
									
				</div>
				
				<?php if (!is_null($information['music_file_found'])): ?>
					<br />
					<div id="jwVideoPlayer">Loading...</div>
					<br />

					<div style="font-size: 9pt; width: 48%;">
						<span class="ui-icon ui-icon-info" style="display:inline-block; position:relative; top:2px;"></span>					
						This fancy web player does not recognize every music file type, so it might not load properly.  In this case, you can listen to your uploaded music file by downloading it directly from this link:
						<a href="http://www.osaa.org/music/<?php echo $information['music_file_found']; ?>" target="_blank">http://www.osaa.org/music/<?php echo $information['music_file_found']; ?></a>
					</div>
					
				<?php else: ?>
					<div style="width: 48%; height: 265px; text-align: center; border: 1px solid #d9e1e0;">
						<br/><br />
						<b>No Music File Uploaded</b>	
						<br /><br />
						<span style="font-size: 6.5pt;">So...here's a picture of a frog with a sword.</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/frog.jpg'); ?>" alt="" title="" style="float: left; margin-right: 10px;" />
							<br /><br /><br />
							<i>I'm not a pet, I'm a Knight and master swordsman.</i>
						</div>
					</div>
				<?php endif; ?>

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

			<?php endif; ?>

			<?php /*  Program Information (Stage 2 or 3)  */ ?>
			<?php if($information['current_stage'] > 0): ?>

				<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>Team Name</h3>
					<p class="gray note">You can optionally include what the name of your team is for the program, otherwise, your team will be titled after your school's mascot.</p>

					<?php echo Form::label('team_name', 'Team Name', array('style' => 'font-weight: bold;')); ?><br />
					<?php echo Form::text('team_name',
								  $information['submission']->data->team_name,
								  array('style' => 'width: 300px;')); ?>

					<br /><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',
								  $information['submission']->data->routine_theme,
								  array('style' => 'width: 300px;')); ?>

					<br /><br /><br />

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

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

						<tbody>									

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

							<tr>
								<td>
									<?php echo Form::text('manager[1]',
												  $information['submission']->data->managers[1],
												  array('style' => 'width: 95%;', 'data-id' => 1)); ?>
								</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>Cue Sheet</h3>
					<p class="gray note">You can optionally include introductory text that will be read before your team performs.  All introductions will automatically conclude with "Take your positions please."</p>

					<?php echo Form::label('team_intro', 'Introduction', array('style' => 'font-weight: bold;')); ?>
					<?php echo Form::textarea('team_intro', 
									  $information['submission']->data->team_intro,
									  array('style' => 'width: 100%; height: 10em;')); ?>
					
					

				</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 < 50; $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" />
				<div class="horizontal_divider" style="width: 100%;"></div>
				<br />

				<h2>Team Photo</h2>			

				<div class="float_right" style="width: 38%;">
					<?php if (!is_null($information['team_photo'])): ?>
						<img src="<?php echo asset('images/icons/check_mark_16px.png'); ?>" alt="" title="" style="position: relative; top: 2px;" /> Your team has uploaded a photo.
					<?php else: ?>
						<img src="<?php echo asset('images/icons/no_form_data_16px.png'); ?>" alt="" title="" style="position: relative; top: 2px;" /> Your team has not uploaded a team photo.
					<?php endif; ?>

					<br /><br />
					
					<?php if (!is_null($information['team_photo'])): ?>
						<span class="ui-icon ui-icon-info" style="display:inline-block; position:relative; top:2px;"></span>
						Your team's photo is displayed to the left.  If you want to change this photo, use the buttons below.  Uploading another team photo will replace this one.					
						<br /><br />
					<?php endif; ?>
					
					<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 style="float: left; height: 80px; border-right: 1px solid #D9E1E0; padding: 0 15px 0 0; margin: 0 15px 0 0;">
						<img src="http://www.osaa.org/images/icons/upload_file_72px.png" alt="" title="" style="float: left;" />				
					</div>	

					<div class="upload_photo">Upload Photo</div>
					<br />
					<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 />

			<?php endif; ?>			

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

    <?php endif; ?>

    <br class="clear" /><br />
    
    <?php /*  Registration Status  */ ?>
    <?php if (is_null($information['activity_program'])): ?>
    	
		<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/dnc-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/dnc-entries/program'); ?>" target="_blank"><img src="<?php echo asset('/images/icons/pdf_file_16px.png'); ?>" alt="" title="" />Program</a>
	                </li>	                
	                <li>
	                	<a href="<?php echo url('/reports/dnc-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>Preliminary</th>
					<th>Registration</th>
					<th>Program Information</th>
					<th>Head Coach</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->stage_1): ?>
								<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="" />
								Incomplete
							<?php endif; ?>
						</td>
						<td>
							<?php if ($apf->stage_2): ?>
								<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="" />
								Incomplete
							<?php endif; ?>
						</td>
						<td>
							<?php if ($apf->stage_3): ?>
								<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="" />
								Incomplete
							<?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>						
					</tr>

				<?php endforeach; ?>
				
			</tbody>

		</table>

		<br />	

    <?php endif; ?>


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