Hash passwords before sending them to the server.

Also moved a lot of JavaScript to the body.