/*
 * Rollover et gestion de la bulle
 */

/**
 * Calcule la position d'un objet pour un navigateur
 * DOM/XML
 *
 * @param thisObject L'objet source
 * @return La coordonnée X de l'objet
 */
function getDomXPos(thisObject) {
  return((thisObject.offsetParent) ? (thisObject.offsetLeft + getDomXPos(thisObject.offsetParent)) : thisObject.offsetLeft);
}


/**
 * Calcule la position d'un objet pour un navigateur
 * DOM/XML
 *
 * @param thisObject L'objet source
 * @return La coordonnée Y de l'objet
 */
function getDomYPos(thisObject) {
  return((thisObject.offsetParent) ? (thisObject.offsetTop + getDomYPos(thisObject.offsetParent)) : thisObject.offsetTop);
}

 
function rollIn(obj)
{
	var bulle, bulleTexte;
	
	obj.src = (obj.src.replace(".gif", "_roll.gif"));
	
	if (document.getElementById) {
		bulle = document.getElementById("bulle");
		bulleTexte = document.getElementById("bulleTexte");
	} else if (document.all) {
		bulle = document.all.bulle;
		bulleTexte = document.all.bulleTexte;
	}
	
	if (!bulle)
		return;
	
	if (document.getElementById) {
		bulle.style.top = getDomYPos(obj) + obj.height;
		bulle.style.left = getDomXPos(obj) + (obj.width / 2) - 5;
	} else if (document.all) {
		var _XOff = 0;
		var _YOff = 0;
		var imgObj = obj;
		
		while (imgObj) {
			if (imgObj.tagName != "FORM") {
				if (imgObj.tagName != "TR") {
					_XOff = parseInt(_XOff) + parseInt(imgObj.offsetLeft);
					_YOff = parseInt(_YOff) + parseInt(imgObj.offsetTop);
				}
			}
			
			imgObj = imgObj.parentElement;
		}
		
		bulle.style.left = _XOff + (parseInt(obj.width) / 2) - 5;
		bulle.style.top = _YOff + parseInt(obj.height);	
	}

	bulle.style.visibility = 'visible';
	bulleTexte.innerHTML = obj.alt;
	
	return true;
}

function rollOut(obj) {
	var bulle;
	obj.src = (obj.src.replace("_roll.gif", ".gif"));

	if (document.getElementById) {
		bulle = document.getElementById("bulle");
	} else if (document.all) {
		bulle = document.all.bulle;
	}

	if (bulle)
		bulle.style.visibility = 'hidden';
		
	return true;
}