var objTipsBox;

function initTipsBox()
{
	var objBody = document.getElementsByTagName("body").item(0);
	objBody.onmousemove = sourisxy;
	// Creation de l'infobulle
	objTipsBox = document.createElement("div");
	objTipsBox.setAttribute('id','tipsbox');
	objTipsBox.style.display = 'none';
	objTipsBox.style.position = 'absolute';	
	objBody.insertBefore(objTipsBox, objBody.firstChild);
	// Creation de l'evenement
	if (!document.getElementsByTagName){ return; }
	var anchors = document.getElementsByTagName("img");
	active_TipsBox(anchors);
	var anchors = document.getElementsByTagName("area");
	active_TipsBox(anchors);
}

function active_TipsBox(anchors){
		for (var i=0; i<anchors.length; i++){
			var anchor = anchors[i];
			if (anchor.getAttribute("rel") && anchor.getAttribute("rel").substring(0,7) == "TipsBox"){
				anchor.onmousemove = function () {
					show_info_bulle(this,1,objTipsBox);
				}
				anchor.onmouseout = function () {
					show_info_bulle(this,0,objTipsBox);
				}
			}
		}	
	}
	

var x;
var y;
 function sourisxy(e)
  {
  x = (navigator.appName=="Netscape") ? e.pageX : event.x + document.body.scrollLeft;
  y = (navigator.appName=="Netscape") ? e.pageY : event.y + document.body.scrollTop;
}
		
function show_info_bulle(el,action,objTipsBox){
	if(action==1){
		objTipsBox.style.top = (y+20)+"px";
		objTipsBox.style.left = (x+10)+"px";
		objTipsBox.style.display="block";
		objTipsBox.innerHTML=el.getAttribute('rel').substring(8,el.getAttribute('rel').length);
	} else {
		objTipsBox.style.top = 0;
		objTipsBox.style.left = 0;
		objTipsBox.style.display = "none";
	}
}

addLoadEvent(initTipsBox);