3
First problem is the html 'body' tag, you've already got one in your theme, putting it in a block as well means there will be two body tags on your page.
Next, all your html tags are not closed... maybe you haven't posted the whole code?
I'm no javascript expert, but it looks like this code relies on there being only one form on your page... or that this form is the first one. Is that the case on the page you are trying to place this block?
I suggest you try including the javascript in your theme. Then you can use the theme's html body "onLoad" element.