var ns4 = document.layers;
var ns6 = document.getElementById && !document.all;
var ie4 = document.all;
var image = new Image;
offsetX = 0;
offsetY = 20;
var toolTipSTYLE="";
var largeurImage=0;
function initToolTips()
{
  if(ns4||ns6||ie4)
  {
    if(ns4) toolTipSTYLE = document.toolTipLayer;
    else if(ns6) toolTipSTYLE = document.getElementById("toolTipLayer").style;
    else if(ie4) toolTipSTYLE = document.all.toolTipLayer.style;
    if(ns4) document.captureEvents(Event.MOUSEMOVE);
    else
    {
      toolTipSTYLE.visibility = "visible";
      toolTipSTYLE.display = "none";
    }
    document.onmousemove = moveToMouseLoc;
  }
}
function toolTip(msg, titre, img)
{
  if(toolTip.arguments.length < 1) // hide
  {
    if(ns4) toolTipSTYLE.visibility = "hidden";
    else toolTipSTYLE.display = "none";
  }
  else // show
  {
  	contentImg = '';
	classTitre = 'class="tableEncart"';
	classMsg = 'class="tableBlanche"';
  	if (img!=null && img>-1) {		
		//image.src = img;
		image = document.imageArray[img];
		//alert(image.src);
		contentImg = 'background="' + image.src + '" width="' + image.width + '"' + '" height="' + image.height + '"';
		//classTitre = '';
		//alert(image.width);
		largeurImage=image.width;
		classMsg = 'class="texteBlanc"';	
	} else {
		contentImg = 'width="200"';
		largeurImage=200;
	}
	var content = 
	'<table border="0" cellspacing="1" cellpadding="1" bgcolor="#000000" ' +  contentImg + '>';
	if (titre) {
		content +=
		'<tr>' +
			'<td height="20"' + classTitre + '>' + titre + '</td>' +
		'</tr>';
	}
	if (msg || (img!=null && img>-1)) {
	if (!msg)
		msg = '&nbsp;';
	content +=
		'<tr valign="top">' +
			'<td ' + classMsg + '>' + msg + '</td>' +
		'</tr>';
	}
	content += '</table>';

    if(ns4)
    {
      toolTipSTYLE.document.write(content);
      toolTipSTYLE.document.close();
      toolTipSTYLE.visibility = "visible";
    }
    if(ns6)
    {
      document.getElementById("toolTipLayer").innerHTML = content;
      toolTipSTYLE.display='block'
    }
    if(ie4)
    {
      document.all("toolTipLayer").innerHTML=content;
      toolTipSTYLE.display='block'
    }
  }
}
function moveToMouseLoc(e)
{
  if(ns4||ns6)
  {
    x = e.pageX;
    y = e.pageY;
  }
  else
  {
    x = event.x + document.body.scrollLeft;
    y = event.y + document.body.scrollTop;
  }
  if (x>250) {  	
  	x=x-largeurImage;
  }
  toolTipSTYLE.left = x + offsetX;
  toolTipSTYLE.top = y + offsetY;
  return true;
}
// Example:
// simplePreload( '01.gif', '02.gif' ); 
function simplePreload()
{ 
  var args = simplePreload.arguments;
  document.imageArray = new Array(args.length);
  for(var i=0; i<args.length; i++)
  {
    document.imageArray[i] = new Image;
    document.imageArray[i].src = args[i];
  }
}
