I tried to recreate Mashables ‘next page’ widget, where a message would scroll in when you reach the bottom of the article.
I use jQuery to find the offset of the target (an element after the article). Every time the ‘$(window).scroll()’ event is fired compare the values between my offset and the window ‘scrolltop()’. There are a few notes about fluid layouts and accounting for window height but the shell is there.
Maybe that could help?