How to center a popup at the end of page (scrolled down max)

How to center a popup at the end of page (scrolled down max)

Hi guy!

Before we start, I'll mention that I followed this tutorial :
http://yensdesign.com/2008/09/how-to-cr ... ng-jquery/

So if you want to know my code, this is what I'm using!

The problem is with this code... the popup does not pop at the end of a page where I call it. For example, I have a page with a height of... lets say 4000px. Yes, ok my browser have a 800px height... but my page don't and I have a scroll bar to go at the end.

I just don't know how to code so that the popup get centered exactly where my browser is in the page.

I know this is the problem :
$("#popupContact").css({
       "position": "absolute",
       "top": windowHeight/2-popupHeight/2,
       "left": windowWidth/2-popupWidth/2
});


I should have something like this I guess: This pop my message not where I am at 4000px down but it pop it about 400px at the top of the page...
$("#popupContact").css({
       "position": "absolute",
       "top": currentLocationInPageHeight/2-popupHeight/2,
       "left": currentLocationInPageWidth/2-popupWidth/2
});


Help me please!