
offsetX = -20;
offsetY = 20;
var toolTipSTYLE="";
var ns4 = document.layers;
var ns6 = document.getElementById && !document.all;
var ie4 = document.all;

// Escreve os estilos na página

document.write('<STYLE>                       ');
document.write('#toolTip                      ');
document.write('{                             ');
document.write('	top: 0px;                 ');
document.write('	left: 0px;                ');
document.write('	border: 1px solid black;  ');
document.write('	background: #FFFFFF;      ');
document.write('	padding: 5px;             ');
document.write('	color: black;             ');
document.write('	z-index: 19;              ');
document.write('}                             ');

document.write('.toolTipoImg                  ');
document.write('{                             ');
document.write('	position: relative;       ');
document.write('  	margin: 0px;              ');
document.write('	display: block;           ');
document.write('	z-index: 20;              ');
document.write('	margin-left: 5px;         ');
document.write('	margin-bottom: -1px;      ');
document.write('}                             ');
document.write('</STYLE>                      ');


document.write('<div id="toolTipLayer" style="position:absolute; visibility: hidden; z-index: 19;"></div>');
document.write('<link type="text/css" rel="stylesheet" href="tooltip.css">');

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 = "hidden";
		toolTipSTYLE.display = "none";
	}
	document.onmousemove = moveToMouseLoc;
}


function toolTipOver(obj,msg)
{
	if (obj.src)
    {
		var extAnt = obj.src.substr((obj.src.length-4),obj.src.length);
	}
	if (msg)
    {
		if (obj.src)
        {
			var nameAnt = obj.src.substr(0,(obj.src.length-4));
			var nameNew = nameAnt+'_hover'+extAnt;
			obj.src = nameNew;
		}
		toolTip(msg);	
	}
    else
    {
		if (obj.src)
        {
			var nameAnt = obj.src.substr(0,(obj.src.length-10));
			var nameNew = nameAnt+extAnt;
			obj.src = nameNew;
		}
		toolTip();
	}
}

function toolTip(msg)
{
	if(toolTip.arguments.length < 1) // hide
	{
		if(ns4) toolTipSTYLE.visibility = "hidden";
		else toolTipSTYLE.display = "none";
	}
	else // show
	{
	    var content =  '<img src="/imagens/tip.gif" class="toolTipoImg" alt=""><div id="toolTip" align="center"><font size="2">'+ msg +'</font></div>';
		if(ns4)
		{
			toolTipSTYLE.document.write(content);
			toolTipSTYLE.document.close();
			toolTipSTYLE.visibility = "visible";
		}
		if(ns6)
		{
			document.getElementById("toolTipLayer").innerHTML = content;
			toolTipSTYLE.display='block'
			toolTipSTYLE.visibility = "visible";
		}
		if(ie4)
		{
			document.all("toolTipLayer").innerHTML=content;
			toolTipSTYLE.display='block'
			toolTipSTYLE.visibility = "visible";
		}
	}
}

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;		
	}	
	//alert(e);
	newX = x + offsetX;
	newY = y + offsetY;
	toolTipSTYLE.left = newX + 'px';
	toolTipSTYLE.top = newY + 'px'; 	
	return true;
}


