home *** CD-ROM | disk | FTP | other *** search
/ PC World 2006 December / PCWorld_2006-12_cd.bin / komunikace / netscape / nsb-install-8-1-2.exe / chrome / aim.jar / content / aim / AimAutoComplete.js < prev    next >
Text File  |  2006-01-06  |  1KB  |  36 lines

  1. var IMServiceClass = Components.classes['@netscape.com/aim/IMManager;1'];
  2. var pIIMManager  = IMServiceClass.getService(Components.interfaces.nsIIMManager);
  3.  
  4. var AddressAutoCompleteListener = {
  5.     onAutoCompleteResult: function(field, aOriginalString, aMatch) {
  6.  
  7.         //dump("textId = " + doc_id + "\n");
  8.         //dump("value = " + field.value + "\n");
  9.         //dump("aOriginalString = " + aOriginalString + "\n");
  10.         //dump("aMatch = " + aMatch + "\n");
  11.     if(field)
  12.           field.value = aMatch;
  13.     }
  14. };
  15.  
  16. function aimAutoCompleteObject()
  17. {
  18.     var pIIMManager = aimManager();
  19.     if(pIIMManager)
  20.         return pIIMManager.QueryInterface(Components.interfaces.nsIAutoCompleteSession);
  21.     else
  22.         return null;
  23. }
  24.  
  25. function aimAutoCompleteAddress(select_doc_id, doc_id)
  26. {
  27.     dump("select_doc_id = " + select_doc_id + "\n");
  28.     dump("doc_id = " + doc_id + "\n");
  29.     
  30.     var ac = aimAutoCompleteObject();
  31.   var field = document.getElementById(doc_id);
  32.     dump("field " + field + "ac " + ac + "\n");
  33.     if(ac)
  34.         ac.autoComplete(null, field, field.value, AddressAutoCompleteListener);
  35. }
  36.