Fixed a load of Javascript syntax errors found with jshint.