Despite having syntax highlighting, there must be something seriously wrong in here, because on the second function, I got an error saying there was a missing curly brace even when there was one. So I added a second one, which resulted in a complaint about a missing end brace. After adding a second brace, the error went away, so now I'm stuck with a rather rediculous double-bracketed function.
Note that the alert() is there because I was using it to debug to see if the function was even being called at all. It looks like it isn't, although considering that I have to put two brackets around it to avoid errors, that's not surprising.
I've been puzzling over this code for 2 and a half days now, and I'm ready to call it quits again. Can someone help?