Fix up javascript errors preventing some of the functions from working
Merge pull request #42 from timschofield/master

Fixes to javascript causing some functions not to run