Clean up javascript

Don't use global variables, don't use one-character or otherwise extremely terse and domain specific variable names. Don't use ['with'](https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Statements/with). 

I don't know it, but there has got to be a better way to run the program when the document is done loading. We should find out what the best practice way is.