var FloatMenuY, fmOffset, fmHeight;
function FloatMenu() {
	var vTop=true; // vTop menu position: true=top, false=bottom
	var menuOffset=1; // menu's 'scrolling' top-edge clearance from window edge
	var d=document, bType, bMenu, fM, pgY, fObj, fmY, bFMy, bFM="belowFloatMenu";
	fmY = findPos("divFloatPage").y;
	FloatMenuY = findPos("FloatStartPoint").y - fmY;
	bFMy = (findPos("belowFloatMenu").y - fmY) - FloatMenuY;
	fObj = (d.getElementById)? d.getElementById(bFM).style
	 : (d.all)? d.all[bFM].style : (d.layers)? d.layers[bFM] : null;
	fObj.marginTop = bFMy + "px";
	bType = (d.layers)? "layerFloatMenu" : "divFloatMenu";
	bMenu = (d.getElementById)? d.getElementById(bType)
	 : (d.all)? d.all[bType] : (d.layers)? d.layers[bType] : null;
	if (!d.layers) bMenu.style.position = "absolute";	
	function m() {
		fM = bMenu;
		if (d.layers) fM.style = fM;
		fM.sP = function(y) {this.style.top = y + "px";};
		fmOffsetHeight();
		if (vTop == true) fM.y = fmY;
		else fM.y = fmOffset + fmHeight - fmY;
		return fM;
	}
	window.vFM = function() {
		fmOffsetHeight();
		if (vTop == true) pgY = fmOffset;
		else pgY = fmOffset + fmHeight;
		if (FloatMenuY + fmY > pgY && vTop) fObj.y = FloatMenuY;
		else fObj.y += (pgY + menuOffset - fmY - fObj.y) / 5;
		fObj.sP(fObj.y);
		setTimeout("vFM()", 50);
	}
	fObj = m();
	vFM();
}
function fmOffsetHeight() {
	var nn = (navigator.appName.indexOf("Netscape") != -1);
	if (document.documentElement.scrollTop) {
		fmOffset = document.documentElement.scrollTop;
	} else if (document.body.parentNode.scrollTop) {
		fmOffset = document.body.parentNode.scrollTop;
	} else if (document.body.scrollTop) {
		fmOffset = document.body.scrollTop;
	} else if (window.pageYOffset) {
		fmOffset = window.pageYOffset;
	} else if (nn) {
		fmOffset = pageYOffset;
	} else {
		fmOffset = 0;
	}
	if (document.documentElement.clientHeight) {
		fmHeight = document.documentElement.clientHeight;
	} else if (document.body.parentNode.clientHeight) {
		fmHeight = document.body.parentNode.clientHeight;
	} else if (document.body.clientHeight) {
		fmHeight = document.body.clientHeight;
	} else if (window.innerWidth) {
		fmHeight = window.innerHeight;
	} else if (nn) {
		fmHeight = innerHeight;
	}
}
function findPos(id) {
	var objx, objy, x=0, y=0, t, d=document, coord=new Object();
 	objx = objy = (d.getElementById)? d.getElementById(id) : (d.all)? d.all[id] : null;
	if (objx == null || !objx.offsetParent) return null;
	t = true;
	while (t) {
		x += objx.offsetLeft;
		if (!objx.offsetParent) t = false;
		objx = objx.offsetParent;
	}
	t = true;
	while (t) {
		y += objy.offsetTop;
		if (!objy.offsetParent) t = false;
		objy = objy.offsetParent;
	}
	coord.x = x;
	coord.y = y;
	return coord;
}
