Move javascript out of index file