Sammy, i think the possibility is that you have multiple images with the same value for albumid. So when you trigger the click for prettyPhoto all of them gets clicked.
$('div#album_'+albumId).find('a[albumid="'+albumId+'"]:eq(0)').trigger('click');
OR
$('div#album_'+albumId).find('a[albumid="'+albumId+'"]:first').trigger('click');
Enjoy....