rem: var heading = headingList.item(0); 
add: var heading = headingList.item(k); 
context: function FillListboxes(){  var NamedAnchorNodeList = editorShell.editorDocument.anchors;  var NamedAnchorCount = NamedAnchorNodeList.length;  var item;  if (NamedAnchorCount > 0)  {    for (var i = 0; i < NamedAnchorCount; i++)      AppendStringToTreelist(gDialog.NamedAnchorList, NamedAnchorNodeList.item(i).name);    gHaveNamedAnchors = true;  }   else   {    // Message to tell user there are none    item = AppendStringToTreelistById(gDialog.NamedAnchorList, "NoNamedAnchors");    if (item) item.setAttribute("disabled", "true");  }  var firstHeading = true;  for (var j = 1; j <= 6; j++)  {    var headingList = editorShell.editorDocument.getElementsByTagName("h"+String(j));    if (headingList.length > 0)    {      var heading = headingList.item(0);      // Skip headings that already have a named anchor as their first child      //  (this may miss nearby anchors, but at least we don't insert another      //   under the same heading)      var child = heading.firstChild;      if (child && child.nodeName == "A" && child.name && (child.name.length>0))        continue;      var range = editorShell.editorDocument.createRange();      range.setStart(heading,0);      var lastChildIndex = heading.childNodes.length;      range.setEnd(heading,lastChildIndex);      var text = range.toString();      if (text)      {        // Use just first 40 characters, don't add "...",        //  and replace whitespace with "_" and strip non-word characters        text = ConvertToCDATAString(TruncateStringAtWordEnd(text, 40, false));        // Append "_" to any name already in the list        if (GetExistingHeadingIndex(text) > -1)          text += "_";        AppendStringToTreelist(gDialog.HeadingsList, text);        // Save nodes in an array so we can create anchor node under it later        if (!HNodeArray)          HNodeArray = new Array(heading)        else          HNodeArray[HNodeArray.length] = heading;      }    }  }  if (HNodeArray)  {    gHaveHeadings = true;  } else {    // Message to tell user there are none    item = AppendStringToTreelistById(gDialog.HeadingsList, "NoHeadings");    if (item) item.setAttribute("disabled", "true");  }}
meta: 10234	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/10234/67075783e5dd0019371ca8f8e720a60aab2a7146/EdLinkProps.js/clean/editor/ui/dialogs/content/EdLinkProps.js