I am trying to make an image gallery that basically has 3 divs:

1 - a div with a list of "albums"

2 - a div where the images appear

3 - a div with previous/next links to click through the images in an album

I'm building a site with (hopefully) only one real page, so I want all this to happen within divs, but I'm not sure how to make the 3rd div function properly.
Here's what should happen:
When you click a link from the list in div 1, the first image of that album appears in div 2. Div 3 can then be used to click between the next and previous images in that album. When you click on a different link from the list in div 1, it's first image appears in div 2, and div 3 now controls just that album's images, not all the images from all albums.
The 3rd div is the part I don't know how to do / don't know if it's possible.

Any ideas?