XML photo gallery button questions?

I’ve been using the XML flash photo gallery on my site, it works great and it was easy to adapt to fit into my site’s layout.

There’s one little pet peve I have though, when you get to the end of the gallery, there’s still a “next” button there, and likewise at the beginning of the gallery there’s a “back” button… but in both of those cases those buttons don’t do anything because at the end there’s nothing next, and at the beginning there’s no previous frame. So, is there a way to hide those buttons when you’re on the first and last frame? Or better yet, just have it loop so if you press back on the first frame it takes you to the last, and then if you click next on the last frame, it takes you to the first?