anchor.diff:      },
       beforeSend: function () {
       },
  -
       success: function (data) {
         var updates = {};
  -
         $.each(data.grouped.block_child_type.groups, function (x, y) {
         var block_child_type = y.groupValue;
         var rel_count = y.doclist.numFound;
         updates[block_child_type] = rel_count;
         });
  -
         count = updates;
         $(".relatedCountContainer").each(function(){
             $(this).html(count["related_<%= Feature.uid_prefix %>"]);
         });
  -    }
  -  });
  -<% end %>
  -<%= javascript_on_load do %>
  -  //Code for Summary
  -  var termIndex = "<%= Feature.config.url %>";
  -  var assetIndex = "<%= Flare.config.asset_url %>";
  -  var domain = "<%= Feature.uid_prefix %>";
  -  var perspective = "<%= current_perspective.code %>";
  -  var SOLR_ROW_LIMIT = 200;
  -  var count = 0;
  -  var featureId =  "<%= Feature.uid_prefix %>-<%= @feature.fid %>";
  -  var featuresPath = "<%= features_path %>/%%ID%%";
  -  var fieldList = [
  -    "header",
  -    "id",
  -    "ancestor*",
  -    "caption_eng",
  -    "related_"+domain+"_feature_type_s",
  -    "related_"+domain+"_relation_label_s"
  -  ].join(",");
  -  if(domain == "places"){
  -    fieldList += ",related_subjects_t";
  -  }
  -  var url = termIndex + "/select?" +
  -  "&q=" + "{!child of=block_type:parent}id:" + featureId +
  -  "&fl=*,uid,related_"+domain+"_id_s,related_"+domain+"_header_s" +","+ fieldList +
  -  "&rows=" + SOLR_ROW_LIMIT +
  -  "&indent=true" +
  -  "&wt=json" +
  -  "&json.wrf=?" +
  -  "&sort=related_"+domain+"_header_s+asc";
  -  $.ajax({
  -    url: url,
  -    dataType: 'jsonp',
  -    jsonp: 'json.wrf'
  -  }).done(function(data){
  -    const response = data.response;
  -    if(response.numFound > 0){
  -      const result = response.docs.reduce(function(acc,currentNode,index){
  -        let node_type = currentNode["related_kmaps_node_type"] ;
  -        if(node_type === undefined) {
  -          node_type = "other";
  -        }
  -        if(acc[node_type] === undefined){
  -          acc[node_type] =  [];
  -        }
  -        let relation_label = currentNode["related_"+ domain +"_relation_label_s"];
  -        if(acc[node_type][relation_label] === undefined){
  -          acc[node_type][relation_label] = [];
  -        }
  -        let node_id = currentNode['related_'+domain+'_id_s'];
  -        acc[node_type][relation_label][node_id] = currentNode;
  -        return acc;
  -      }, []);
  -      var feature_name = $('<%= feature_label %>')[0];
  -      function addSummaryItems(group_key,data,container){
  -        for(var key in data[group_key]){ //parent,child, other
  -          var feature_block = jQuery('<div></div>').addClass('feature-block');
  -          var header = jQuery('<h6></h6>').append(jQuery('<span class="glyphicon"></span> '));
  -          header.append(feature_name.innerText +" "+ key);
  -          var relation_subject_list = jQuery('<ul style="list-stype:none;" class="collapsibleList"></ul>');
  -          var relation_subject_item = jQuery('<li class="collapsible_list_header"></li>');
  -          relation_subject_item.append(header);
  -          var related_subject_list = jQuery('<ul></ul>');
  -          var feature_count = 0;
  -          var sortedFeatures = data[group_key][key];
  -          for(var related_subject_index in sortedFeatures){
  -            var relation = jQuery('<li></li>');
  -              var currNode = sortedFeatures[related_subject_index];
  -              var currNodeID = currNode["related_"+domain+"_id_s"].replace(domain+"-","");
  -              relation.append("<a href="+featuresPath.replace("%%ID%%",currNodeID)+">"+currNode["related_"+domain+"_header_s"]+"</a>");
  -              var pop_container = jQuery('<span class="popover-kmaps" data-id="'+domain+'-'+currNodeID+'"><span class="popover-kmaps-tip"></span><span class="icon shanticon-menu3"></span></span>');
  -              relation.append(jQuery(pop_container));
  -              related_subject_list.append(relation);
  -              feature_count++;
  -          }
  -          relation_subject_item.append(related_subject_list);
  -          relation_subject_list.append(relation_subject_item);
  -          feature_block.append(relation_subject_list);
  -          container.append(feature_block);
  -        }
  -      }
  -      function featureSort(features){
  -        var featuresArr = [];
  -        for(var key in features){
  -            var index = 0;
  -            while(index < featuresArr.length){
  -              var curr_feature = featuresArr[index];
  -              if(features[key]["related_"+domain+"_header_s"] < curr_feature["related_"+domain+"_header_s"] )
  -                break;
  -              index++;
  -            }
  -            featuresArr.splice(index,0,features[key]);
  -        }
  -        return featuresArr;
  -      }
  -      addSummaryItems('parent',result,jQuery('.'+domain+'-in-'+domain));
  -      addSummaryItems('child',result,jQuery('.'+domain+'-in-'+domain));
  -      //addSummaryItems('other',result,jQuery('.'+domain+'-in-'+domain));
  -    } else {
  -     //Empty result set
       }
     });
   <% end %>
  
positive.code:           <p>
            <strong><%= feature_label %></strong> has <strong class="relatedCountContainer"><%#= relation_counts %></strong> other subjects directly related to it, which are presented here. See the relationships tab if you instead prefer to browse  all subordinate and superordinate categories for <%= feature_label %>.
            </p>
            <h5> <span class="collapsible_all_btn collapsible_expand_all">Expand all</span> / <span class="collapsible_all_btn collapsible_collapse_all">Collapse all</span> </h5>
          <div class="subjects-in-subjects kmaps-list-columns related-features has-ajax-pagination has-hash-feature-links">
          </div> <!-- END  subjects-in-subjects -->
          <br />
            <h5> <span class="collapsible_all_btn collapsible_expand_all">Expand all</span> / <span class="collapsible_all_btn collapsible_collapse_all">Collapse all</span> </h5>
          <br />
          </div> <!-- END panel-body -->
        </section> <!-- END panel -->
  
negative.code:   });
    $(".collapsible_collapse_all").on("click",function(e){
      $("ul.collapsibleList li.collapsibleListOpen").trigger("click");
    });
    $(".collapsible_expand_all").on("click",function(e){
     $(".collapsible_collapse_all").removeClass("collapsible_all_btn_selected");
      if (!$(".collapsible_expand_all").hasClass("collapsible_all_btn_selected")) {
       $(".collapsible_expand_all").addClass("collapsible_all_btn_selected");
      }
      $('.collapsibleList').kmapsCollapsibleList('expandAll');
    });
    $(".collapsible_collapse_all").on("click",function(e){
     $(".collapsible_expand_all").removeClass("collapsible_all_btn_selected");
      if (!$(".collapsible_collapse_all").hasClass("collapsible_all_btn_selected")) {
       $(".collapsible_collapse_all").addClass("collapsible_all_btn_selected");
      }
      $('.collapsibleList').kmapsCollapsibleList('collapseAll');
    });
  
    $("#relation_tree_container").kmapsFancytree({
  