improved JS syntax, following JSLint
Merge pull request #101 from mfenner/jslint

Clean up Javascript code using JSLint