Javascript below fold


I have more than 100 items in a page. In page load 18 images will be loaded. The remaining images needs to be displayed when user scroll down to the end of the page by invoking an AJAX call. But i am not sure how to find out whether its the end of the page or not. Can someone please let me know how to do it in javascript with sample script?