Here's what I came up with. Hope it helps!
Note that I changed window.onload = initialize
to $(function () { initialize() });
and included jQuery, but that was only to make it work in http://jsfiddle.net/. Should do just fine without it outside jsfiddle.
var speed = 1
var currentpos = 0,
alt = 1,
curpos1 = 0,
curpos2 = -1
interval = 0,
pauseTime = 3000;
function initialize() {
startit()
}
function iecompattest() {
return (document.compatMode != "BackCompat") ? document.documentElement : document.body
}
function scrollwindow() {
var docHeight = getDocHeight();
var iHeight = window.innerHeight;
var off = docHeight - iHeight;
if (currentpos > off) {
window.clearInterval(interval);
setTimeout(startit, pauseTime);
} else {
if (document.all) temp = iecompattest().scrollTop
else temp = window.pageYOffset
if (alt == 0) alt = 1
else alt = 0
if (alt == 0) curpos1 = temp
else curpos2 = temp
if (curpos1 != curpos2) {
if (document.all) currentpos = iecompattest().scrollTop + speed
else currentpos = window.pageYOffset + speed
window.scroll(0, currentpos)
} else {
currentpos = 0
window.scroll(0, currentpos)
}
}
}
function getDocHeight() {
var D = document;
return Math.max(
D.body.scrollHeight, D.documentElement.scrollHeight,
D.body.offsetHeight, D.documentElement.offsetHeight,
D.body.clientHeight, D.documentElement.clientHeight);
}
function startit() {
currentpos = 0;
interval = setInterval(scrollwindow, 15);
}
$(function () {
initialize();
});