You're adding properties to the global object here. I'd recommend wrapping the code in an "auto-calling" anonymous function.