As to fade in and out photos in portfolio

Hi, I am creating a portfolio section for a website with different galleries. The photos will be linked from numbers (1-8) at the top. what I would like to do is when a number is clicked, the current image fades out while the new one fades in. Since they can be clicked out of order I can’t do this all on the timeline. Im sure this is fairly basic, but I haven’t found anything on the boards or tutorials that handles this. Any help is much appreciated.

thanks