Lightbox :/

I’m using a Lightbox on a local site. I’ve built a Gallery that allows a
user to upload images in a secure admin area. I have the Lightbox
working a treat but I do have one small issue - I’ve grouped the images
so the user can scroll through them when they open the Lightbox.

Code:

<%= link_to (scale_image_tag gallery.picture1, :width => 100, :height => 100, :rel => "lightbox[@gallery]", :alt => gallery.name), gallery.picture1.url, :rel => "lightbox[@gallery]", :title => gallery.name %>
<%= link_to gallery.name, gallery.picture1.url, :rel => "lightbox[@gallery]", :title => gallery.name %>

When the Lightbox opens, the image counter at the bottom isn’t correct
and I can’t seem to find the correct way to address this issue, please
help.

Problem solved but it has raised another question:

The Lightbox is displayed on an index page that, on refresh, generates a
random image. To do this, I simply added a new model method:

def self.random
self.find(:first, :conditions => “display=1 AND picture1_id IS NOT
NULL”, :order => “RAND()”)
end

Next, I added the code to the view by defining: <% gallery =
Gallery.random %>

Obviously, this removes the scrolling capability of the Lightbox as the
group only consists of one instance: the randomly generated image. My
question is: How can I display one random image but have the ability to
scroll through images when in the Lightbox?