#151: Add unit tests for JavaScript.

Extracts the API from browserid.js and moves it to a new file, api.js,
that authors can include on their own if they don't want the automatic
behavior of browserid.js. This also allows us to unit-test the API 
while ignoring the onload stuff from browserid.js.

There aren't tests yet for browserid.js as that would better be handled
by end-to-end tests using something like Selenium.