//Quitado el nowrap de la td de la tabla de mostrarTF
//Comentados mueveRatonTF y capturaXY para que ocupe el maximo ancho posible
//Cambiado el valor de nX de 10 a 2 para hacer mas ancha la capa
//Cambiado el valor de nEspera de 1000 a 10000 para que dure mas
//



var oTF

// ----------------------------------------------------------
//    Clase clTextoFlotante
//-----
function clTextoFlotante()
{
	this.cTexto;
	this.cContenido;
	this.nSeparaX      = 10;
	this.nSeparaY      = 10;
	this.timer;
	this.nX       = 2;
	this.nY       = 10;
	this.nDelay   = 1000;
	this.nEspera  = 10000;
	this.lVisible = false;
	this.oCapa;
}

// ----------------------------------------------------------
//    mostrarTF
//-----
function mostrarTF(cTexto, oEvento)
{
	var cContenido = "";
	var cBorde     = "border=" + (document.all ? "0" : "1");
	
	oTF = new clTextoFlotante();
	
	cContenido += '<table cellspacing="0" cellpadding="2" ' + cBorde + '>';
	cContenido += '	 <tr>';
	cContenido += '	   <td class="TextoFlotante" >';
	cContenido += cTexto;
	cContenido += '    </td>';
	cContenido += '  </tr>';
	cContenido += '</table>';

	oTF.cTexto = cTexto;
	oTF.cContenido = cContenido;

	if (document.layers) document.captureEvents(Event.MOUSEMOVE);
	document.onmousemove = capturaXY;	
	
	clearTimeout(oTF.timer);
	oTF.timer = setTimeout("mostrarTextoFlotante()", oTF.nDelay);

//	capturaXY(oEvento);
}

// ----------------------------------------------------------
//    mostrarTextoFlotante
//-----
function mostrarTextoFlotante()
{
	var cCapa = "textoFlotante";

	clearTimeout(oTF.timer);
	oTF.timer = setTimeout("ocultarTF()", oTF.nEspera);

	if (document.layers) document.captureEvents(Event.MOUSEMOVE);
	document.onmousemove = mueveRatonTF;
	
	if (document.all) 
	{
		oTF.oCapa = document.all[''+cCapa+''];
	
		oTF.oCapa.style.visibility = "hidden";
		oTF.oCapa.innerHTML = oTF.cContenido; 

		posicionTF();	

		oTF.oCapa.style.visibility = "visible";
		oTF.lVisible = true;
	}
	
	if (document.layers) 
	{
		oTF.oCapa = eval("document.layers." + cCapa)
		oTF.oCapa.visibility = "hide"

//		oTF.oCapa.document.open();
		oTF.oCapa.document.writeln(oTF.cContenido);
		oTF.oCapa.document.close();
		
		posicionTF();	

		oTF.oCapa.visibility = "show";
		oTF.lVisible = true;
	}
}

// ----------------------------------------------------------
//    posicionTF
//-----
function posicionTF()
{
	var nAnchoTF = 0;
	var nPosDer  = 0;
	var nTopoDer = 0;
	
	if (document.all) 
	{
		var oBody = document.body;
	
		nAnchoTF = oTF.oCapa.clientWidth;
		nPosDer = oTF.nX + nAnchoTF;
		nTopeDer = oBody.clientWidth;
		
		if (nPosDer > nTopeDer) oTF.nX = (nTopeDer - nAnchoTF);
		if ( oBody.clientHeight < (oTF.nY - oBody.scrollTop  + oTF.oCapa.offsetHeight) ) 
		{
			// Subir el menú para que sea totalmente visible
			oTF.nY = oBody.clientHeight - oTF.oCapa.offsetHeight + oBody.scrollTop;
		}
	
		oTF.oCapa.style.posTop = oTF.nY;
		oTF.oCapa.style.posLeft = oTF.nX;
	}
	
	if (document.layers) 
	{
		nAnchoTF = oTF.oCapa.clip.width;
		nPosDer = oTF.nX + nAnchoTF;
		nTopeDer = innerWidth;

		if (nPosDer > nTopeDer) oTF.nX = (nTopeDer - nAnchoTF);
		if ( innerHeight < (oTF.nY - pageYOffset + oTF.oCapa.clip.height) ) 
		{
			// Subir el menú para que sea totalmente visible
			oTF.nY = innerHeight - oTF.oCapa.clip.height + pageYOffset;
		}
		
		oTF.oCapa.pageX = oTF.nX;
		oTF.oCapa.pageY = oTF.nY;
	}
}
	
// ----------------------------------------------------------
//    ocultarTF
//-----
function ocultarTF() 
{
	clearTimeout(oTF.timer);

	if (typeof oTF.oCapa != "undefined")
	{
		if (document.layers) oTF.oCapa.visibility = "hide"; else oTF.oCapa.style.visibility = "hidden";
		if (document.layers) document.releaseEvents(Event.MOUSEMOVE);
	}

	oTF.cContenido = ""
	oTF.lVisible = false;
}

// ----------------------------------------------------------
//    mueveRatonTF
//-----
function mueveRatonTF(e)
{
	if (oTF.lVisible)
	{
//		capturaXY(e);
//		posicionTF();
	}
}

// ----------------------------------------------------------
//    capturaXY
//-----
function capturaXY(e)
{
	if (document.layers) {
//		oTF.nX = e.pageX;
		oTF.nY = e.pageY;
	}
	if (document.all)    {
//		oTF.nX = event.x;
		oTF.nY = event.y;
	}

//	oTF.nX += oTF.nSeparaX;
	oTF.nY += oTF.nSeparaY;
}


