Major overhaul of jsmaze4.

Basically make this work on window load.