Remove JavaScript variables from global namespace

As these variables were being assigned without being explicitly
declared, they were implicitly added to the global namespace.

This commit removes 41 variables from the global namespace.
Remove superfluous whitespace
Remove commented window.alerts
Remove commented code
Remove obvious comments
Remove commented hacks
Avoid use of Array/Object constructors