
var Popup_ns6 = document.getElementById && !document.all;

// get the true offset of anything on NS4, IE4/5 & NS6, even if it's in a table!
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 ShowPopup(x, y, arr, params)
{
	var PopupContainer = getObj("PopupContainer");
	PopupContainer.style.left = x;
	PopupContainer.style.top = y;

	contextPath = params[1];      

	var html = "<TABLE cellSpacing=0 cellPadding=5 width=200 border=0>";
	html +="<tr>";

//	html += "<TR><TD colSpan=3><IMG height=11 src='images/encadre_haut.gif' width=200></TD></TR>";
//    html += "<TR><TD width=11 background=images/encadre_bord.gif>&nbsp;</TD>"

	html += "<TD width=164 background=" + contextPath + "/images/encadre_main.gif>";

	for(var i=0; i<arr.length/2; i++)	
	{
	        if(params[0] == arr[i*2]) {
			html += "<IMG height=10 hspace=2 src='" + contextPath + "/images/encadre-fleche03.gif' width=10 align=absMiddle>";
			html += "<span class=encadre02>" + arr[i*2+1] + "</span>";
		}
		else {
			html += "<IMG height=10 hspace=2 src='" + contextPath + "/images/encadre-fleche01.gif' width=10 align=absMiddle>";
			html += "<a href='" + arr[i*2] + "'>" + arr[i*2+1] + "</a>";
		}
		if(i != (arr.length/2)-1)
			html += "<IMG src='" + contextPath + "/images/encadre_separateur.gif'><BR>";
	}

	html += "</TD>";
//	html += "<TD width=11 background=images/encadre_bord.gif>&nbsp;</TD></TR>";
//	html += "<TR><TD colSpan=3><IMG height=11 src='images/encadre_bas.gif' width=200></TD>";

	html +="</tr>";

	html += "</table>";

	PopupContainer.innerHTML = html;
	PopupContainer.style.display = '';
}

function HidePopup()
{
	var PopupContainer = getObj("PopupContainer");
	PopupContainer.style.display = 'none';
}

function Popup(url, target)
{
	window.open(url, target);
}

/*function Popup(url, target, width, height, resizable)
{
	if(width && height)
	{
		var left = (screen.width - width) / 2;
		var top = (screen.height - height) / 2;
	}
	
	var poptions = "";
	if(left) poptions += "left=" + left + ":px";

	if(top) {
		if(poptions != "") poptions += ", ";
		poptions += "top=" + top + ":px";
	}

	if(width && width!="")
	{	
		if(poptions != "") poptions += ", ";
		poptions += "width=" + width + ":px";
	}
	if(height && height!="")
	{	
		if(poptions != "") poptions += ", ";
		poptions += "height=" + height + ":px";
	}	

	if(resizable==true || resizable==false)
	{
		if(poptions != "") poptions += ", ";
		poptions += "resizable=" + (resizable==true?"yes":"no");
	}
	else
	{
		if(poptions != "") poptions += ", ";
		poptions += "resizable=yes";
	}

	if(width!="" && height!="")
	{
		if(poptions != "") poptions += ", ";
		poptions += "location=no, menubar=no, status=no, toolbar=no";
	}
	
	if(poptions != "") poptions += ", ";	
	poptions += "scrollbars=yes";

  	window.open(url, target, poptions);
}*/

function contains_ns6(a, b)
{
	while (b.parentNode)
		if ((b = b.parentNode) == a)
			return true;
		return false;
}

function CheckHiding(o, e)
{
	if(Popup_ns6)
		return !contains_ns6(o, e.relatedTarget);
	else
		return !o.contains(e.toElement);
}

