rem: item = popup.insertBefore(item, popup.childNodes[length-2]); 
add: item = popup.insertBefore(item, popup.childNodes[numItemsInPopup-2]); 
context: function addAttachmentToPopup(popup, attachment) {   if (popup)  {     var item = document.createElement('menu');    if ( item )     {           // insert the item just before the separator...the separator is the 2nd to last element in the popup.      item.setAttribute('class', 'menu-iconic');      setApplicationIconForAttachment(attachment,item);      var numItemsInPopup = popup.childNodes.length;      item = popup.insertBefore(item, popup.childNodes[length-2]);      item.setAttribute('label', attachment.displayName);       var oncommandPrefix = generateCommandSuffixForAttachment(attachment);      var openpopup = document.createElement('menupopup');      openpopup = item.appendChild(openpopup);      var menuitementry = document.createElement('menuitem');           menuitementry.setAttribute('oncommand', 'openAttachment' + oncommandPrefix);       menuitementry.setAttribute('label', "Open");       menuitementry = openpopup.appendChild(menuitementry);      var menuseparator = document.createElement('menuseparator');      openpopup.appendChild(menuseparator);            menuitementry = document.createElement('menuitem');      menuitementry.setAttribute('oncommand', 'saveAttachment' + oncommandPrefix);       menuitementry.setAttribute('label', "Save");       menuitementry = openpopup.appendChild(menuitementry);    }  // if we created a menu item for this attachment...  } // if we have a popup} 
meta: 8395	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/8395/352b24729daa7da2f757eb6f240f7f56d76297ed/msgHdrViewOverlay.js/clean/mailnews/base/resources/content/msgHdrViewOverlay.js