﻿function show(aObj){
    clearTimeout(aObj.timeSpan);	               	
	var x =  aObj.getBoundingClientRect().right;
	var y =  aObj.offsetTop;
	var sObj = aObj;
    while(sObj = sObj.offsetParent){     
        y += sObj.offsetTop;     
    }
    var menu = document.getElementById(aObj.id + "_menu");     
    menu.style.display = "block";
    menu.style.left = x + "px";
    if (y + menu.offsetHeight > document.body.clientHeight)
        menu.style.top = y - menu.offsetHeight + aObj.offsetHeight + "px";
    else
        menu.style.top = y + "px";
	menu.onmouseout = aObj.onmouseout = function(){
        aObj.timeSpan = setTimeout("hide('"+aObj.id+"')",200);
    }
    menu.onmouseover = function (){clearTimeout(aObj.timeSpan);}        	
}
function hide(id){
    document.getElementById(id).style.backgroundColor = "";
    document.getElementById(id + "_menu").style.display = "none";
}