As a general point, I would remove the JavaScript to a seperate js file which is refered to in the head section of your HTML file using a <SCRIPT SRC="myscript.js" /> tag.
This adds a little more useful code / presentation seperation which improves your ability to test and may lead you to produce reusable code.