Centering an image in the viewport

Centering an image in the viewport

I have 50 thumbnails running vertically down the page, so that the viewer must scroll quite a bit  to see them all. When a thumbnail is clicked I want to display the full size image in the middle of the viewport. Thus, the top offset of the absolute div that displays the full size picture will change depending on how far down the viewer has scrolled. 

I can bind a function to the <img> tag that will set the top offset of the div where the full size images are displayed  but I don't know how to get the current position of the viewport, or how to position something with respect to the viewport. 

Can jQuery pull the viewport position out of the DOM and let me center something in it?

Thanks for any ideas.