* if schema name was specified in vcard attribute then get value from schema name,
* if schema name was obtained then get value from schema name,
wallet_GetPrefills(  nsIDOMNode* elementNode,  nsIDOMHTMLInputElement*& inputElement,    nsIDOMHTMLSelectElement*& selectElement,  nsAutoString*& schemaPtr,  nsAutoString*& valuePtr,  PRInt32& selectIndex,  PRInt32& index){  nsresult result;  /* get prefills for input element */  result = elementNode->QueryInterface(kIDOMHTMLInputElementIID, (void**)&inputElement);  if ((NS_SUCCEEDED(result)) && (nsnull != inputElement)) {    nsAutoString type;    result = inputElement->GetType(type);    if ((NS_SUCCEEDED(result)) && ((type.IsEmpty()) || (type.CompareWithConversion("text", PR_TRUE) == 0))) {      nsAutoString field;      result = inputElement->GetName(field);      if (NS_SUCCEEDED(result)) {        nsAutoString schema;        nsAutoString value;        nsVoidArray* itemList;        /* get schema name from vcard attribute if it exists */        nsCOMPtr<nsIDOMElement> element = do_QueryInterface(elementNode);        if (element) {          nsAutoString vcard; vcard.AssignWithConversion("VCARD_NAME");          result = element->GetAttribute(vcard, schema);        }        /*         * if schema name was specified in vcard attribute then get value from schema name,         * otherwise get value from field name by using mapping tables to get schema name         */        if (FieldToValue(field, schema, value, itemList, index) == 0) {          if (value.IsEmpty() && nsnull != itemList) {            /* pick first of a set of synonymous values */            nsAutoString encryptedValue( ((wallet_Sublist *)itemList->ElementAt(0))->item );            if (NS_FAILED(Wallet_Decrypt(encryptedValue, value))) {              NS_RELEASE(inputElement);              return -1;            }          }          valuePtr = new nsAutoString(value);          if (!valuePtr) {            NS_RELEASE(inputElement);            return -1;          }          schemaPtr = new nsAutoString(schema);          if (!schemaPtr) {            delete valuePtr;            NS_RELEASE(inputElement);            return -1;          }          selectElement = nsnull;          selectIndex = -1;          return NS_OK;        }      }    }    NS_RELEASE(inputElement);    return -1;  }  /* get prefills for dropdown list */  result = elementNode->QueryInterface(kIDOMHTMLSelectElementIID, (void**)&selectElement);  if ((NS_SUCCEEDED(result)) && (nsnull != selectElement)) {    nsAutoString field;    result = selectElement->GetName(field);    if (NS_SUCCEEDED(result)) {      nsAutoString schema;      nsAutoString value;      nsVoidArray* itemList;      if (FieldToValue(field, schema, value, itemList, index) == 0) {        if (!value.IsEmpty()) {          /* no synonym list, just one value to try */          result = wallet_GetSelectIndex(selectElement, value, selectIndex);          if (NS_SUCCEEDED(result)) {            /* value matched one of the values in the drop-down list */            valuePtr = new nsAutoString(value);            if (!valuePtr) {              NS_RELEASE(selectElement);              return -1;            }            schemaPtr = new nsAutoString(schema);            if (!schemaPtr) {              delete valuePtr;              NS_RELEASE(selectElement);              return -1;            }            inputElement = nsnull;            return NS_OK;          }        } else {          /* synonym list exists, try each value */          for (PRInt32 i=0; i<LIST_COUNT(itemList); i++) {            value = ((wallet_Sublist *)itemList->ElementAt(i))->item;            result = wallet_GetSelectIndex(selectElement, value, selectIndex);            if (NS_SUCCEEDED(result)) {              /* value matched one of the values in the drop-down list */              valuePtr = new nsAutoString(value);              if (!valuePtr) {                NS_RELEASE(selectElement);                return -1;              }              schemaPtr = new nsAutoString(schema);              if (!schemaPtr) {                delete valuePtr;                NS_RELEASE(selectElement);                return -1;              }              inputElement = nsnull;              return NS_OK;            }          }        }      }    }    NS_RELEASE(selectElement);  }  return -1;}