I would like to do something similar to what live.com's image search does. As you get near the end of the images it pulls back more data and adds it to the view.

I was planning to grab the document height, window height and scroll offset to determine when you get close to the end but I'm having some difficulty getting this to work on the major browsers consistently. Is my method the proper way to do this? Is there a more refined approach to do this using the framework other than to get all three values on the onScroll or onResize event and calculate where the client is?