Transferring JS from index.html to main.js

Transferring JS from index.html to main.js