Move index.html JS into a file.
Clean up format of JS.

Fix indentation and spacing.
Clean up HTML indentation/format a tiny bit.