function $(id) {
	return document.getElementById(id);
}

function scrollwindow(delta) {
	window.scrollBy(0, -40*delta);
}

var scrollInt  = 10;
var scrollPart = 10;
var y = 0;

function checkheight() {
	var clientheight = (window.innerHeight) ? window.innerHeight : (document.body && document.body.offsetHeight) ? document.body.offsetHeight : undefined;
	if(typeof clientheight == "undefined") return false;
	var menuheight = ($("menumain").innerHeight) ? $("menumain").innerHeight : ($("menumain").offsetHeight) ? $("menumain").offsetHeight : undefined;
	if(typeof menuheight == "undefined") return false;
	return menuheight < clientheight;
}

function getY() {
	if(!checkheight()) return 0;
	else return (document.body.scrollTop ? document.body.scrollTop : window.pageYOffset ? window.pageYOffset : 0);
}

function scrollmenu(){
	if(!$("scrollspace")) return false;
	if(!$("menumain")) return false;
	currY = y;
	y     = (getY() - currY) / scrollPart;
	y     = (y > 0) ? Math.ceil(y) : Math.floor(y);
	y    += currY;
	if(y != currY) $("scrollspace").style.height = (1 + y) + "px";
}

setInterval("scrollmenu()", scrollInt);


