Don't use global functions.
Don't execute html-modifying code right away, execute it with onload event.