
var poploot = {
	ini:0,
	offsetx:8,
	offsety:12,
	ie:document.all,
	ns6:(document.getElementById && !document.all),
	enabletip:false,

	contentObj:'',
	contentTxt:''
}

function InitTip()
{
	var d = $cE("div"), t=$cE("table"), tb=$cE("tbody"), tr1=$cE("tr"), tr2=$cE("tr"), td=$cE("td"), th1=$cE("td"), th2=$cE("td"), th3=$cE("td");

	d.className="wttip";
	d.style.visibility = "hidden"
	d.style.position = "absolute"
	d.style.zIndex = 9999;

	t.cellSpacing=0;
	t.cellPadding=0;
	th1.style.backgroundPosition="top right";
	th2.style.backgroundPosition="bottom left";
	th3.style.backgroundPosition="bottom right";

	tr1.appendChild(td);
	tr1.appendChild(th1);
	tb.appendChild(tr1);
	tr2.appendChild(th2);
	tr2.appendChild(th3);
	tb.appendChild(tr2);
	t.appendChild(tb);
	d.appendChild(t);
	document.body.appendChild(d);

	poploot.contentObj = d;
	poploot.contentTxt = td;
	poploot.ini = 1
}

function ietruebody()
{
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ShowTip(msg, larg)
{
	if (!poploot.ini) InitTip()
	if (!larg) larg=250

	poploot.contentTxt.innerHTML=msg
	poploot.contentTxt.style.width=larg+"px"
	poploot.enabletip=true
	poploot.contentObj.style.visibility="visible"
	return false
}

function positiontip(e)
{
	if (poploot.enabletip) {
		var curX = (poploot.ns6) ? e.pageX : event.x + ietruebody().scrollLeft;
		var curY = (poploot.ns6) ? e.pageY : event.y + ietruebody().scrollTop;

		var distX = poploot.ie && !window.opera ? ietruebody().clientWidth  - event.clientX-poploot.offsetx : window.innerWidth  - e.clientX-poploot.offsetx-20
		var distY = poploot.ie && !window.opera ? ietruebody().clientHeight - event.clientY-poploot.offsety : window.innerHeight - e.clientY-poploot.offsety-20

		if (distX < poploot.contentObj.offsetWidth) {
			if (curX+poploot.offsetx-poploot.contentObj.offsetWidth < 0)
			  poploot.contentObj.style.left = "0px"
			else
			  poploot.contentObj.style.left = curX-10-poploot.contentObj.offsetWidth+"px"
		} else {
			poploot.contentObj.style.left = curX+poploot.offsetx+"px"
		}

		if (distY < poploot.contentObj.offsetHeight) {
			if (curY > poploot.contentObj.offsetHeight)
			  poploot.contentObj.style.top = curY-10-poploot.contentObj.offsetHeight+"px"
			else
			  poploot.contentObj.style.top = curY+poploot.offsety+distY-poploot.contentObj.offsetHeight+"px"
		} else {
			poploot.contentObj.style.top = curY+poploot.offsety+"px"
		}

	}
}

function HideTip()
{
	poploot.enabletip = false
	poploot.contentObj.style.visibility = "hidden"
	poploot.contentObj.style.left = "-1000px"
}

function ShowProf(nom, serv)
{
	window.open("http://www.poploot.com/win_profile.php?nom="+escape(nom)+"&serv="+escape(serv),"profwin","height=450,width=392,left=80,top=80,alwaysRaised=1,resizable=0,scrollbars=0,status=0");
}

if (!poploot.ini) {
	Event.observe(document,'mousemove',positiontip);
}

