Vertically center layer within the user's viewable area on a long page
<p>I'm trying to vertically center a div in the viewable area on a very long page. The true vertical center of the page is well above the user's viewable area in this case.</p>

<p>I've added the scrollTop() length of the link the users clicks on to the formula which helps, but still places the div above the center of the viewable area.</p>

<p>Code excerpt:</p>

<pre><code>$('.' + layer).css({
    display:'block',
    left:( $(window).width() - $('.' + layer).width() )/2,
    top:( $(this).scrollTop() + $(window).height() - $('.' + layer).height() )/2 -20,
    position:'absolute'
});
</code></pre>
