rem:  var abPopup = document.getElementById('abPopup'); if ( abPopup ) { var menupopup = document.getElementById('abPopup-menupopup');  if ( editCard.selectedAB && menupopup && menupopup.childNodes ) { for ( var index = menupopup.childNodes.length - 1; index >= 0; index-- ) { if ( menupopup.childNodes[index].getAttribute('data') == editCard.selectedAB ) { abPopup.value = menupopup.childNodes[index].getAttribute('value'); abPopup.data = menupopup.childNodes[index].getAttribute('data'); break; } } } else {   abPopup.value = menupopup.childNodes[1].getAttribute('value'); abPopup.data = menupopup.childNodes[1].getAttribute('data'); } } 
add:  var abPopup = document.getElementById('abPopup'); if ( abPopup ) { var menupopup = document.getElementById('abPopup-menupopup'); 
context: function OnLoadNewCard(){	InitEditCard();	doSetOKCancel(NewCardOKButton, 0);		var cardproperty = Components.classes["@mozilla.org/addressbook/cardproperty;1"].createInstance();	cardproperty = cardproperty.QueryInterface(Components.interfaces.nsIAbCard);	editCard.card = cardproperty;	editCard.okCallback = 0;	editCard.titleProperty = "newCardTitle"	if ("arguments" in window && window.arguments[0])	{		if ("selectedAB" in window.arguments[0])			editCard.selectedAB = window.arguments[0].selectedAB;		else			editCard.selectedAB = "abdirectory://abook.mab";    // we may have been given properties to pre-initialize the window with....    // we'll fill these in here...    if ("primaryEmail" in window.arguments[0])      editCard.card.primaryEmail = window.arguments[0].primaryEmail;    if ("displayName" in window.arguments[0])      editCard.card.displayName = window.arguments[0].displayName;	}	// set popup with address book names	var abPopup = document.getElementById('abPopup');	if ( abPopup )	{		var menupopup = document.getElementById('abPopup-menupopup');				if ( editCard.selectedAB && menupopup && menupopup.childNodes )		{			for ( var index = menupopup.childNodes.length - 1; index >= 0; index-- )			{				if ( menupopup.childNodes[index].getAttribute('data') == editCard.selectedAB )				{					abPopup.value = menupopup.childNodes[index].getAttribute('value');					abPopup.data = menupopup.childNodes[index].getAttribute('data');					break;				}			}		}		else {			// Default to the first valid addressbook when none is			// selected. (the 0th is an empty/invalid entry)			abPopup.value = menupopup.childNodes[1].getAttribute('value');			abPopup.data = menupopup.childNodes[1].getAttribute('data');		}	}	GetCardValues(editCard.card, document);	//// FIX ME - looks like we need to focus on both the text field and the tab widget	//// probably need to do the same in the addressing widget		// focus on first name	var firstName = document.getElementById('FirstName');	if ( firstName )		firstName.focus();	moveToAlertPosition();}
meta: 8395	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/8395/0b2dd2b2d2fd037df917e07645fa019a963332a5/abCardOverlay.js/buggy/mailnews/addrbook/resources/content/abCardOverlay.js