// Auto-completion of form used for contact

if (navigator.userProfile)
{
   var profile = navigator.userProfile;

   profile.clearRequest();

   profile.addReadRequest("Vcard.DisplayName");
   profile.addReadRequest("Vcard.Company");
   profile.addReadRequest("Vcard.JobTitle");
   profile.addReadRequest("Vcard.Business.StreetAddress");
   profile.addReadRequest("Vcard.Business.City");
   profile.addReadRequest("Vcard.Business.State");
   profile.addReadRequest("Vcard.Business.ZipCode");
   profile.addReadRequest("Vcard.Business.Country");
   profile.addReadRequest("Vcard.Business.Phone");
   profile.addReadRequest("Vcard.Business.Fax");
   profile.addReadRequest("Vcard.Email");

   profile.doReadRequest(3,"SAFI");

   var myForm = document.forms[0];

   myForm.elements["name"].value = profile.getAttribute("Vcard.DisplayName");
   myForm.elements["company"].value = profile.getAttribute("Vcard.Company");
   myForm.elements["position"].value = profile.getAttribute("Vcard.JobTitle");
   myForm.elements["address"].value = profile.getAttribute("Vcard.Business.StreetAddress") + "\n" + profile.getAttribute("Vcard.Business.City") + "\n" + profile.getAttribute("Vcard.Business.State") + "\n" + profile.getAttribute("Vcard.Business.ZipCode") + "\n" + profile.getAttribute("Vcard.Business.Country");
   myForm.elements["phone"].value = profile.getAttribute("Vcard.Business.Phone");
   myForm.elements["fax"].value = profile.getAttribute("Vcard.Business.Fax");
   myForm.elements["email"].value = profile.getAttribute("Vcard.Email");

   profile.clearRequest();
}