{$startform}
	<div class="pageoverflow">
		<p class="pagetext">{$action_text}:</p>
		<p class="pageinput">{$action_input}</p>
	</div>
		<div class="pageoverflow">
		<p class="pagetext">{$period_text}:</p>
		<p class="pageinput">{$period_input}</p>
	</div>
	<div class="pageoverflow">
		<p class="pagetext">{$prize_code_text}:</p>
		<p class="pageinput">{$prize_code_input}</p>
	</div>
	<div class="pageoverflow">
		<p class="pagetext">{$title_text}:</p>
		<p class="pageinput">{$title_input}</p>
	</div>
	<div class="pageoverflow">
		<p class="pagetext">{$description_text}:</p>
		<p class="pageinput">{$description_input}</p>
	</div>
	<div class="pageoverflow">
		<p class="pagetext">{$number_text}:</p>
		<p class="pageinput">{$number_input}</p>
	</div>
	<div class="pageoverflow">
		<p class="pagetext">{$status_text}:</p>
		<p class="pageinput">{$status_input}</p>
	</div>
	<div class="pageoverflow">
		<p class="pagetext">&nbsp;</p>
		<p class="pageinput">{$hidden}{$submit}{$cancel}{$apply}</p>
	</div>
{$endform}

{literal}
<script type="text/javascript">
//<![CDATA[

$(document).ready(function() {

    $('#actiondropdown').change(function() {        
        var active_action_option = $(this).val();
        change_perioddropdown(active_action_option);
    });
    
    var active_action_option = $('#actiondropdown').val();
    change_perioddropdown(active_action_option);

});

function change_perioddropdown(active_action_option) {
        
    var list = [
{/literal}
{$period_js}        
{literal}
    ];
    
    var active_period = $.grep(list, function(n, i) {
            return n.pkey == active_action_option;
    });

    var options = '<option value="">--</option>';

    if (active_period.length > 0) {
        options = '';
        jQuery.each(active_period[0], function(i, val) {
            if (i == 'pkey') { return; }
            options += '<option value="'+i+'">'+val+'</option>';
        });
    }

    $('#perioddropdown').html(options);
    
    var selected_perioddropdown = {/literal}"{$selected_period_js}"{literal};
    $("#perioddropdown").val( selected_perioddropdown ).attr('selected',true);
       
}

//]]>
</script>
{/literal}
