So what is your question? Simply posting a bunch of unformatted code isn't going to get you much help.
Also, please be sure to use code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please
read this for more information. You can go back and change your post to add code tags by clicking the
button on your post.
And finally, as this is a JavaScript, not a JSP question, it has been moved to a more appropriate forum.