
var __ns6__ = document.getElementById && !document.all;

function getAbsX(elt) { return (elt.x) ? elt.x : getAbsPos(elt,"Left"); }

function getAbsY(elt) { return (elt.y) ? elt.y : getAbsPos(elt,"Top"); }

function getAbsPos(elt,which) {
 iPos = 0;
 while (elt != null) {
  iPos += elt["offset" + which];
  elt = elt.offsetParent;
 }
 return iPos;
}

function getObj(name)
{
	if(document.all) return document.all[name]; // IE4+ 
	if(document.getElementById) return document.getElementById(name); // IE5+, NS6
}

function contains_ns6(a, b)
{
	while (b.parentNode)
		if ((b = b.parentNode) == a)
			return true;
		return false;
}

// x : left
// y : top
// items : array [ id, text, id, text, ..., ... ]
function ShowPopup(x, y, items)
{
/*alert(x);
alert(y);
alert(items);*/

	var PopupContainer = getObj("PopupContainer");
	PopupContainer.style.left = x;
	PopupContainer.style.top = y + 15;

	var html = "<table border='1' cellpadding='3' cellspacing='0' bordercolor='#666666' bgcolor='#000000'>"
	for(var i=0; i<items.length/2; i++)
	{
        html += "<tr><td nowrap>&nbsp;<a class='lien' href='" + items[i*2] + "'>" + items[i*2+1] + "</a></td></tr>";
	}
	html += "</table>";

	PopupContainer.innerHTML = html;
	PopupContainer.style.visibility = 'visible';
}

function HidePopup()
{
	getObj("PopupContainer").style.visibility = 'hidden';
}

function CanHidePopup(o, e)
{
	if(__ns6__)
		return !contains_ns6(o, e.relatedTarget);
	else
		return !o.contains(e.toElement);
}

function Popup(url)
{
	window.open(url, "", "");
}



