<?php $__env->startSection('page_title'); ?>
    OSAA - Music Registration Form
<?php $__env->stopSection(); ?>

<?php $__env->startSection('page_sub_title'); ?>    
	
	Application to Participate in the Music State Championships
	
<?php $__env->stopSection(); ?>

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

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

    <style type="text/css">
    	

    	h3 {
    		color: #990000 !important;
    	}

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

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

    	.page_functions {
    		width: auto !important;
    	}    		
    	
    	/* Help Dialog */
        .help_dialog {
            font-size: 10pt;
        }

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

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

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

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

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

        .form_meta_notes {
        	position: absolute;
        	top: 0;
        	right: 0;
        	text-align: right;        	
        	font-size: 8pt;
        	line-height: 115%;
        }

        .category_icon {
        	float: left;
            width: 64px;
            height: 64px; 
        	position: relative; 
        	top: -0.5em; 
        	margin-right: 0.5em;
        }

        label, .label {
            font-weight: bold;
            width: 125px;
            text-align: right;
            margin-right: 25px;
            display: inline-block;
            position: relative;
            vertical-align: top;
        }     
        
        .required {
            color: #990000;
            font-weight: bold;
            font-size: 14pt;
            position: relative;
            top: 4px;
            margin-left: 5px;
        }

        table.music {
    		width: 100%;
    		border-collapse: collapse;
    	}

    	table.music thead th {
    		text-align: left;
    		vertical-align: bottom;
    	}

    	table.music tbody td {
    		line-height: 2em;
    		padding-right: 15px;
    	}

    	table.music tbody tr.odd {
    		background-color: #f2f2f2;
    	}

    	table.music tbody td input {
    		width: 100%;
    	}

    	.submit_area {
    		float: right; 
    		width: 600px; 
    		border: 1px solid #005fa9; 
    		padding: 0.5em;

    		background: #e1ffff; /* Old browsers */
			background: -moz-linear-gradient(-45deg,  #e1ffff 0%, #e1ffff 7%, #e1ffff 12%, #fdffff 20%, #e6f8fd 30%, #c8eefb 81%, #bee4f8 100%); /* FF3.6+ */
			background: -webkit-gradient(linear, left top, right bottom, color-stop(0%,#e1ffff), color-stop(7%,#e1ffff), color-stop(12%,#e1ffff), color-stop(20%,#fdffff), color-stop(30%,#e6f8fd), color-stop(81%,#c8eefb), color-stop(100%,#bee4f8)); /* Chrome,Safari4+ */
			background: -webkit-linear-gradient(-45deg,  #e1ffff 0%,#e1ffff 7%,#e1ffff 12%,#fdffff 20%,#e6f8fd 30%,#c8eefb 81%,#bee4f8 100%); /* Chrome10+,Safari5.1+ */
			background: -o-linear-gradient(-45deg,  #e1ffff 0%,#e1ffff 7%,#e1ffff 12%,#fdffff 20%,#e6f8fd 30%,#c8eefb 81%,#bee4f8 100%); /* Opera 11.10+ */
			background: -ms-linear-gradient(-45deg,  #e1ffff 0%,#e1ffff 7%,#e1ffff 12%,#fdffff 20%,#e6f8fd 30%,#c8eefb 81%,#bee4f8 100%); /* IE10+ */
			background: linear-gradient(135deg,  #e1ffff 0%,#e1ffff 7%,#e1ffff 12%,#fdffff 20%,#e6f8fd 30%,#c8eefb 81%,#bee4f8 100%); /* W3C */
			filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e1ffff', endColorstr='#bee4f8',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */

    	}

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

<?php $__env->startSection('jquery_init'); ?>
	
	// Succecss 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);
		})
	});
	
	// Back button
	$('.back_button')
		.button({icons : { primary : ' ui-icon-arrowthick-1-w'} })
		.css({'font-size' : '9pt'});

	// Submit button
	$('.submit_button')
		.button()
		.css({'font-size' : '12pt'})
		.click(function (event)
        {
            event.preventDefault();

            var button = $(this);

            var form = button.parents('form');

             $('<div></div>')
                .appendTo('body')
                .dialog(
                {                       
                    draggable : true,
                    resizable : false,
                    modal : true,
                    height : 250,
                    width : 400,                    
                    title : 'Confirmation',
                    buttons: [
                        {
                            text : "Yes",
                            'class' : "float_left",
                            icons : { primary : 'ui-icon-check'},
                            click : function()
                                    {                                                       
                                        form.submit();
                                    }
                        },
                        {
                            text : "No",
                            'class' : "float_right",
                            'data-autofocus' : "true",
                            icons : { primary : 'ui-icon-close'},
                            click : function()
                                    {
                                        // Close the dialog box
                                        $(this).dialog("close");                           
                                    }
                        }
                    ],
                    open : function ()
                        {  
                            var dialog_object = $(this);

                            dialog_object.html('<br />Are you sure you want to submit this form?<div style="font-size: 9pt; margin-top: 1em;" class="small gray note">Did you fill out all of the required fields?</div>');
                                                        
                            $('.ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '9pt');
                            $('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%');   

                            $('[data-autofocus="true"]').focus();
                        },
                    close : function ()
                        {
                            var dialog_object = $(this);                            

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


	// Help button    
    $('.help_button')
        .button({'icons':{'primary':'ui-icon-help'}})
        .css({'font-size':'9pt', 'margin-right':'10px'})
        .click(function(event)
        {
            event.preventDefault();

            var topic = 'registration_form'; 
            var form_id = <?php echo $info['form']->id; ?>;

            $('<div></div>')
                .appendTo('body')
                .dialog(
                {                       
                    draggable : true,
                    resizable : true,
                    height : 725,
                    minHeight : 400,
                    width : 615,
                    minWidth : 330,
                    modal : false,
                    title : 'Help',                    
                    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('forms/music/help'); ?>?topic=' + topic + '&form=' + form_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 looking up help information.\n\nThis page will be reloaded.");
                                          location.reload();
                                      })
                                      .complete(function ()
                                      {
                                           
                                      });                            
                            
                        },
                    close : function ()
                        {
                            var dialog_object = $(this);

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


        });

    // Map link button
	$('.map_link')
		.button({ icons : { primary : 'ui-icon-pin-s' }});
	
	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();
		
	// Required field marker
    $('[data-required]').after('<span class="required">*</span>'); 
	
	// Phone field
	$('[data-phone-field]').mask("(999) 999-9999");	

	$('input[name="participants"]').bind('input', function()
	{
  	    $(this).val($(this).val().replace(/[^0-9]/gi, ''));
	});		

	// Do not allow special characters in some fields
	$('[data-name-field]').bind('input', function()
	{
		$(this).val($(this).val().replace(/[^A-Za-z \-',\.]/gi, ''));
	});

	/* alertRequiredField
     *
     * Shows an alert box when attempting to save a blank value to a required field.
     */
    function alertRequiredField()
    {
        $('<div></div>')
            .appendTo('body')
            .dialog(
            {                       
                modal : true,
                draggable : false,
                resizable : false,                    
                height : 275,                    
                width : 415,                    
                title : 'Required Field',                    
                buttons: [
                    {
                        text : "OK",
                        'class' : "float_right",
                        icons : { primary : 'ui-icon-check'},
                        click : function()
                                {                                                       
                                    // Close the dialog box
                                    $(this).dialog("close"); 
                                }
                    }
                ],
                open : function ()
                    {  
                        var dialog_object = $(this);

                        dialog_object.html('<br />You\'ve entered in a blank value for a required field.  Required fields cannot be empty.<div style="font-size: 9pt; margin-top: 1em;" class="small gray note">The original value has been restored.</div>');
                        
                        $('.ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '9pt');
                        $('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%');
                        $('.ui-dialog-buttonpane .ui-dialog-buttonset').append('<div style="font-size: 8pt; line-height: 1.25em; margin-top: 0.5em;">Still having trouble?<br />(503) 682-6722 x228</div>');
                    },                    
                close : function ()
                    {
                        var dialog_object = $(this);
                        $(dialog_object).remove();
                    }                
            });
    }

    /* 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 $info['form']->id; ?>;

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

        var jqxhr = $.ajax(
        {
            type : 'POST',
            url : '<?php echo url('/forms/music/registration'); ?>/' + 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();
            }
            else
            {
                $('*').css({'cursor':''});
            }
        });
    }   

    // Autosave text fields
    function autoSaveTextField(input_field)
    {
        clearTimeout(autoSaveTextField.timeout);
        autoSaveTextField.timeout = setTimeout(function (){
            
            var value = input_field.val();
            var original_value = input_field.attr('data-original');
            var field = input_field.attr('data-field');
            var type = input_field.attr('data-type');                        
            
            var readonly_attr = input_field.attr('readonly');            
            if (typeof readonly_attr !== typeof undefined && readonly_attr !== false)
            {
                return false;
            }

            var reload = false;
            var reload_attr = input_field.attr('data-reload');            
            if (typeof reload_attr !== typeof undefined && reload_attr !== false)
            {
                reload = true;
            }

            var required = false;
            var required_attr = input_field.attr('data-required');            
            if (typeof required_attr !== typeof undefined && required_attr !== false)
            {
                required = true;
            }

            if (required && value == '' && !(original_value == '' || typeof original_value === typeof undefined || original_value === false))
            {
                input_field.val(original_value);

                input_field.focus();

                alertRequiredField();          

                return;
            }

            if (value != original_value && ((required && value != '') || !required))
            {
                saveFormData(field, value, type, reload);
                input_field.attr('data-original', value);
            }
        }, 50);
    }

    // Autosave text fields and textareas
    $('input[type="text"][data-autosave]').on('change blur autocompletechange', function (event)
        {            
            autoSaveTextField ($(this));
        });
    $('textarea[data-autosave]').on('change blur autocompletechange', function (event)
        {            
            autoSaveTextField ($(this));
        });   

    // Autosave select fields    
    $('select[data-autosave]').on('change', function(event)
    {
        var select_field = $(this);
        var selected = $(':selected', select_field);
        var value = selected.val();
        var original_value = select_field.attr('data-original'); 
        var field = select_field.attr('data-field');
        var type = select_field.attr('data-type');                        
     
        var readonly_attr = select_field.attr('readonly');            
        if (typeof readonly_attr !== typeof undefined && readonly_attr !== false)
        {
            return false;
        }

        var reload = false;
        var reload_attr = select_field.attr('data-reload');            
        if (typeof reload_attr !== typeof undefined && reload_attr !== false)
        {
            reload = true;
        }

        if (value != original_value)
        {
            saveFormData(field, value, type, reload);
            select_field.attr('data-original', value);
        }                
    });

    // Autosave check-box fields    
    $('input[type="checkbox"][data-autosave]').on('change', function(event)
    {
        var checkbox_field = $(this);        
        var value = checkbox_field.is(':checked');
        var original_value = checkbox_field.attr('data-original'); 
        var field = checkbox_field.attr('data-field');
        var type = checkbox_field.attr('data-type');                        
        
        var readonly_attr = checkbox_field.attr('readonly');            
        if (typeof readonly_attr !== typeof undefined && readonly_attr !== false)
        {
            return false;
        }

        var reload = false;
        var reload_attr = checkbox_field.attr('data-reload');            
        if (typeof reload_attr !== typeof undefined && reload_attr !== false)
        {
            reload = true;
        }

        if (value != original_value)
        {
            saveFormData(field, value, type, reload);
            checkbox_field.attr('data-original', value);
        }         
    });


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

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

	<a href="#" class="help_button">Help</a>
	<a href="<?php echo url('/forms/music/registration/' . $info['division']); ?>" class="back_button">Back</a>

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


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

	<?php if (Session::has('success')): ?>

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

	<?php endif; ?>	
	
	<br />	
		
	<div class="form_meta_notes">			
		Form ID <?php echo $info['form']->id; ?><br />
		Created at <?php echo date('g:i a m/d/Y', strtotime($info['form']->created_at)); ?><br />
		Updated at <?php echo date('g:i a m/d/Y', strtotime($info['form']->updated_at)); ?><br />
		Last updated by <?php echo $info['user']->getDisplayFullName(); ?>
	</div>

	<img src="<?php echo asset('/images/icons/' . strtolower(str_replace('-', '_', str_replace('concert-', '', $info['division']))) . '_64px.png'); ?>" alt="" title="" class="category_icon" />

	<h1 style="width: 800px; line-height: 115%;">State <?php echo ucwords(str_replace('-', ' ', str_replace('concert-', '', $info['division']))); ?> Registration Form for <?php echo $info['ap']->name; ?></h1>		

	<br /><br />
		

	<?php if (Session::has('errors')): ?>                
        <div class="ui-state-error" style="padding: 0.5em 0.5em;">
			<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/music/registration/' . $info['form']->id . '/submit'),
					    'method' => 'post',
					    'class'  => 'registration_form')); ?>

		<?php echo Form::hidden('form_id', $info['form']->id); ?>
		<?php echo Form::hidden('qualification', $info['form']->data->qualification); ?>
		<?php echo Form::hidden('category', $info['division']); ?>			

		<div class="ui-corner-all submit_area">
		
			<?php echo Form::submit('Submit', array('class' => 'submit_button float_right')); ?>

			<div style="float: left; width: 400px;">
				When you are ready, click the button to submit your form.  An e-mail confirmation will be sent to the school.
			</div>				

		</div>

		<h2>Qualification Status</h2>

		<?php

			if (Helpers::strEqual($info['form']->data->qualification, 'AUTO'))
			{
				$qualification_text = 'Automatic Qualifier';			
				$qualification_icon = asset('images/icons/automatic_qualifier_32px.png');
			}
			elseif (Helpers::strEqual($info['form']->data->qualification, 'TAPE'))
			{
				$qualification_text = 'Tape Pool Qualifier';			
				$qualification_icon = asset('images/icons/tape_pool_qualifier_32px.png');
			}
			else
			{
				$qualification_text = 'Not Qualified for State';			
				$qualification_icon = asset('images/icons/no_practice_48px.png');
			}
			
		?>

		<img src="<?php echo $qualification_icon; ?>" alt="" title="" style="width: 32px; float: left; margin-right: 15px;" />
		<h3><?php echo $qualification_text; ?></h3><br />

		<b>State Qualifying <?php echo (count($info['ap_group_records']) > 1) ? 'Events' : 'Event'; ?> Attended:</b><br />

		<?php foreach ($info['ap_group_records'] as $group_record): ?>

			<?php echo date('n/j/Y', strtotime($group_record->report->date)); ?>, <?php echo $group_record->report->event_name; ?> -

			<?php if ($group_record->group->is_auto_qualifier or $group_record->group->override_auto_qualifier): ?>
				Qualified Automatically
			<?php elseif ($group_record->group->is_tape_pool_qualifier or $group_record->group->override_tape_pool_qualifier): ?>
				Tape Pool Qualified
			<?php else: ?>
				Did Not Qualify
			<?php endif; ?>
			<br />

		<?php endforeach; ?>

		<br />

		<?php

			if ($info['form']->data->complete)
			{
				$registration_text = 'Complete';			
				$registration_icon = asset('images/icons/finished_16px.png');
			}
			elseif (!is_null($info['form']->submitted_at))
			{
				$registration_text = 'Pending Additional Materials';			
				$registration_icon = asset('images/icons/pending_16px.png');
			}
			else
			{
				$registration_text = 'Incomplete';			
				$registration_icon = asset('images/icons/never_started_16px.png');
			}

			$required_items = array();

			// Required items list
			if (Helpers::strEqual($info['activity'], array('BND', 'ORC')))
			{
				// Band and orchestra items 
				$items = array('FORM'   => (object)array('name' => 'Registration Form',
											 			 'desc' => 'Online registration form due ' . date('g:ia, D F j, Y', strtotime($info['due_dates'][$info['division']])),
										 			     'icon' => asset('/images/icons/form_2_48px.png')),
							   'SCORES' => (object)array('name' => 'Adjudicator Scores',
							   							 'desc' => 'Two adjudicator score sheets from the qualifying event',
										 			     'icon' => asset('/images/icons/form_48px.png')),
							   'ROSTER' => (object)array('name' => 'Class Roster',
							   							 'desc' => 'Alphabetized roster of your group\'s performers',
										 			     'icon' => asset('/images/icons/roster_48px.png')),
							   'MUSIC'  => (object)array('name' => 'Sheet Music',
							   							 'desc' => 'One original copy of the conductor\'s musical score (not photo copied)',
										 			     'icon' => asset('/images/icons/sheet_music_48px.png')),
                               'TAPE'   => (object)array('name' => 'Audio Recording',
                                                         'desc' => 'Digital recording of your performance at the qualifying event, must be uploaded to the <a href="' . $info['dropbox']['link'] . '" target="_blank">OSAA Dropbox</a>',
                                                         'icon' => asset('/images/icons/audio_file_icon_48px.png')),
							   'X_TAPE' => (object)array('name' => 'Audio Recording',
							   							 'desc' => 'CD of your performance at the qualifying event, must be mailed or hand delivered',
										 			     'icon' => asset('/images/icons/cd_48px.png')));
				// BND/ORC automatic qualifiers
				if (Helpers::strEqual($info['form']->data->qualification, 'AUTO'))
				{
					$required_items = array('FORM', 'SCORES');
				}
				
				// BND/ORC tape pool qualifiers
				elseif (Helpers::strEqual($info['form']->data->qualification, 'TAPE'))
				{
					$required_items = array('FORM', 'SCORES', 'MUSIC', 'TAPE');
				}
			}
			elseif (Helpers::strEqual($info['activity'], array('CHO')))
			{
				// Choir items
				$items = array('FORM'   => (object)array('name' => 'Registration Form',
											 			 'desc' => 'Online registration form due ' . date('g:ia, D F j, Y', strtotime($info['due_dates'][$info['division']])),
										 			     'icon' => asset('/images/icons/form_2_48px.png')),
							   'SCORES' => (object)array('name' => 'Adjudicator Scores',
							   							 'desc' => 'Adjudicator score sheets from the qualifying event',
										 			     'icon' => asset('/images/icons/form_48px.png')),
							   'ROSTER' => (object)array('name' => 'Class Roster',
							   							 'desc' => 'Alphabetized roster of your group\'s performers',
										 			     'icon' => asset('/images/icons/roster_48px.png')),
                               'TAPE'   => (object)array('name' => 'Video Recording',
                                                         'desc' => 'Digital recording of your performance at the qualifying event, must be uploaded to the <a href="' . $info['dropbox']['link'] . '" target="_blank">OSAA Dropbox</a>',
                                                         'icon' => asset('/images/icons/video_file_icon_48px.png')),  
							   'X_TAPE' => (object)array('name' => 'Video Recording',
							   							 'desc' => 'DVD of your performance at the qualifying event, must be mailed or hand delivered',
										 			     'icon' => asset('/images/icons/dvd_48px.png')));
				// CHO automatic qualifiers
				if (Helpers::strEqual($info['form']->data->qualification, 'AUTO'))
				{
					$required_items = array('FORM', 'SCORES');
				}
				
				// CHO tape pool qualifiers
				elseif (Helpers::strEqual($info['form']->data->qualification, 'TAPE'))
				{
					$required_items = array('FORM', 'SCORES', 'TAPE');
				}
			}

		?>
		
		<div class="columns">
			<div class="third">
				<h2>Registration Status</h2>				
				<h3><img src="<?php echo $registration_icon; ?>" alt="" title="" style="width: 16px; vertical-align: middle; float: left; margin-right: 15px;" /> <?php echo $registration_text; ?></h3><br />
			</div>

			<div class="third">
				<h2>Division</h2>
				<h3><?php echo $info['form']->data->division; ?></h3>
			</div>

			<div class="third">
				<h2>League</h2>
				<h3>
					<?php if (!is_null($info['ap']->league)): ?>
						<?php echo preg_replace('/\(.*\)$/', '', $info['ap']->league->slug); ?> <?php echo $info['ap']->league->name; ?>
					<?php else: ?>
						N/A
					<?php endif; ?>
				</h3>
			</div>
		</div>

		<br class="clear" >
		
		The following items are required for your registration process to be considered complete.

		<br /><br />		

		This registration form is completed online; however, once you submit your registration form, you still need to turn in supplemental materials.
        <?php if (Helpers::strEqual('TAPE', $required_items)): ?>
            A digital <?php echo strtolower($info['dropbox']['type']); ?> recording must be uploaded via the <a href="<?php echo $info['dropbox']['link']; ?>" target="_blank">OSAA Dropbox</a>.
        <?php endif; ?>
        Other required items can be submitted via the appropriate method listed below:

		<br /><br />

		<div class="columns">
			<div class="fourth">
				<b>Email:</b> <?php echo Helpers::obfuscateEmailLink ($info['staff']->email); ?>
			</div>
			<div class="fourth">
				<b>Fax:</b> (503) 682-0960
			</div>
			<div class="third">	
				<b>Mail/Deliver:</b> 25200 SW Parkway Ave Ste 1<br />
				<a href="https://maps.google.com/maps?q=25200+SW+Parkway+Ave+Suite+1+Wilsonville,+Oregon+97070&amp;hl=en&amp;sll=44.145447,-120.583402&amp;sspn=6.818841,14.27124&amp;t=h&amp;hnear=25200+SW+Parkway+Ave+%231,+Wilsonville,+Washington,+Oregon+97070&amp;z=17" target="_blank" class="button map_link" style="font-size:8pt; margin-right:20px;">Map</a>
				<span style="display: inline-block; width: 10px;"></span>Wilsonville, OR 97070
			</div>
		</div>

		<br class="clear" />
		
		<h3>Required Registration Items &amp; Supplemental Materials</h3>            

            <div style="display: inline-block; width: 275px; font-weight: bold;">Online Registration Form Deadline:</div>
            <span style="font-weight: bold; color: #990000;"><?php echo date('l, F j, Y @ g:ia', strtotime($info['due_dates'][$info['division']])); ?></span>
            <br />
            <div style="display: inline-block; width: 275px; font-weight: bold;">Supplemental Material Deadline:</div>
            <span style="font-weight: bold; color: #990000;"><?php echo date('l, F j, Y @ g:ia', strtotime($info['due_dates']['support_materials'])); ?></span>
        
		<br /><br />

		<?php if (count($required_items) > 1): ?>
			<div class="columns">
				<?php
					switch (count($required_items))
					{
						case 2: $column_class = 'fourth';
								break;
						case 3: $column_class = 'fourth';
								break;
						case 4: $column_class = 'fourth';
								break;
					}
				?>

				<?php foreach ($required_items as $item): ?>
					<div class="<?php echo $column_class; ?> text_center" style="position: relative;">
						<?php if ($info['form']->data->items->{strtolower($item)}): ?>
							<img src="<?php echo asset('/images/icons/check_2_24px.png'); ?>" alt="" title="" style="width: 24px; position: absolute; z-index: 2; top: -5px; left: 33%;" />
						<?php else: ?>
							<img src="<?php echo asset('/images/icons/missing_24px.png'); ?>" alt="" title="" style="width: 24px; position: absolute; z-index: 2; top: -5px; left: 33%;" />
						<?php endif; ?>

						<img src="<?php echo $items[$item]->icon; ?>" alt="" title="" style="width: 32px; z-index: 1;" /><br />
						<b><?php echo $items[$item]->name; ?></b><br />
						<div class="small gray note" style="line-height: 1em;"><?php echo $items[$item]->desc; ?></div>

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

			<br class="clear" />

        <?php else: ?>

            Your group is not qualified for state.

            <br class="clear" />

		<?php endif; ?>
	
        <?php if (Helpers::strEqual('TAPE', $required_items)): ?>

            <br class="clear" />

            <h3>Digital <?php echo ucfirst(strtolower($info['dropbox']['type'])); ?> Recording Upload</h3>

            <?php if ($info['form']->data->items->{strtolower('TAPE')}): ?>

                <img src="<?php echo asset('/images/icons/check_2_24px.png'); ?>" alt="" title="" style="width: 24px; float: left; margin: 5px 5px 5px 0;" />
                You have successfully uploaded a digital <?php echo strtolower($info['dropbox']['type']); ?> file of your group's performance for tape pool consideration.  If you need to re-upload your recording, you can visit the <a href="<?php echo $info['dropbox']['link']; ?>" target="_blank">OSAA Dropbox</a>.  <?php echo ucfirst(strtolower($info['dropbox']['type'])); ?> files must be titled with your school's name (i.e. "<?php echo $info['school']->name; ?>.<?php echo $info['dropbox']['ext']; ?>").

                <br /><br />

                <b>NOTE: </b>Physical media (CD/DVD) recordings will not be accepted by the OSAA.  Recordings will only be accepted in digital format via the <a href="<?php echo $info['dropbox']['link']; ?>" target="_blank">OSAA Dropbox</a>.  Click the <b>Help</b> button for additional instructions on uploading files.

            <?php else: ?>
                <img src="<?php echo asset('/images/icons/missing_24px.png'); ?>" alt="" title="" style="width: 24px; float: left; margin: 5px 5px 5px 0;" />
                You need to upload a digital <?php echo strtolower($info['dropbox']['type']); ?> file of your group's performance for tape pool consideration.  If you have already uploaded a file, this form may not reflect your school's most up-to-date registration information.  <b>Please allow OSAA staff time to verify your file has been uploaded and check back again.</b>

                <br /><br />

                <h4 style="color: #1c43a6;">You need to upload ONE single <?php echo strtolower($info['dropbox']['type']); ?> file.  If your recording was provided to you in separate files/tracks, you are responsible for combining those files into one single <?php echo strtolower($info['dropbox']['type']); ?> file to upload.</h4>

                <br />

                <h4 style="color: #1c43a6;">Steps to Upload a Digital Recording</h4>
                <ol>
                    <li>Acquire a digital <?php echo strtolower($info['dropbox']['type']); ?> version of your group's performance at the state qualifying event.<br /><span class="small gray note">(This needs to be one single digital <?php echo strtolower($info['dropbox']['type']); ?> recording of your state qualifying event performance.)</span></li>
                    <li><b>Before uploading, use your school's name as the title of your digital <?php echo strtolower($info['dropbox']['type']); ?> file (i.e. "<?php echo $info['school']->name; ?>.<?php echo $info['dropbox']['ext']; ?>").</b><br /><span class="small gray note">(Do not add your group's name or add anything extra, just the full name of your school please.)</span></li>
                    <li>Go to the <a href="<?php echo $info['dropbox']['link']; ?>" target="_blank">OSAA Dropbox</a> (&laquo; click this link).</li>
                    <li>Confirm you are uploading a file for the "<?php echo $info['display_year']; ?> <?php echo ucwords(strtolower(str_replace('concert-', '', $info['division']))); ?> Tape Pool".</li>
                    <li>Choose the file to upload from your computer.<br /><span class="small gray note">(If you have an existing Dropbox account, you can also choose to upload a file from your Dropbox account.)</span></li>
                    <li>Provide your first and last name as well as your e-mail address.<br /><span class="small gray note">(If you have an existing Dropbox account and are logged in, this information will be pre-filled in for you.)</span></li>
                    <li>Click the blue "Upload" button.</li>
                    <li>You will see a confirmation page and receive an e-mail once your file is successfully uploaded.</li>
                    <li>OSAA staff will note that you have uploaded a file on your registration form after it is confirmed that your file was uploaded successfully.</li>
                </ol>                

                <br />

                <b>NOTE: </b>Physical media (CD/DVD) recordings will not be accepted by the OSAA.  Recordings will only be accepted in digital format via the <a href="<?php echo $info['dropbox']['link']; ?>" target="_blank">OSAA Dropbox</a>.  Click the <b>Help</b> button for additional instructions on uploading files.
            <?php endif; ?>            

        <?php endif; ?>


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


		<h2>Additional Registration Information</h2>
		
		Please provide the following information.  Director contact information is for use by the OSAA office only and will not be publicized.  Required fields are indicated with a red asterisk (<span class="required">*</span> ).  Please enter names in "First Last" format, i.e. "John Smith."

		<div style="float: right; width: 515px;">
			<h3>Qualifying Event</h3>
			<?php echo Form::label('report', 'Select One', array('style' => 'width: 100px;')); ?>

			<select 
				name="report"
				style="width: 350px;"
				data-required="true"
				data-autosave="true"
				data-field="data->report"
				data-type="int"
				data-original="<?php echo $info['form']->data->report; ?>">
				<?php foreach ($info['ap_group_records'] as $group_record): ?>

					<option
						<?php if ($group_record->report->id == $info['form']->data->report): ?>
							selected="selected"
						<?php endif; ?>
						value="<?php echo $group_record->report->id; ?>"><?php echo $group_record->report->event_name; ?> (<?php echo date('n/j/Y', strtotime($group_record->report->date)); ?>)</option>

				<?php endforeach; ?>
			</select>			

			<div class="small gray note" style="margin-left: 130px;">
				Adjudicator scores are from this selected event.
				<?php if (count($info['ap_group_records']) > 1): ?>
					Because you attended more than one state qualifying event, you must select the one event that you want to use as your group's qualification for state.
				<?php endif; ?>
			</div>

			<?php if (Helpers::strEqual($info['activity'], array('BND', 'ORC'))): ?>
				<br />

				<h3>Performance Time Request</h3>						
				<div class="small note" style="margin-bottom: 1em;">
					Please note that these requests cannot be considered for situations that most schools are dealing with in the spring: testing, athletic events, etc.  If you do plan to ask for consideration of a conflict that you have, please make sure that it is a very unique one and know that, even then, there are no guarantees.  Thank you for understanding the sensitivity of this while we do all we can to create a fair championship schedule for all qualifying schools.
				</div>
				<?php echo Form::label('request', 'Request', array('style' => 'width: 100px;')); ?>
				<?php echo Form::textarea('request',
							      $info['form']->data->request,
							      array('style' => 'width: 350px; height: 4em;',
							      		'data-autosave' => true,
										'data-field' => "data->request",
										'data-type' => "string",
										'data-original' => $info['form']->data->request)); ?>
			<?php endif; ?>


		</div>



		<h3>Director</h3>

		<?php echo Form::label('director_name', 'Name'); ?>
		<?php echo Form::text('director_name',
					  $info['form']->data->director->name,
					  array('data-required' => true,
					  		'data-name-field' => true,
					  		'data-autosave' => true,
							'data-field' => "data->director->name",
							'data-type' => "string",
							'data-original' => $info['form']->data->director->name,
					        'style' => 'width: 150px;')); ?>
		
		<br /><br />

		<?php echo Form::label('director_email', 'Email'); ?>
		<?php echo Form::text('director_email',
					  $info['form']->data->director->email,
					  array('data-required' => 'required',
					  		'data-autosave' => true,
							'data-field' => "data->director->email",
							'data-type' => "string",
							'data-original' => $info['form']->data->director->email,
					        'style' => 'width: 225px;')); ?>
		
		<br /><br />

		<?php echo Form::label('director_phone', 'Mobile Phone'); ?>
		<?php echo Form::text('director_phone',
					  $info['form']->data->director->phone,
					  array('data-required' => 'required',
					  		'data-phone-field' => true,
					  		'data-autosave' => true,
							'data-field' => "data->director->phone",
							'data-type' => "phone",
							'data-original' => $info['form']->data->director->phone,
					        'style' => 'width: 110px;')); ?>

		<br /><br />

		
		<h3>Program Information</h3>

		<?php echo Form::label('group_name', 'Ensemble Name'); ?>
		<?php echo Form::text('group_name',
					  $info['form']->data->group_name,
					  array('data-required' => 'required',
					  	    'data-name-field' => true,
					  	    'data-autosave' => true,
							'data-field' => "data->group_name",
							'data-type' => "string",
							'data-original' => $info['form']->data->group_name,
					  	    'style' => 'width: 300px;')); ?>		

		<br /><br />		

		<?php echo Form::label('asst_director', 'Asst. Director'); ?>
		<?php echo Form::text('asst_director',
					  $info['form']->data->asst_director,
					  array('data-name-field' => true,
					  		'data-autosave' => true,
							'data-field' => "data->asst_director",
							'data-type' => "string",
							'data-original' => $info['form']->data->asst_director,
					        'style' => 'width: 150px;')); ?>

		<br /><br />

		<?php if (Helpers::strEqual($info['activity'], 'CHO')): ?>
					
			<?php echo Form::label('accompanists', 'Accompanist(s)'); ?>
			<?php echo Form::text('accompanists',
						  $info['form']->data->accompanists,
						  array('data-name-field' => true,
					  			'data-autosave' => true,
								'data-field' => "data->accompanists",
								'data-type' => "string",
								'data-original' => $info['form']->data->accompanists,
						        'style' => 'width: 300px;')); ?>
			<div class="small gray note" style="margin-left: 155px; margin-bottom: -1em;">
				Separate names with a comma, if necessary.
			</div>

			<br /><br />

			<?php echo Form::label('soloists', 'Soloist(s)'); ?>
			<?php echo Form::textarea('soloists',
						      $info['form']->data->soloists,
						      array('data-name-field' => true,
						      		'data-autosave' => true,
									'data-field' => "data->soloists",
									'data-type' => "string",
									'data-original' => $info['form']->data->soloists,
						      		'style' => 'width: 300px; height: 3em;')); ?>
			<div class="small gray note" style="margin-left: 155px; margin-bottom: -1em;">
				Separate soloists' names with a comma, if necessary.
			</div>

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

		<?php echo Form::label('participants', '# of Performers'); ?>
		<?php echo Form::text('participants',
					  $info['form']->data->participants,
					  array('data-required' => 'required',
					  		'data-autosave' => true,
							'data-field' => "data->participants",
							'data-type' => "int",
							'data-original' => $info['form']->data->participants,
					        'style' => 'width: 30px;',
					        'maxlength' => '3')); ?>

		<br /><br />

		<h3>Music Selection</h3>
		<div class="small note">
			Include the composer's full name and publisher information for each selection.  Indicate which selections are from the required list or that are pre-approved by checking the corresponding box in the last column.
		</div>

		<table class="music">
			<thead>
				<tr>
					<th>Order</th>
					<th>Title</th>
					<th>Composer</th>
					<th>Publisher</th>
					<th style="text-align: center; width: 150px;">On Required List<br />or Pre-Approved</th>
				</tr>
			</thead>

			<tbody>
				<?php for($i = 1; $i <= 6; $i++): ?>

					<tr>
						<td>Selection <?php echo $i; ?></td>
						<td>
							<?php echo Form::text('selections[' . $i . '][title]',
									      $info['form']->data->selections[$i - 1]->title,
									      array('data-autosave' => true,
							                    'data-field' => "data->selections[" . ($i - 1) . "]->title" ,
							                    'data-type' => "string")); ?>
						</td>
						<td>
							<?php echo Form::text('selections[' . $i . '][composer]',
									      $info['form']->data->selections[$i - 1]->composer,
									      array('data-autosave' => true,
							                    'data-field' => "data->selections[" . ($i - 1) . "]->composer",
							                    'data-type' => "string")); ?>
						</td>
						<td>
							<?php echo Form::text('selections[' . $i . '][publisher]',
									      $info['form']->data->selections[$i - 1]->publisher,
									      array('data-autosave' => true,
							                    'data-field' => "data->selections[" . ($i - 1) . "]->publisher",
							                    'data-type' => "string")); ?>
						</td>
						<td>
							<?php echo Form::checkbox('selections[' . $i . '][listed]',
											  true,
											  $info['form']->data->selections[$i - 1]->listed,
											  array('data-autosave' => true,
							                        'data-field' => "data->selections[" . ($i - 1) . "]->listed",
							                        'data-type' => "bool")); ?>
						</td>


					</tr>

				<?php endfor; ?>						
			</tbody>

		</table>				

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

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

    <span class="small">Return to the <a href="#full_page_content">top of the page</a> to submit this form.</span>

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

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

