Update javascript/main.js

Pasted working branch over master on github website (using a friends computer since my macbook will not charge and smartgit and all other work on mac charger should be in mail real soon)