Hey Troy,
First, you are right on with the repeat region, but you need to alter the name of the group based on sets of threes... so a little modulo operation will be needed along with a system to increment for each group.
<!-- First set the group increment number -->
<?php $groupincrement = 1; ?>
<!-- Now set the row increment number (after every third row will later increase the group increment number by 1) -->
<?php $rowincrement = 1; ?>
<!-- Now, begin the loop -->
<?php do { ?>
<a href="images/<?php echo $imagename; ?>" rel="lightbox[group<?php echo $groupincrement; ?>]"><?php echo $row_image['imagename']; ?></a>
<!-- We will now increase the row increment -->
<?php ++$rowincrement; ?>
<!-- We will now test the row to see if it is the third item and if it is, we will add an increment to the group -->
<?php if ($rowincrement % 3 == 0) {
++$groupincrement;
}
?>
<?php } while condition met ?>
Best regards,
Brian