XML gallery help

Hello,
I used one of the XML photo gallery tuts on kirupa and tweaked it a little to come up with the attached. I have one problem though…I want to make it so I can have multiple pages of thumbnails, so after the 16 load, it has logic to “know when” to make another page of 16 thumbs or however many are left over…Can anybody help? I’m not much of a programmer, so you’ll have to bear with me…:slight_smile: