
function init() {
	checkYPos();
}

var pypos = 0;
function checkYPos() {
	var ypos = getWinPos();
	if (ypos != pypos) {
		pypos = ypos;
		moveBox();
	}
	setTimeout('checkYPos()', 500);
}

var cypos = 0;
function moveBox() {
	if (Math.abs(pypos - cypos) > 1) {
		cypos += (pypos - cypos)/10;
		getElm('box').style.top = Math.round(cypos+247)+'px';
		setTimeout('moveBox()', 20);
	} else {
		cypos = pypos;
	}
}

function getElm(id) {
	if (document.getElementById)
		return document.getElementById(id)
	else if (document.all)
		return document.all[id]
	else
		return null;
}

function getWinPos() {
	var winY;
	if (window.innerHeight) 
		winY = window.pageYOffset
	else if (document.documentElement && document.documentElement.scrollTop)
		winY = document.documentElement.scrollTop
	else if (document.body)
		winY = document.body.scrollTop;
	return winY;
}

if (window.addEventListener)
	window.addEventListener("load", init, false)
else if (window.attachEvent)
	window.attachEvent("onload", init)
else
	window.onload = init;

