$(window).scroll(function () {
if ($(window).scrollTop() >= $(document).height() - $(window).height() - 10) {
alert('end of page');
}
});
-10 indicates how far away from end of page user must be before function executes. This gives you the flexibility to adjust the behavior as needed.
Check working example at http://jsfiddle.net/wQfMx/