The photo at index 0 is never manipulated with the onTimer code. Why do you have the if there?

To make it loop, you will have to set currentPhoto back to 0 when it gets to randPhotos.length.