Added comments

Tried to make an external Javascript to reduce repetition, but will have
to wait a bit later (I can probably try to document.write() the whole
thing if I try again).