<!DOCTYPE HTML>
<html>
<body style="height:2000px"><div style="position:fixed;border:1px dotted #000">moved:</div>
<script>
function scrollPoint( elem, point, callback ){
var dir=elem.scrollTop > point,
func = function(event){
if(dir ^ point < elem.scrollTop)callback.call(this, event, dir=!dir)
};
window.addEventListener ?
window.addEventListener('scroll', func ,false ) :
window.attachEvent('onscroll', func);
}
scrollPoint( document.documentElement, 1000, function(event,direction){
document.body.firstChild.innerHTML+=' | '+(direction?'down':'up')
})
</script>
</body>
</html>