Changed index.js to main.js

Cut contents of index.js to main.js and added a <script> to all pages
with link to main.js