//Incluir este script al final de la página.

if (typeof(IE4) == "undefined")
{
	var IE4 = (document.all && !document.getElementById) ? true : false;
	var IE5 = (document.all && document.getElementById) ? true : false;
	var IE = IE4 || IE5;
	var NS4 = (document.layers) ? true : false;
	var NS5 = (!document.all && document.getElementById) ? true : false;
	var NS6 = NS5;
	var NS = NS4||NS5;
}

if (NS6)
{
	document.all = new Function("n", "return document.getElementById(n);");
}

//**---------------
var posxTIP, posyTIP;

if (!IE) document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = mouseMoveTIP;

document.write ('<STYLE TYPE="text/css">'+
				'#divTIP {position:absolute;visibility:hidden;z-index:200;width:20;}'+
				'</STYLE>');
document.write ('<div id="divTIP"></div>');

var	divTIP = null;
var divTIPStyle = null;

//**--------------------------
function showTIP(texto)
{
	if (divTIP == null)
	{
		divTIP = (NS4) ?  document.layers['divTIP'] : document.all('divTIP');
		divTIPStyle = (NS4) ? document.layers['divTIP'] : document.all('divTIP').style;
	}

	if (NS4)
	{
		var textTIP =
		'<table id="tabla1" height="0" width='+widthTIP+' border="0" cellspacing="0" cellpadding='+ borderTIP +' bgcolor='+ borderColorTIP +'>' +
			'<tr><td><table width="100%" border="0" cellspacing="0" cellpadding="'+paddingTIP+'" bgcolor='+ bgColorTIP +'>'+
					'<tr><td><span style="text-align:justify;color:'+textColorTIP+';font-family:'+ fontTIP +';font-size:'+ fontSizeTIP +';font-weight:'+ fontWeightTIP +';"><center>'+texto+'</center></span></td></tr>'+
			'</table></td></tr>	'+
		'</table>';
		divTIP.document.open();
		divTIP.document.write (textTIP);
		divTIP.document.close();
	}
	else
	{
		divTIP.innerHTML =
		'<table id="tabla1" cellspacing=0 width='+widthTIP+' style="background-color:'+ bgColorTIP +';border-width:'+ borderTIP +';border-color:'+ borderColorTIP +';border-style:solid;">'+
		'<tr><td><table cellspacing='+ paddingTIP +' width="100%">'+
		'<tr><td style="text-align:justify;color:'+textColorTIP+';font-family:'+ fontTIP +';font-size:'+ fontSizeTIP +';font-weight:'+ fontWeightTIP +';">'+texto+
		'</td></tr>'+
		'</td></tr></table></table>';
	}

	divTIPStyle.width = widthTIP;
	if (!moveTIP) posTIP();
	divTIPStyle.visibility = "visible";
}

//**--------------------------
function mouseMoveTIP(evt)
{
	posxTIP = (IE) ? event.x: evt.pageX;
	posyTIP = (IE) ? event.y: evt.pageY;

	if (moveTIP) posTIP();
}

//**--------------------------
function posTIP()
{
	if (divTIP == null)
	{
		divTIP = (NS4) ?  document.layers['divTIP'] : document.all('divTIP');
		divTIPStyle = (NS4) ? document.layers['divTIP'] : document.all('divTIP').style;
	}

	var x, y;
	var heightTIP  = (IE || NS5) ? divTIP.offsetHeight : divTIP.clip.height;
	var widthWnd = (IE) ? document.body.clientWidth : window.innerWidth-20;
	var heightWnd = (IE) ? document.body.clientHeight: window.innerHeight;
	var scrollLEFT = (IE) ? document.body.scrollLeft : window.pageXOffset;
	var scrollTOP =  (IE) ? document.body.scrollTop :  window.pageYOffset;


	switch (hAlignTIP)	{
		case 'left': x = posxTIP - widthTIP - offsetXTIP;	break;
		case 'justify': x = posxTIP - widthTIP - offsetXTIP;	break;
		case 'center': x = posxTIP - (widthTIP/2);	break;
		default: x = posxTIP + offsetXTIP;
	}
	if (IE) x+=scrollLEFT;

	if (x < scrollLEFT) x = scrollLEFT;
	else if ((x+widthTIP) > (widthWnd+scrollLEFT)) x = widthWnd + scrollLEFT - widthTIP;

	divTIPStyle.left =x;

	if (IE)	posyTIP += scrollTOP;
	switch (vAlignTIP)	{
		case 'top':	 y = posyTIP - heightTIP - offsetYTIP; break;
		case 'middle': y = posyTIP - (heightTIP / 2); break;
		default: y = posyTIP + offsetYTIP;
	}

	if (y < scrollTOP)	//Se oculta por la parte superior
	{
		if (hAlignTIP != "center") y = scrollTOP;
		else y =  posyTIP + offsetYTIP;
	}
	else
	{
		if ((y+heightTIP) > (heightWnd+scrollTOP)) //Se oculta por la parte inferior
		{
			if (hAlignTIP != "center")	y = heightWnd  - heightTIP + scrollTOP;
			else y = posyTIP - heightTIP - offsetYTIP;
		}
	}

	divTIPStyle.top = y;
}

//**--------------------------
function hideTIP()
{
	divTIPStyle.visibility = "hidden";
	if (IE || NS5)	divTIP.innerHTML = "";
}



