move javascript out of index.hmtl into main.js