[#16] Fix various js errors, causing failing validation.

Fix various errors of various magnitudes, which caused a failure of
validation with JSLint. Ignored JSLint notifications of indented empty
lines, and combination of var statements.
Merge branch 'bug/16-js-validation' into develop