function setupRegistration()
{
  if($('#registration_reference_select').length) {
    $('#registration_reference_select option[value="'+selected_registration_reference+'"]').attr('selected', 'selected');
    $('#registration_reference_select').change(
      function() {
        if($('#registration_reference_select option:selected').val() == 'Other') {
          $('#other_reference').show();
        } else {
          $('#other_reference').hide();
        }
      }
    ).change();
  }
}

jQuery(setupRegistration);

function setupApplication()
{
  if($('#application_reference_select').length) {
    $('#application_reference_select option[value="'+selected_application_reference+'"]').attr('selected', 'selected');
    $('#application_reference_select').change(
      function() {
        if($('#application_reference_select option:selected').val() == 'Other') {
          $('#other_reference').show();
        } else {
          $('#other_reference').hide();
        }
      }
    ).change();
  }
}

jQuery(setupApplication);

function setupStart()
{
  if($('#start_reference_select').length) {
    $('#start_reference_select option[value="'+selected_start_reference+'"]').attr('selected', 'selected');
    $('#start_reference_select').change(
      function() {
        if($('#start_reference_select option:selected').val() == 'Other') {
          $('#other_reference').show();
        } else {
          $('#other_reference').hide();
        }
      }
    ).change();
  }
}

jQuery(setupStart);