Moved out client JavaScript

Moved the client side JavaScript out of index.html into a separate file called client.js.