// Scripts des bulles d'aide
// Copyright Frank Milard - http://www.asaisir.com/a-la-page
// Vous pouvez utiliser ou modifier ce script librement
// sous reserve de laisser le copyright visible

// Puis modifié par Gilles

IE4 = (document.all) ? 1 : 0;
NS4 = (document.layers) ? 1 : 0;
VERSION4 = (IE4 | NS4) ? 1 : 0;

if (!VERSION4) event = null;

function EffBulleMsg ()
{
	if (IE4) document.all.BulleMsg.style.visibility = "hidden";
	if (NS4) document.BulleMsg.visibility = "hidden";
}

// Abrère les messages
var longmoy=250;
function Abrege (texte)
{
	texte2 = texte.replace(/<br>/g, "####");
	if (texte2.indexOf('<')==-1 && texte2.length>longmoy+50)
	{
		lm=longmoy;
		while (texte2.substr(lm,1)=="#") lm++;
		texte=texte.substr(0,lm);
		texte=texte+'<font color=red>... <small><small>(ouvrir le message pour lire la suite)</small></small></font>';
	}
	return (texte);
}

function AffBulleMsg (event, texte)
{
	if (!VERSION4) return;

	var ptrObj, ptrLayer;
	if (IE4) {
		ptrObj = event.srcElement;
		ptrLayer = document.all.BulleMsg;
	}
	if (NS4) {
		ptrObj = event.target;
		ptrLayer = document.BulleMsg;
	}

	if (!ptrObj.onmouseout) ptrObj.onmouseout = EffBulleMsg;

	texte=Abrege(texte);

	var str = '<DIV CLASS="BulleMsgDIV">'+texte+'</DIV>';
	if (IE4) {
		// Place le texte
		ptrLayer.innerHTML = str;
		// Positionne la bulle sous l'objet désigné
		if (ptrObj.name=='tf') decal=50; else decal=0;	//Décalage si l'objet=tf, soit un lien forum
		ptrLayer.style.top = ptrObj.offsetTop + ptrObj.offsetHeight + 2 + decal;
		// Positionne la bulle horizontalement
		ptrLayer.style.left = ptrObj.offsetLeft ;
		// Rend la bulle visible
		ptrLayer.style.visibility = "visible";
	}
	if (NS4) {
		ptrLayer.document.write (str);
		ptrLayer.document.close ();
		ptrLayer.top  = ptrObj.y + 70;
		ptrLayer.left = ptrObj.x;
		ptrLayer.visibility = "show";
	}
}