function getElementLeftPosition(elemID) {
    var offsetTrail = document.getElementById(elemID);
    var offsetLeft = 0;
    while (offsetTrail) {
        offsetLeft += offsetTrail.offsetLeft;
        offsetTrail = offsetTrail.offsetParent;
    }
    if (navigator.userAgent.indexOf("Mac") != -1 && 
        typeof document.body.leftMargin != "undefined") {
        offsetLeft += document.body.leftMargin;
    }
	return offsetLeft;
}

function getElementTopPosition(elemID) {
    var offsetTrail = document.getElementById(elemID);
    var offsetTop = 0;
    while (offsetTrail) {
        offsetTop += offsetTrail.offsetTop;
        offsetTrail = offsetTrail.offsetParent;
    }
    if (navigator.userAgent.indexOf("Mac") != -1 && 
        typeof document.body.leftMargin != "undefined") {
        offsetTop += document.body.topMargin;
    }
	return offsetTop;
}


function positionmenu(appelant, cible, largeurAppelant, largeurCible, hauteurCible){

	var appelant =  document.getElementById(appelant);
	var cible =  document.getElementById(cible);
	//alert(appelant.offsetHeight);
	appelant.style.left = getElementLeftPosition(cible.id) - largeurAppelant + largeurCible + "px";
	appelant.style.top = (getElementTopPosition(cible.id) - appelant.offsetHeight + cible.offsetHeight) +"px";
	//alert(hauteurCible);
	//else if (position == "droite"){
	//cible.style.left = getElementLeftPosition(appelant.obj.id) + appelant.obj.offsetWidth - 3 +"px";
	//cible.style.top = getElementTopPosition(appelant.obj.id) + 3 +"px";

}