Here's a question and answer for this: Difference between screen.availHeight and window.height()
Has pics too, so you can actually see the differences. Hope this helps.
Basically, $(window).height()
give you the maximum height inside of the browser window (viewport), and$(document).height()
gives you the height of the document inside of the browser. Most of the time, they will be exactly the same, even with scrollbars.