Cleanup JS indentation and fix global

This is why using a single `var ` declaration with commas can bite you! ;-)
Merge pull request #1 from tofumatt/cleanup-js

Cleanup JS indentation and fix global