
/***********************************************
* http://www.dynamicdrive.com/dynamicindex5/dhtmltooltip.htm
***********************************************/

document.write('<div id=VentanitaFlotante></div>');

var offsetxpoint=-30;
var offsetypoint=20;
var offsetylimite=5;

var enabletip=false
var BloqueoVentana=false

var ie=document.all
var ns6=document.getElementById && !document.all

if (ie||ns6)
	var tipobj=document.all? document.all["VentanitaFlotante"] : document.getElementById? document.getElementById("VentanitaFlotante") : ""

function ietruebody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

document.onmousemove=PosicionRaton

function AbreVentanita(Texto, Titulo, URL, Ancho, Alto){
	if (ns6||ie){
		

		var TextoMostrar="";
		var AnchoFlotante="";
		var TextoFrame="";
		CierreVentana="";
		
		BloqueoVentana=false
		var AltoFlotante=100;

		AnchoFlotante=(Texto.length * 7)+30;
		
		if (AnchoFlotante > 500)
			AnchoFlotante = 500;
		
		if (Ancho) {
			AnchoFlotante=Ancho
		}
		if (Alto) {
			AltoFlotante=Alto
		}
		
		offsetxpoint=parseInt(AnchoFlotante / 2)*-1;
		
		tipobj.style.width=AnchoFlotante+"px"
		offsetypoint=20;
		offsetylimite=5;
		
		if (URL) {
			
			BloqueoVentana=true;
			
			if (Titulo) {
				CierreVentana="<a href=\"javascript:;\" onclick=\"CierraVentanita()\"><img border=0 src='/icons/remove.gif'></a>";
				
				if (URL != "Forzado") {
					Texto ="<iframe width='"+AnchoFlotante+"' height='"+AltoFlotante+"' scrolling='auto' border='0' framespacing='0' frameborder='0' src='/exe/Editor_MuestraDiccionario.cgi?"+URL+"'></iframe>"
				
				}
	
				offsetypoint=-35;
				offsetylimite=-30;
			}
		}
		if (Titulo) {
			TextoMostrar="<table class=CabeceraTitulo cellpadding=0 cellspacing=0 width=100%><tr><td align=center>"+Titulo+"</td><td align=right>"+CierreVentana+"</td></tr></table>";

		}

		if (Texto) {
			if (Titulo) {
				TextoMostrar=TextoMostrar+"<br>";
			}
			TextoMostrar=TextoMostrar+Texto;
		}

		
		tipobj.innerHTML=TextoMostrar;
		tipobj.style.display="block";
		enabletip=true;
		return false;
	}
}

function PosicionRaton(e){
	if (enabletip){
		var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
		var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;

		//Find out how close the mouse is to the corner of the window
		var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-15
		
		var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetylimite : window.innerHeight-e.clientY-offsetylimite-15

		var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : screen.width - 25


		if (rightedge<tipobj.offsetWidth)
				tipobj.style.left=screen.width - tipobj.offsetWidth-35+"px"
			else if (curX<leftedge)
					tipobj.style.left="5px"
				else
					tipobj.style.left=curX+offsetxpoint+"px"
		
		if (bottomedge<tipobj.offsetHeight)
				tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetylimite+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetylimite+"px"
			else
				tipobj.style.top=curY+offsetypoint+"px"

		

		
		if (BloqueoVentana)
			enabletip=false

	}
}


function CierraVentanita(){
	if (ns6||ie){
		enabletip=false
		tipobj.style.display="none"
	}
}

