Thumbnail Scrollbar Loop?

For those who are familiar with the scrolling thumbnail gallery tutorial:

Can anyone provide me with some code on how to make the scrolling thumbnails loop infinitely? So that when you reach the last picture on the scrollbar, it will loop to the first picture?

A good example is

Thanks everyone!