moved JS code out of index page