Script: (too large, didn't want to paste it and clutter this, sorry.)
Well, for some reason $p is acting very very weird, the $p is set to 1 and should add 1 to itself when the 'next' button is pressed. Inversely should subtract 1 from $p when the 'prev' button is pressed.
There are also 2 nested 'if' statements to prevent it from ever going over the max number or pictures, or under the min number of pictures.
$p is the variable used to display the picture according to its ID type.
For some reason, it will work until you get to picture 3, when you hit next, the variable jumps to 2. When you hit previous on 2, it jumps to 3.
This is very confusing but we laughed when we tested it.
Thanks for the help in advance!