i dont follow, it looks like the gallery repeat region is here:
<?php
while(!$Gallery->atEnd()) {
?>
<div class="sp"> <img src="images/gallery/<?php echo($Gallery->getColumnVal("GalleryImage")); ?>" width="500"> </div>
<?php
$Gallery->moveNext();
}
$Gallery->moveFirst(); //return RS to first record
?>
add the code for counter loop there.