-- doesn't trample the "window" object's namespac
-- doesn't trample your existing event handlers, and adding your own doesn't break things
-- easily reusable by others for other purposes
Here's the InputComplete (and InputCompleteData) class file, object oriented and MVC:
http://danga.com/demo/tagcomplete/inputcomplete.js
View the source for how to use it:
http://danga.com/demo/tagcomplete/
Create a data model (the word list to autocomplete), and create autocomplete objects for each input element, using that model.
Enjoy!