Move the JS code out of index.html, and address coding style nits.
Use double quotes to avoid ugly escaping in presence_api_test.js.