Fix pre&next order of images in multi galleries. 

Fix the problem that if there are 2 "<div class='gallery'>" tags, the first image in the second gallery is the "next" image of the last image in the first gallery, but its "previous" image is the last image in the second gallery.