Make search auto complete respond to focus events

See #5
Fix var scope in JS

Fixes #7