anchor.diff:        $clone[0].id = 'select2_creator';
         $clone.show();
         $clone.attr('name','creator_ids[' + this.currentNumber + ']');
  -      var $creator_types_clone = $("#select2_creator_types_hidden").clone();
  -      $creator_types_clone[0].id = 'select2_creator_types';
  -      $creator_types_clone.show();
  -      $creator_types_clone.attr('name', 'creator_type_ids[' + this.currentNumber + ']');
  +
  +      <% if SystemConfiguration.get("use_agent_type") %>
  +        var $creator_types_clone = $("#select2_creator_types_hidden").clone();
  +        $creator_types_clone[0].id = 'select2_creator_types';
  +        $creator_types_clone.show();
  +        $creator_types_clone.attr('name', 'creator_type_ids[' + this.currentNumber + ']');
  +        var $creator_types_clone_field = $("<td/>");
  +        $creator_types_clone_field.append($creator_types_clone);
  +      <% end %>
  +
         var $new_field = $("<tr/>").attr("id", "CF" + this.currentNumber);
         var newItem = this.itemTemplate.replace(/__count__/mg, this.currentNumber);
         var $clone_field = $("<td/>");
         $clone_field.append($clone);
  -      var $creator_types_clone_field = $("<td/>");
  -      $creator_types_clone_field.append($creator_types_clone);
         $new_field.append($clone_field);
  -      $new_field.append($creator_types_clone_field);
  +
  +      <% if SystemConfiguration.get("use_agent_type") %>
  +        $new_field.append($creator_types_clone_field);
  +      <% end %>
  +
         $new_field.append(newItem);
         $("#creator_field > table > tbody").append($new_field);
         this.currentNumber += 1;
  
positive.code: <script>
    $(document).ready(function() {
      $("#select2_creator,#select2_contributor,#select2_publisher").select2({
        multiple: false,
  
negative.code:          }).done(function(data) { callback(data); });
          }
        },
      });
      $("#select2_new_creator, #select2_new_contributor, #select2_new_publisher").select2(newAgentSlect2options);
    });
    $(document).on("select2-selecting", "#select2_new_creator", function(e){
      var attribute_name = e.target.name
      var attribute_number = attribute_name.match(/\d+/);
      if(e.val == parseInt(e.val)){
          $("#creator_ids_" + attribute_number).val(e.object.id);
          $("#creator_full_names_" + attribute_number).val(e.object.text);
          $("#creator_full_name_transcriptions_" + attribute_number).val(e.object.full_name_transcription);
      }
      else{
          $("#creator_ids_" + attribute_number).val("");
          $("#creator_full_names_" + attribute_number).val(e.object.text);
      }
    });
    $(document).on("select2-selecting", "#select2_new_contributor", function(e){
      var attribute_name = e.target.name
      var attribute_number = attribute_name.match(/\d+/);
      if(e.val == parseInt(e.val)){
          $("#contributor_ids_" + attribute_number).val(e.object.id);
          $("#contributor_full_names_" + attribute_number).val(e.object.text);
          $("#contributor_full_name_transcriptions_" + attribute_number).val(e.object.full_name_transcription);
      }
      else{
          $("#contributor_ids_" + attribute_number).val("");
          $("#contributor_full_names_" + attribute_number).val(e.object.text);
      }
    });
    $(document).on("select2-selecting", "#select2_new_publisher", function(e){
      var attribute_name = e.target.name
      var attribute_number = attribute_name.match(/\d+/);
      if(e.val == parseInt(e.val)){
          $("#publisher_ids_" + attribute_number).val(e.object.id);
          $("#publisher_full_names_" + attribute_number).val(e.object.text);
          $("#publisher_full_name_transcriptions_" + attribute_number).val(e.object.full_name_transcription);
      }
      else{
          $("#publisher_ids_" + attribute_number).val("");
          $("#publisher_full_names_" + attribute_number).val(e.object.text);
      }
    });
  </script>
  <% if SystemConfiguration.get("add_only_exist_agent") %>
    <% select2_str = '_select2' %>
    <%= text_field :select2_agent, :id, :id => 'select2_hidden', :style => 'display: none;' %>
  <% end %>
  
  <% if SystemConfiguration.get("use_agent_type") %>
    <select id="select2_creator_types_hidden" style="display: none;">
      <%= raw @create_types.collect{ |r| ["<option alt='" + r.name + "', value='" + r.id.to_s + "'>" + r.display_name.localize + " (" + r.name + ")</option>"] } %>
  