For reasons on why jquery over prototype, here's a few thoughts.
- jquery is now the default Js library for rails 3+ and it replaced the prototype/scriptaculous libraries
- jquery is engineered to be unobtrusive, meaning it doesn't put your JS code inline; you use proper markup in your HTML file and give proper IDs, classes, and tags to your HTML code so that you can "hook" into it with your jquery code in a separate JS file (I'm not sure if prototype is really unobtrusive or not; I've been using jquery for a few years and haven't touched prototype since)
- jquery is very simple to learn and use. This is somewhat subjective, but I found jquery's syntax to be extremely simple. Anything you want to do you probably can in jquery.
- Jquery also has a very extensive plugin base with a large number of contributors. Makes finding solutions to common problems much easier than writing them all on your own.
- Jquery also has Jquery UI, which presents a toolbox of graphical elements to use for your interfaces and front-end (they incidentally have a modal widget, which you could use for your original problem).
Just a few thoughts on jquery. I highly recommend looking into it. The jquery site (jquery.com) has some excellent basic tutorials to help slide you into it. And coreyward did an excellent job of explaining the solution. I do something similar but picked up a few tips myself.