Moving inline JS to app.js document.on(ready)

- more tuning for #497
Merge pull request #507 from rackerlabs/gh-497-2

Moving inline JS to app.js document.on(ready)