var menuTopMargin		= 0;
var menuSpeed			= 15;
var timerSpeed			= 200;
var timer	;
var heightLimit				= 0;
var crossobj				= document.getElementById? document.getElementById("sMenu") : document.all["sMenu"]
var MainTable				= document.getElementById? document.getElementById("MainTable") : document.all["MainTable"]

if(document.body.clientWidth < MainTable.clientWidth){
	crossobj.style.left		= 2
}else{
	crossobj.style.left		= document.body.clientWidth/2 + (800/2-15)
}

if(document.body.clientHeight < MainTable.clientHeight){
	menuTopMargin		= -(400)
}else{
	menuTopMargin		= -(MainTable.clientHeight - 60)
}


function checkMenu() {
	if(document.body.offsetHeight > heightLimit) {
		var reTimer = timerSpeed;
		var startPoint = parseInt(crossobj.style.top,10);
		var endPoint = document.body.scrollTop;
		endPoint = (menuTopMargin <= endPoint ) ? endPoint - menuTopMargin : 0;
		if(startPoint != endPoint) {
			moveAmount = Math.ceil(Math.abs(endPoint - startPoint) / 15);
			crossobj.style.top = parseInt(crossobj.style.top,10) + ((endPoint<startPoint) ? -moveAmount : moveAmount);
			
			reTimer = menuSpeed;
		}
	} else crossobj.style.top = 0;
	timer = setTimeout("checkMenu();",reTimer);
}
function initMenu() {	
	if(document.body.offsetHeight > heightLimit) crossobj.style.top = parseInt(document.body.scrollTop);
	checkMenu();
}
initMenu();