Drastically simplified JavaScript

- added check for SCRIPT_DEBUG to load minified JavaScript in
non-development environments.