Changing js file scope

For now, things are global. At the end, we'll combine all scripts into
a singleton, and minify it.