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

    <style type="text/css">
    	

    	h3 {
    		color: #990000 !important;
    	}    	

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

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

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

	// Next button
	$('.next_button')
		.button()
		.css({'font-size' : '9pt'});

	// 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_category';
            var category = '<?php echo $info['division']; ?>';

            $('<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 + '&category=' + category,
                                          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 $__env->stopSection(); ?>

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

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

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


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

	<img src="<?php echo asset('/images/icons/' . strtolower(str_replace('-', '_', str_replace('concert-', '', $info['division']))) . '_64px.png'); ?>" alt="" title="" style="float: left; width: 64px; height: 64px; position: relative; top: -0.5em; margin-right: 0.5em;" />
		
	<h1>State <?php echo ucwords(str_replace('-', ' ', str_replace('concert-', '', $info['division']))); ?> Registration Form</h1>		

	<br />

	<div class="online_form_instructions ui-corner-all">
		<span class="ui-icon ui-icon-info" style="display:inline-block; position:relative; top:2px;"></span>
		<b>Instructions</b> <br />
		<ol>								
			<li>Select your school from the drop-down list.</li>
			<li>Click the "Next" button to continue.</li>
			<li>You can go back to the main music application page by clicking the "Back" button.</li>			
		</ol>

		<br />
		
		<b>Note:</b> This online application form closes <?php echo date('g:ia, D F j, Y', strtotime($info['due_dates'][$info['division']])); ?>.  Late entry forms will not be accepted.  Support materials must be received by <?php echo date('g:ia, D F j, Y', strtotime($info['due_dates']['support_materials'])); ?>.
		
		<br /><br />

		For questions, click the "Help" button for full details and instructions.  If you need assistance, you can contact <?php echo $info['staff']->name; ?> at <?php echo $info['staff']->phone; ?> or by e-mail to <?php echo Helpers::obfuscateEmailLink ($info['staff']->email); ?>.
	</div>		

	<br />			

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

	<?php if (count($info['ap_options']) > 0): ?>

		<?php echo Form::open(array('class'  => 'registration_form')); ?>

			<h2>Select your school</h2>			

			<select style="font-size: 12pt; margin-right: 25px; width: 300px;" name="ap_id">
				<?php foreach ($info['ap_options'] as $option): ?>

					<option value="<?php echo $option->value; ?>"><?php echo $option->text; ?></option>

				<?php endforeach; ?>
			</select>

			<?php echo Form::submit('Next', array('class' => 'next_button')); ?>
			
		
		<?php echo Form::close(); ?>

	<?php else: ?>

		<h2>No Schools to Select</h2>

		<p>
			It looks like you do not have access to any schools that qualified as an automatic qualifier or tape pool qualifier at a state qualifying event.  There could be a variety of reasons for this:
			<ul>
				<li>Your school's group was not included on a large ensemble report.</li>
				<li>Your group was not an automatic or tape pool qualifier.</li>
				<li>Your user account does not have access to any school.</li>
			</ul>
		</p>

	<?php endif; ?>

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

