Javascript essentially completed

I tried moving functions to the create.js file, but for some reason they
just won't work. all (presumably) moveable functions are now free of
php, so they can be moved to create.js (once I can figure out why).

Works fine now, just something to work on when tidying up
Merge pull request #189 from Align/graham-march-29

Javascript essentially completed