var PosP;
PosP=2;
function findPosX(obj){
	var curleft = 0;
       // p=document.getElementById("header");
	if (obj.offsetParent){
                PosI=0
		while (obj.offsetParent){
 			if ( PosI>=PosP) break;
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
 			PosI+=1;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;//-p.offsetLeft ;//- ietruebody().scrollLeft;// - getLeft();
}



function findPosY(obj){
	var curtop = 0;
	if (obj.offsetParent){
		PosI=0
		while (obj.offsetParent){
 			if ( PosI>=PosP) break;
			curtop += obj.offsetTop
			obj = obj.offsetParent;
 			PosI+=1;
		}
	} else if (obj.y){
		curtop += obj.y;
	}
	return curtop // - getTop();
}
function getTop() {
	return typeof window.pageYOffset != 'undefined' ? window.pageYOffset:ietruebody().scrollTop;
}
function getLeft() {
	return (typeof window.pageXOffset != 'undefined' ?  window.pageXOffset:ietruebody().scrollLeft)
}

//


function getOffsetTop (el, p) {
    var _t = el.offsetTop;
    while (el = el.offsetParent) {
        if (el == p) break;
        _t += el.offsetTop;
    }

    return _t;
};
function getOffsetLeft (el, p) {
    var _l = el.offsetLeft;
    while (el = el.offsetParent) {
        if (el == p) break;
        _l += el.offsetLeft;
    }

    return _l;
};
var tt;
var curMenu;
function mouseover (id, menu) {
    if (tt) clearTimeout(tt);
    displayMenu(false);
    menu = document.getElementById('menu' + menu);
    th=document.getElementById(id);
    //menu.style.left =  (th.offsetLeft )+'px';
   // menu.style.top = (th.offsetHeight+13) + 'px';
   // menu.style.left =  (findPosX(th) + getLeft(); )+'px';
   // menu.style.top = (findPosY(th) + getTop()+13) + 'px';
	var left  = findPosX(th);//th.offsetLeft ;//findPosX(th)-10;
	var top   = findPosY(th) + 35;//th.offsetHeight+2;//findPosY(th) + 22;
   menu.style.left =  (left)+'px';
   menu.style.top = (top) + 'px';
    curMenu = menu;
    displayMenu(true);
}
function mouseout () {
    tt = setTimeout('displayMenu(false)', 200);
}
function _mouseover () {
    if (tt) clearTimeout(tt);
    displayMenu(true);
}
function _mouseout () {
    displayMenu(false);
}
function displayMenu (display) {
    if (curMenu) {
        curMenu.style.display = display ? 'block' : 'none';
    }
}