For Loop + Lightbox

For Loop + Lightbox

I have the following code located in a for loop with over 10 entries:

  1. var p_photos = $("<p>").addClass("photos").appendTo(div);
  2. var span_photo = $("<span>").text("Picture Gallery: ").appendTo(p_photos);
  3.            
  4. var a_photo = $("<a>").attr("href", "img/fs/1.jpg").text("Click For Image Reel!").appendTo(span_photo);
  5. $("<a>").attr("href", "img/fs/2.jpg").appendTo(span_photo);
  6. $("<a>").attr("href", "img/fs/3.jpg").appendTo(span_photo);
  7.            
  8. $('p.photos span a').lightBox({fixedNavigation:true});

I am using this Lightbox: http://leandrovieira.com/projects/jquery/lightbox/

What is happening is that each entry has 3 pictures associated with it and therefore, all 3 are being appended to one another during each loop.  It is making it so that the Lightbox popup has 30 pictures, when it should only have 3.

How can I work around this?

Thanks!