var Xoffset=-60;        // modify these values to ...
var Yoffset= 20;        // change the info_bulle position.
var LargeurInfoBulle=130;       // info_bulle width

// Création du div du contenu de l'info bulle
document.write("<DIV ID='InfoBulle'></DIV>");

// identification du browser
var iex=(document.all);
var nav=(document.layers);
var old=(navigator.appName=="Netscape" && !document.layers && !document.getElementById);
var n_6=(window.sidebar);

// Attribue l'object
var InfoObj;
if(nav) InfoObj=document.InfoBulle;
if(iex) InfoObj=InfoBulle.style;
if(n_6) InfoObj=document.getElementById("InfoBulle").style;

// park modifier
var yyy=-1000;

// capture pointer
if(nav)document.captureEvents(Event.MOUSEMOVE);
if(n_6) document.addEventListener("mousemove",get_mouse,true);
if(nav||iex)document.onmousemove=get_mouse;

// set dynamic coords
function get_mouse(e)
{
  var x,y;

  if(nav || n_6) x=e.pageX;
  if(iex) x=event.x+document.body.scrollLeft; 
  
  if(nav || n_6) y=e.pageY;
  if(iex)
  {
    y=event.y;
    if(navigator.appVersion.indexOf("MSIE 4")==-1)
      y+=document.body.scrollTop;
  }

  if(iex || nav)
  {
    InfoObj.top=y+yyy;
    InfoObj.left=x+Xoffset; 
  }

  if(n_6)
  {
    InfoObj.top=(y+yyy)+"px";
    InfoObj.left=x+Xoffset+"px";
  }    
  nudge(x);
}

// avoid edge overflow
function nudge(x)
{
  var extreme,overflow,temp;

  // right
  if(iex) extreme=(document.body.clientWidth-LargeurInfoBulle);
  if(n_6 || nav) extreme=(window.innerWidth-LargeurInfoBulle);

  if(parseInt(InfoObj.left)>extreme)
  {
    overflow=parseInt(InfoObj.left)-extreme;
    temp=parseInt(InfoObj.left);
    temp-=overflow;
    if(nav || iex) InfoObj.left=temp;
    if(n_6)InfoObj.left=temp+"px";
  }

  // left
  if(parseInt(InfoObj.left)<1)
  {
    overflow=parseInt(InfoObj.left)-1;
    temp=parseInt(InfoObj.left);
    temp-=overflow;
    if(nav || iex) InfoObj.left=temp;
    if(n_6)InfoObj.left=temp+"px";
  }
}

// write content & display
function info_bulle(titre,texte,coulBord,coulFond)
{
  if (titre.length > 40 || texte.length > 80) {
  	var longueurtable = 300;
  }
  else {
  	var longueurtable = 150;
  }
  if (titre!='') {
  	var content="<TABLE WIDTH="+longueurtable+" BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR=#"+coulBord+"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD CLASS=TitreInfoBulle>"+titre+"</TD></TR></TABLE><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR="+coulFond+"><TR><TD CLASS=TexteInfoBulle>"+texte+"</TD></TR></TABLE></TD></TR></TABLE>";
  }
  else {
  	var content="<TABLE WIDTH="+longueurtable+" BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR=#"+coulBord+"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR="+coulFond+"><TR><TD CLASS=TexteInfoBulle>"+texte+"</TD></TR></TABLE></TD></TR></TABLE>";
  }

  if(old)
  {
    alert(msg);
    return;
  } 
   
  yyy=Yoffset; 
  InfoObj.width=LargeurInfoBulle;

  if(nav)
  { 
    InfoObj.document.open();
    InfoObj.document.write(content);
    InfoObj.document.close();
    InfoObj.visibility="visible";
  }

  if(iex)
  {        
    InfoBulle.innerHTML=content;
    InfoObj.visibility="visible";
  }  

  if(n_6)
  {   
    document.getElementById("InfoBulle").innerHTML=content;
    InfoObj.visibility="visible";
  }
}


// park content box
function kill()
{
  if(!old)
  {
    yyy=-1000;
    InfoObj.visibility="hidden";
    InfoObj.width=0;
  }
}
