javascript: minimize number of global objects (module pattern)