This is done with javascript. On the pics array you need to add the name of each picture of your gallery.
<script type="text/javascript">
pics = new Array();
pics[0]= 'pic0.jpg';
pics[1]= 'sun.bmp';
pics[2]= 'banner.png';
pics[3]= 'transparent.gif';
pics[4]= 'logo.png';
currentpic = 0;
function shownext(){
nextpic=currentpic+1;
if (nextpic==pics.length){nextpic=0;}
document.getElementById('collection').src=pics[nextpic];
currentpic=nextpic;}
</script>
<img id="collection" src="pic0.jpg" onclick="shownext();" />