Managing lightboxes and the content within them
===

I want to find a better way of managing lightboxes with JS. I'm working in a Rails environment.

I usually put the HTML for lightboxes in my Rails application layout file, then I would simply use JS to show / hide these lightboxes when needed - this is very static. Sometimes I would use jQuery to create the lightbox and the content within it on the fly and then show and hide that, very messy.

Should I be using JS templates for this? I think I want to have several templates that contain different content for lightboxes - with the ability to output variables in these templates.

What's the best way to maintain several lightboxes of different widths / heights and content?