Moved javascript out of index.html file