General Javascript cleanup

Starts towards a cleaner, happier bunch of Javascript. There are probably plenty of more improvements to be made, but this at least brings things into one anonymous function for ACM and allows us to load the JS in the footer, which is always nicer.

Addresses #59