var ini = 0
var offsetx = 8
var offsety = 12
var ie  = document.all
var ns6 = document.getElementById && !document.all
var enabletip = false
var contentObj, contentTxt

function ce(x) {
	return document.createElement(x);
}

function InitTip()
{
	var d = ce("div"), t=ce("table"), tb=ce("tbody"), tr1=ce("tr"), tr2=ce("tr"), td=ce("td"), th1=ce("th"), th2=ce("th"), th3=ce("th");

	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);

	contentObj = d
	contentTxt = td
	ini = 1
}

function ietruebody()
{
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function positiontip(e)
{
	if (enabletip) {
		var curX = (ns6) ? e.pageX : event.x + ietruebody().scrollLeft;
		var curY = (ns6) ? e.pageY : event.y + ietruebody().scrollTop;

		var distX = ie && !window.opera ? ietruebody().clientWidth  - event.clientX-offsetx : window.innerWidth  - e.clientX-offsetx-20
		var distY = ie && !window.opera ? ietruebody().clientHeight - event.clientY-offsety : window.innerHeight - e.clientY-offsety-20

		if (distX < contentObj.offsetWidth) {
			if (curX+offsetx-contentObj.offsetWidth < 0)
			  contentObj.style.left = "0px"
			else
			  contentObj.style.left = curX-10-contentObj.offsetWidth+"px"
		} else {
			contentObj.style.left = curX+offsetx+"px"
		}

		if (distY < contentObj.offsetHeight) {
			if (curY > contentObj.offsetHeight)
			  contentObj.style.top = curY-10-contentObj.offsetHeight+"px"
			else
			  contentObj.style.top = curY+offsety+distY-contentObj.offsetHeight+"px"
		} else {
			contentObj.style.top = curY+offsety+"px"
		}

	}
}

function ShowProf(nom, serv)
{
	window.open("http://lootup.rouks.net/win_profile.php?nom="+nom+"&serv="+serv,"profwin","height=450,width=392,left=80,top=80,alwaysRaised=1,resizable=0,scrollbars=0,status=0");
}

function ShowTip(msg, larg)
{
	if (!ini) InitTip()
	if (!larg) larg=250

	contentTxt.innerHTML=msg
	contentTxt.style.width=larg+"px"
	enabletip=true
	contentObj.style.visibility="visible"
	return false
}

function HideTip()
{
	enabletip = false
	contentObj.style.visibility = "hidden"
	contentObj.style.left = "-1000px"
}

if (!ini) {
	document.onmousemove=positiontip
}
