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.

Additional cleanup:
- Remove superfluous whitespace/newlines
- Remove commented window.alerts
- Remove commented code
- Remove obvious comments, obviously
- Remove commented hacks
- Avoid use of Array/Object constructors

Note: This file contains a mix of hard and soft tabs. All additions use the standard 4-space soft tab, per the style guide.
Fixed.