Moved javascript into autocomplete.js

For better maintainence