
var IB=new Object;
var posX=0;posY=0;
var xOffset=250;yOffset=-50;
function AffBulle(texte) {
  contenu = "<table border=0 cellspacing=0 cellpadding=" + IB.NbPixel + "><tr bgcolor='" + IB.ColContour + "'><td><table border=0 cellpadding=2 cellspacing=0 bgcolor='" + IB.ColFond + "'><tr><td><font size='-1' face='arial' color='" + IB.ColTexte + "'>" + texte + "</font></td></tr></table></td></tr></table>&nbsp;";
  var finalPosX=posX-xOffset;
  var finalPosY=posY+yOffset;
  if (finalPosX<0) finalPosX=0;
  if (finalPosY<0) finalPosY-0;
  
  var weatherDiv = document.getElementById("weatherVertical");
  if (null != weatherDiv){
    var tmpfinalPosX = GetDomOffset( weatherDiv, 'offsetLeft' ) - 305;
    if (tmpfinalPosX >= 0)
        finalPosX = tmpfinalPosX;
  }
  else {
      weatherDiv = document.getElementById("weatherHorizontal");
      if (null != weatherDiv){
        var tmpfinalPosY = GetDomOffset( weatherDiv, 'offsetTop' ) + 120;
        if (tmpfinalPosY >= 0)
            finalPosY = tmpfinalPosY;
        finalPosX=posX-(xOffset/2);
      }
    }
  
  if (document.layers) {
    var bulleDiv = document.layers["bulle"];
    bulleDiv.document.write(contenu);
    bulleDiv.document.close();
    bulleDiv.top=finalPosY+"px";;
    bulleDiv.left=finalPosX+"px";;
    bulleDiv.visibility="show";
  }
  if (document.all) {
    //var f=window.event;
    //doc=document.body.scrollTop;
    var bulleDiv = document.all["bulle"];
    bulleDiv.innerHTML=contenu;
    bulleDiv.style.top=finalPosY+"px";;
    bulleDiv.style.left=finalPosX+"px";;//f.x-xOffset;
    bulleDiv.style.visibility="visible";
  }
  //modif CL 09/2001 - NS6 : celui-ci ne supporte plus document.layers mais document.getElementById
  else if (document.getElementById) {
    var bulleDiv = document.getElementById("bulle");
    bulleDiv.innerHTML=contenu;
    bulleDiv.style.top=finalPosY+"px";
    bulleDiv.style.left=finalPosX+"px";
    bulleDiv.style.visibility="visible";
  }
}

// Retrieve object position adding all its parents' positions
function GetDomOffset( Obj, Prop ) {
	var iVal = 0;
	while (Obj && Obj.tagName != 'BODY') {
		eval('iVal += Obj.' + Prop + ';');
		Obj = Obj.offsetParent;
	}
	return iVal;
}

function getMousePos(e) {
  if (document.all) {
  posX=event.x+document.body.scrollLeft; //modifs CL 09/2001 - IE : regrouper l'évènement
  posY=event.y+document.body.scrollTop;
  }
  else {
  posX=e.pageX; //modifs CL 09/2001 - NS6 : celui-ci ne supporte pas e.x et e.y
  posY=e.pageY; 
  }
}
function HideBulle() {
	if (document.layers) {document.layers["bulle"].visibility="hide";}
	if (document.all) {document.all["bulle"].style.visibility="hidden";}
	else if (document.getElementById){document.getElementById("bulle").style.visibility="hidden";}
}

function InitBulle(ColTexte,ColFond,ColContour,NbPixel) {
	IB.ColTexte=ColTexte;IB.ColFond=ColFond;IB.ColContour=ColContour;IB.NbPixel=NbPixel;
	if (document.layers) {
		window.captureEvents(Event.MOUSEMOVE);window.onMouseMove=getMousePos;
		document.write("<layer name='bulle' top=0 left=0 visibility='hide'></layer>");
	}
	if (document.all) {
	    document.write("<div id='bulle' style='position:absolute;top:0;left:0;visibility:hidden;z-index: 100;'></div>");
		document.onmousemove=getMousePos;
	}
	//modif CL 09/2001 - NS6 : celui-ci ne supporte plus document.layers mais document.getElementById
	else if (document.getElementById) {
	        document.onmousemove=getMousePos;
	        document.write("<div id='bulle' style='position:absolute;top:0;left:0;visibility:hidden;z-index: 100;'></div>");
	}

}
