anchor.diff:  </div>
   
   <script type="text/javascript">
  +    function toggle_model_list() {
  +        var checked = $('include_other_project_models').checked;
  +        var selection_box = $('possible_models');
  +        var option;
  +
  +        selection_box.options.length=0;
  +
  +        if (checked) {
  +        <% ([["Select Model ...",0]]|all_models.collect{|s| [truncate(h(s.title),:length=>select_truncate_length),s.id]}).each do |model_details| -%>
  +            option = document.createElement("OPTION");
  +            option.text = '<%= escape_javascript(model_details[0]) -%>';
  +            option.value = '<%= model_details[1] -%>';
  +            try {
  +                selection_box.add(option); //for older IE version
  +            }
  +            catch (ex) {
  +                selection_box.add(option, null);
  +            }
  +        <% end -%>
  +        }
  +        else {
  +        <% ([["Select Model ...",0]]|project_models.collect{|s| [truncate(h(s.title),:length=>select_truncate_length),s.id]}).each do |model_details| -%>
  +            option = document.createElement("OPTION");
  +            option.text = '<%= escape_javascript(model_details[0]) -%>';
  +            option.value = '<%= model_details[1] -%>';
  +            try {
  +                selection_box.add(option); //for older IE version
  +            }
  +            catch (ex) {
  +                selection_box.add(option, null);
  +            }
  +        <% end -%>
  +        }
  +        selection_box.selectedIndex=0;
  +        selection_box.onchange();
  +    }
   
   <% models = resource.is_a?(Publication) ? resource.related_models : resource.model_masters %>
   <% models.each do |model| -%>
  
positive.code: <%
     resource_text ||= text_for_resource(resource)
      project_models=authorised_models(current_user.person.projects).sort_by &:title
      select_truncate_length=120
      associated_models = resource.is_a?(Publication) ? resource.related_models : resource.models
  -%>
  
negative.code:           <%= select_tag :model_ids, options_from_collection_for_select([], :id, :title), {:multiple=>true, :style=>"display:none;"} -%>
  
            <br/>
            <%= check_box_tag :include_other_project_models, nil, false, {:onchange=>"toggle_model_list();",:style=>"margin-top:0.5em;"} -%> Associate Models from other projects?
          </div>
  		<br/>
          <%= link_to_function (image("new") + " Associate with this #{resource_text}"), "addSelectedModel(); return(false);", :id=>"add_model_link", :class=>"block_link" %>
  