var ObjetBulle=new Object;
var position_x=0;
var position_y=0;
var decalage_bulle_x=-10;
var decalage_bulle_y=10;


function AfficherBulle(texte) 
{
	var largeur_ecran;
	var hauteur_ecran;
	var resultat_x=position_x+decalage_bulle_x;
	var resultat_y=position_y+decalage_bulle_y;
	var contenu=texte;
	if(typeof(window.innerWidth)=='number' )
	{
		largeur_ecran=window.innerWidth;
		hauteur_ecran=window.innerHeight;
	}
	else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight))
	{
		largeur_ecran=document.documentElement.clientWidth;
		hauteur_ecran=document.documentElement.clientHeight;
	}
	else if(document.body&&(document.body.clientWidth||document.body.clientHeight))
	{
		largeur_ecran=document.body.clientWidth;
		hauteur_ecran=document.body.clientHeight;
	};
	var defilement_gauche;
	var defilement_haut;
	if(document.all)
	{
		if(document.compatMode=="CSS1Compat")
		{
			defilement_gauche=document.body.parentNode.scrollLeft;
			defilement_haut=document.body.parentNode.scrollTop;
		}
		else
		{
			defilement_gauche=document.body.scrollLeft;
			defilement_haut=document.body.scrollTop;
		};
	}
	else
	{
		defilement_gauche=window.scrollX;
		defilement_haut=window.scrollY;
	};
	if (document.getElementById)
	{
		if((hauteur_ecran+defilement_haut)<document.getElementById("bulle").offsetHeight+position_y)
		{
			document.getElementById("bulle").style.top=((hauteur_ecran+defilement_haut)-document.getElementById("bulle").offsetHeight)+'px';
		}
		else
		{
			document.getElementById("bulle").style.top=position_y+'px';
		};
		if((largeur_ecran+defilement_gauche)<document.getElementById("bulle").offsetWidth+position_x)
		{
			document.getElementById("bulle").style.left=((largeur_ecran+defilement_gauche)-document.getElementById("bulle").offsetWidth)+'px';
		}
		else
		{
			document.getElementById("bulle").style.left=position_x+'px';
		};
	}; 
	if (document.getElementById)
	{
		document.getElementById("bulle").innerHTML=contenu;
		document.getElementById("bulle").style.visibility="visible";
		document.getElementById("bulle").style.zIndex="10";
	};
};

function SuivrePositionCurseur(e) 
{
	if (document.all) 
	{
		position_x=event.x+document.body.scrollLeft; 
		position_y=event.y+document.body.scrollTop;
	}
	else 
	{
		position_x=e.pageX; 
		position_y=e.pageY; 
	};
};


function MasquerBulle() 
{
	if(document.getElementById)
	{
		document.getElementById("bulle").style.visibility="hidden";
	};
};

function InitBulle() 
{
	if (document.getElementById) 
	{
		document.onmousemove=SuivrePositionCurseur;
		document.write("<div id='bulle' style='position:absolute;top:0;left:0;visibility:hidden;z-index:10'></div>");
	}
}


