<!--
/**
 * Conjunto de funciones para mostrar capas emergentes
 */ 
ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false
dom = ((document.getElementById)&&(!ie4))?true:false;   // ns6 etc.
var xPos=0;
var yPos=0;

if ( bExisteCapa==null)
   var bExisteCapa=false;
creacapa ();

//var objdiv;
if(ns4)	document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = captPosi;

function condicionalpru(cond,true_part,false_part) {
    return true_part;
}


function condicional(cond,true_part,false_part) {
    return true_part;
}


function Decimales(nNum, nDec){
	var sCad = new String(nNum);
	var iPos;

	if (isNaN(nNum))
		return(nNum);

	iPos = sCad.search(/\./);

	if (iPos != -1)
		return(Number(sCad.substr(0, iPos+nDec+1)));	
	else
		return(nNum);
}
function captPosi(eve){
	if(ns4 || dom){
		xPos = eve.pageX;
		yPos = eve.pageY;
	}
	else if (document.body != null && event != null) {
	   xPos = event.x+document.body.scrollLeft;
	   yPos = event.y+document.body.scrollTop;
	}
	//window.status=xPos+"  "+yPos;
}

function ocultar(){	
	var capa = getCapaMensajeEmergente();
	if (capa) 
		capa.style.visibility = "hidden";
}

function creacapa() {
	return getCapaMensajeEmergente();
}

function euros(pts) {
	var fPrecio;
	var fDecimal;
	var fLider;
	var fPDecimal;
	
	fPrecio=pts/166.386;
	
	//1 y 2 decimal	
	fDecimal = Math.floor((fPrecio-Math.floor(fPrecio))*100);	
	
	//3 decimal
	fLider = Math.floor((((fPrecio-Math.floor(fPrecio))*100) - fDecimal)*10);
	
	
	if (fLider>=5) { 
		//Problema con el redondeo: utilizar 0.015 en vez de 0.01
		fLider = 0.015; }
	else {
		fLider = 0;}
	
	if (fDecimal>0) 
		fDecimal = fDecimal/100.0;

	fPrecio=Math.floor(fPrecio);	
	fPrecio += (fDecimal + fLider);	
	return(Decimales(fPrecio, 2));	
}

function pesetas(eur) {
	var fPrecio;
	var fDecimal;
	var fLider;
	var fPDecimal;
	
	fPrecio=eur*166.386;
	
	//1 decimal
	fDecimal = Math.floor((fPrecio-Math.floor(fPrecio))*10);		
	fPrecio=Math.floor(fPrecio);
	
	if (fDecimal>=5) 		
		return(fPrecio+1);
	else 
		return(fPrecio);		
}

///////////////////////////////////////////////////////////////
// funciones tabla: construyen un html, (TODO posible refactorización la mayoria de las tablas texto hacen lo mismo)
///////////////////////////////////////////////////////////////
function dc_tabla(cual, cua2) {
	//El precio se pasa en euros
	var tab="";
	var eur = cual;
	var cant = eur + ' <img src="/img/euro2.gif" width=8 height=9 border=0>';	

	tab='<table border=0 cellspacing=0 bgcolor="#F4c23d" cellpadding="0" width=290>';
	tab+='<tr>';
	tab+='<td class="CapaInformacion"><center><font color="#3300cc"> El precio del servicio es de </font><font class="TextoCapaInformacion"> '+ cant + '</font><font color="#3300cc"> ' + cua2 + '</font></center></td>';
	tab+='</tr>';
	tab+='</table>';

	estableceInnerHTMLCapa(tab);
	return tab;
}

function dc_tabla3(cual, cua2) {
   	var tab="";
   	
	if(cual == 1){		
		tab='<table border=0 cellspacing=0 bgcolor="#F4c23d" cellpadding="0" width=290>';
		tab+='<tr>';
		tab+='<td class="CapaInformacion"><center><font color="#3300cc">Tiempo medio de tramitación: <br> '+ cual + ' dia hábil ' + cua2 + '</font></center></td>';
		tab+='</tr>';
		tab+='</table>';
	}
	else{
		tab='<table border=0 cellspacing=0 bgcolor="#F4c23d" cellpadding="0" width=290>';
		tab+='<tr>';
		tab+='<td class="CapaInformacion"><center><font color="#3300cc">Tiempo medio de tramitación:<br> '+ cual + ' dias hábiles ' + cua2 + '</font></center></td>';
		tab+='</tr>';
		tab+='</table>';
	}

	estableceInnerHTMLCapa(tab);
	return tab;		
}

function tabla(cual, cua2) {
   //El precio se pasa en pesetas y se calcula en euros
	var tab="";
	var eur = euros(cual);
	var cant = eur + ' <img src="/img/euro2.gif" width=8 height=9 border=0>  / '+ cual + ' pts';	
	
	tab='<table border=0 cellspacing=0 cellpadding="0" width="290">';
	tab+='<tr >';
	tab+='<td class="CapaInformacion"><center><font color="#3300cc"> El precio del servicio es de </font><font class="TextoCapaInformacion"> '+ cant + cua2 + '</font></td>';
	tab+='</tr>';
	tab+='</table>';

	estableceInnerHTMLCapa(tab);
	return tab;
}

function tablaranking(msg1,cual1,msg2,cual2,msg3) {
	//El precio se pasa en pesetas y se calcula en euros
	var tab="";
	var eur = euros(cual1);
	var cant = eur + ' <img src="/img/euro2.gif" width=8 height=9 border=0>  / '+ cual1 + ' pts';
	eur = euros(cual2);
	
	if (cual2!='')
		var cant2 = eur + ' <img src="/img/euro2.gif" width=8 height=9 border=0>  / '+ cual2 + ' pts';			
	else{
		msg2='';
		var cant2 ='';
	}
		
	var c;
	
	tab='<table border=0 cellspacing=0 width=100% bgcolor="#F4c23d" cellpadding="0" width=290>';
	tab+='<tr>';
	tab+='<td class="CapaInformacion"> <center><font color="#3300cc"> '+msg1+' </font><font class="TextoCapaInformacion"> '+ cant  + '</font><font color="#3300cc"> '+msg2+' </font><font class="TextoCapaInformacion"> '+ cant2  + '</font><font color="#3300cc"> '+msg3+' </font></td>';
	tab+='</tr>';
	tab+='</table>';

	estableceInnerHTMLCapa(tab);
	return tab;
}

function tabla1(cual, cua2) {
	var tab="";
	var eur = euros(cual);
	var cant = eur + ' <img src="/img/euro2.gif" width=8 height=9 border=0>  / '+ cual + ' pts';	

	tab='<table border=0 cellspacing=0  bgcolor="#F4c23d" cellpadding="0" width="290">';
	tab+='<tr>';
	tab+='<td class="CapaInformacion"><center><font color="#3300cc"> Sumario 2 ultimos meses gratis<br>Sumarios anteriores:  </font><font class="TextoCapaInformacion"> '+ cant + '</font> <font color="#3300cc">/ Sumario</idioma></font></td>';
	tab+='</tr>';
	tab+='</table>';

	estableceInnerHTMLCapa(tab);
	return tab;
}

function tabla2(cual, cua2,txt) {
	var tab="";
	var eur = euros(cual);
	var cant = eur + ' <img src="/img/euro2.gif" width=8 height=9 border=0>  / '+ cual + ' pts';	
	
	tab='<table border=0 cellspacing=0  bgcolor="#F4c23d" cellpadding="0" width="290">';
	tab+='<tr>';
	tab+='<td class="CapaInformacion"><center><font color="#3300cc"> ' + txt + ' </font><font class="TextoCapaInformacion"> '+ cant + '</font></td>';
	tab+='</tr>';
	tab+='</table>';

	estableceInnerHTMLCapa(tab);
	return tab;
}

function tablaNueva(cual, cua2) {
	var tab="";
	var eur = euros(cua2);
	var cant = eur + ' <img src="/img/euro2.gif" width=8 height=9 border=0>  / '+ cual + ' pts';	
	
	tab='<table border=0 cellspacing=0  bgcolor="#F4c23d" cellpadding="0" width="290">';
	tab+='<tr>';
	tab+='<td class="CapaInformacion"><center><font color="#3300cc">' + cual +'</font><font class="TextoCapaInformacion"> '+ cant + '</font></td>';
	tab+='</tr>';
	tab+='</table>';

	estableceInnerHTMLCapa(tab);
	return tab;	 		 	
}

function tabla_texto(texto) {
	var tab="";
	
	tab='<table border=0 cellspacing=0 cellpadding="0" width="290">';
	tab+='<tr>';
	tab+='<td class="CapaInformacion"><center><font color="#3300cc"> '+ texto + '</font></center></td>';
	tab+='</tr>';
	tab+='</table>';

	estableceInnerHTMLCapa(tab);
	return tab;
}

function dc_tabla_texto(texto) {
	var tab="";
	
	tab='<table border=0 cellspacing=0 bgcolor="#F4c23d" cellpadding="0" width=290>';
	tab+='<tr>';
	tab+='<td class="CapaInformacion"><center><font color="#3300cc"> '+ texto + '</font></center></td>';
	tab+='</tr>';
	tab+='</table>';

	estableceInnerHTMLCapa(tab);
	return tab;
}

function dc_tabla_texto3(texto) {
	var tab="";
	
	tab='<table border=0 cellspacing=0 bgcolor="#F4c23d" cellpadding="0" width=290>';
	tab+='<tr>';
	tab+='<td class="CapaInformacion"><center><font color="#3300cc">Tiempo medio tramitación: <br> '+ texto + '</font></center></td>';
	tab+='</tr>';
	tab+='</table>';

	estableceInnerHTMLCapa(tab);
	return tab;
}

function tabla_textoi(cual) {
	var tab="";
	
	tab='<table border=0 cellspacing=0  bgcolor="#F4c23d" cellpadding="0" width="290">';
	tab+='<tr>';
	tab+='<td width=420 class="CapaInformacion" ><center><font color="#3300cc"> '+'&nbsp;'+ cual +'</font></center></td>';
	tab+='</tr>';
	tab+='</table>';
			
	estableceInnerHTMLCapa(tab);
	return tab;
}

function tablaTextoDocumentacion(cual) {
	var tab="";
	
	tab='<table border=0 cellspacing=0  bgcolor="#F4c23d" cellpadding="0" width="310">';
	tab+='<tr>';
	tab+='<td width=10/>';
	tab+='<td width=520 class="CapaInformacion" align="left"><font color="#3300cc"> '+'&nbsp;'+ cual +'</font></td>';
	tab+='</tr>';
	tab+='</table>';
			
	estableceInnerHTMLCapa(tab);
	return tab;
}

function tabla_textoi2(cual) {
	var tab="";
	
	tab='<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">    ';
  tab+='  <tr>';
  tab+='    <td><img src="/img/spacer.gif" width="20" height="1" border="0" alt="" /></td>';
  tab+='    <td><img src="/img/spacer.gif" width="148" height="1" border="0" alt="" /></td>';
  tab+='    <td><img src="/img/spacer.gif" width="16" height="1" border="0" alt="" /></td>';
  tab+='    <td><img src="/img/spacer.gif" width="1" height="1" border="0" alt="" /></td>';
  tab+='  </tr>';
  tab+='  <tr>';
  tab+='    <td width="20" height="20"><img name="menuFoltanteJun08_r1_c1" src="/img/menuFoltanteJun08_r1_c1.gif" width="20" height="20" border="0" id="menuFoltanteJun08_r1_c1" alt="" /></td>';
  tab+='    <td background="/img/menuFoltanteJun08_r1_c2.gif">&nbsp;</td>';
  tab+='    <td width="16" height="20"><img name="menuFoltanteJun08_r1_c3" src="/img/menuFoltanteJun08_r1_c3.gif" width="16" height="20" border="0" id="menuFoltanteJun08_r1_c3" alt="" /></td>';
  tab+='    <td><img src="/img/spacer.gif" width="1" height="20" border="0" alt="" /></td>';
  tab+='  </tr>';
  tab+='  <tr>';
  tab+='    <td background="/img/menuFoltanteJun08_r2_c1.gif">&nbsp;</td>';
  tab+='    <td valign="top" bgcolor="#006699"><span class="txtMenuFlotante2">' + cual + '</span></td>';
  tab+='    <td background="/img/menuFoltanteJun08_r2_c3.gif">&nbsp;</td>';
  tab+='    <td><img src="/img/spacer.gif" width="1" height="97" border="0" alt="" /></td>';
  tab+='  </tr>';
  tab+='  <tr>';
  tab+='    <td width="20" height="11"><img name="menuFoltanteJun08_r3_c1" src="/img/menuFoltanteJun08_r3_c1.gif" width="20" height="11" border="0" id="menuFoltanteJun08_r3_c1" alt="" /></td>';
  tab+='    <td background="/img/menuFoltanteJun08_r3_c2.gif"></td>';
  tab+='    <td><img name="menuFoltanteJun08_r3_c3" src="/img/menuFoltanteJun08_r3_c3.gif" width="16" height="11" border="0" id="menuFoltanteJun08_r3_c3" alt="" /></td>';
  tab+='    <td><img src="/img/spacer.gif" width="1" height="11" border="0" alt="" /></td>';
  tab+='  </tr>';
  tab+='</table>';
    
	estableceInnerHTMLCapa(tab);
	return tab;
}


function tabla_textoacto(cual) {
	var tab="";
	
	tab='<table border=0 cellspacing=0  bgcolor="#FFFFE1" cellpadding="0" width="290">';
	tab+='<tr>';
	tab+='<td width=420 class="Acto"><center><font color="#000000"> '+'&nbsp;'+ cual +'</font></td>';
	tab+='</tr>';
	tab+='</table>';

	estableceInnerHTMLCapa(tab);
	return tab;
}

function tabla_texto_justificado(cual) {
	var tab="";
	
	tab='<table border=0 cellspacing=0  bgcolor="#F4c23d" cellpadding="5" width="320">';
	tab+='<tr>';
	tab+='<td class="CapaInformacion"  style="text-align:justify"> <font color="#3300cc" > '+ cual +'</font></td>';
	tab+='</tr>';
	tab+='</table>';

	estableceInnerHTMLCapa(tab);
	return tab;
}

function tabla_textoayuda(cual) {
	var tab="";
	
	tab='<table border=0 cellspacing=0 bgcolor="#003399" cellpadding="0" width="290">';
	tab+='<tr>';
	tab+='<td width=420 class="CapaInformacion"><center><font color="#3300cc"> '+'&nbsp;'+ cual +'</font></td>';
	tab+='</tr>';
	tab+='</table>';

	estableceInnerHTMLCapa(tab);
	return tab;
}

function tabla_precio(pmoneda_origen,codmoneda_origen,texto) {
	//El precio se calcula segun la moneda
	var tab="";
	var precio_euros;
	//var precio_pts;
	var cant;

	if (codmoneda_origen==2) {
		precio_euros  = euros(pmoneda_origen);	
		//precio_pts = pmoneda_origen;
	}
	else {
		//precio_pts= pesetas(pmoneda_origen);
		precio_euros = pmoneda_origen;
	}		

	cant = precio_euros + ' <img src="/img/euro2.gif" width="8" height="9" border="0"/>';	
	
	tab='<table border=0 cellspacing=0 bgcolor="#F4c23d" cellpadding="0" width="290">';
	tab+='<tr>';
	tab+='<td class="CapaInformacion"><center><font color="#3300cc"> El precio del servicio es de </font><font class="TextoCapaInformacion"> '+ cant + texto + '</font></td>';
	tab+='</tr>';
	tab+='</table>';

	estableceInnerHTMLCapa(tab);
	return tab;
}

function tabla_textop(cual) {
	var tab="";
	
	tab+='<table border=0 cellspacing=0 width=100% bgcolor="#F4c23d" cellpadding="0" width=220>';
	tab+='<tr>';
	tab+='<td width=220 class="CapaInformacion"><center><font color="#3300cc"> '+'&nbsp;'+ cual +'</font></td>';
	tab+='</tr>';
	tab+='</table>';

	estableceInnerHTMLCapa(tab);
	return tab;
}

/**
  * Función que se llama desde todas las tabla_xxxxx para establecer el texto html en la etiqueta
  * TODO: no necesario, pero mantenido por compatibilidad de código.
  */
function estableceInnerHTMLCapa(html) {
	
	var capa = getCapaMensajeEmergente();
		
	if (capa) {
	
		if (ns4) {
			capa.document.open();
			capa.document.write(html);
			capa.document.close();
		}
		else{
			capa.innerHTML = html;	  	
		}
	}
}

///////////////////////////////////////////////////////////////
// funciones mostrar
///////////////////////////////////////////////////////////////
function mostrari(cual) {
	var html = tabla_textoi(cual); 
	mostrarCapa(html);
		
}
function mostrarTextoDocumentacion(cual) {
	var html = tabla_texto_justificado(cual); 
	mostrarCapa(html);
		
}

function mostrarFlotante(cual) {
	var html = tabla_textoi2(cual); 
	mostrarCapa(html);
}



function mostrariarriba(cual) {
	var html = tabla_textoi(cual);
	mostrarCapa(html, -310, -75, true);
	
}
function mostrari1(cual) {
	var html = tabla_textoacto(cual);
	mostrarCapa(html, undefined, 15, true);
	
}			
function mostrari2(cual) {
	var html = tabla_textoi(cual);
	mostrarCapa(html, 10, -50, true);
	
}

function mostrar(cual) {
	var html = tabla(cual, '');
	mostrarCapa(html, -310, undefined, true);
	
}

function mostrard(cual) {
	var html = tabla(cual, '');
	mostrarCapa(html, 5, undefined, true);
	
}

function mostrar2(cual, cua2) {
	var html = "";
	
	if (cual==-1)
		html = tabla_texto(cua2);
	else {
		//NO TOCAR Gestoria Virtual
		html = tabla(cual, cua2);
		//tabla(cua2,'');			
	}
	mostrarCapa(html, -310, undefined, true);
	
}

function dcmostrar3(cual,cua2) {	
	var html = "";
	
	if(cual==-1)
		html = dc_tabla_texto3(cua2);
	else
		html = dc_tabla3(cual, cua2);
		
	mostrarCapa(html, -310, -20, true);
	
	
}

function dcmostrar2(cual, cua2) {
	var html = "";
	
	if (cual==-1) 
		html = dc_tabla_texto(cua2);
	else {
		//NO TOCAR Gestoria Virtual
		html = dc_tabla(cual, cua2);
		//tabla(cua2,'');			
	}
	mostrarCapa(html, -310, undefined, true);
	
	
}

function dcmostrar(cual, cua2,x,y) {
	var html = "";
	
	if (cual==-1)
		html = dc_tabla_texto(cua2);
	else
		html = dc_tabla(cual, cua2);
		
	mostrarCapa(html, x, y, true);
	
	
}

function mostrar3(cual, cua2) {
	var html = tablaNueva(cual,cua2);
	mostrarCapa(html, -310, undefined, true);
	
}

function mostrar4(cual) {
	var html = tabla1(cual, '');
	mostrarCapa(html, -310, undefined, true);
	
	
}

function mostrardrch(cual) {
	var html = tabla_texto(cual);
	mostrarCapa(html, xPos, yPos, false);	// posicionamiento absoluto
	
	
}

function mostrar5(cual,txt) {
	var html = tabla2(cual, '',txt);
	mostrarCapa(html, -310, undefined, true);	// posicionamiento relativo
	
	
}			

function mostrar_precio(pmoneda_origen,codmoneda_origen,texto) {	
	mostrarPrecioPosicionAdaptativa(pmoneda_origen,codmoneda_origen,texto);
}
// obsoleto
function mostrar_precioderecha(pmoneda_origen,codmoneda_origen,texto) {	
	mostrarPrecioPosicionAdaptativa(pmoneda_origen,codmoneda_origen,texto);
}
// obsoleto
function mostrar_preciod(pmoneda_origen,codmoneda_origen,texto) {
	mostrarPrecioPosicionAdaptativa(pmoneda_origen,codmoneda_origen,texto);
}
// obsoleto
function mostrar_precio2(pmoneda_origen,codmoneda_origen,texto) {
	mostrarPrecioPosicionAdaptativa(pmoneda_origen,codmoneda_origen,texto);
}

/**
 * Muestra el mensaje emergente del precio, calculando si mostrarlos a la derecha o izquierda dependiendo del
 * tamaño de la ventana
 */
function mostrarPrecioPosicionAdaptativa(pmoneda_origen, codmoneda_origen, texto) {
	var html = "Sin definir precio";
	
	if (pmoneda_origen == -1)
		html = tabla_texto(texto);
	else
		html = tabla_precio(pmoneda_origen,codmoneda_origen,texto);
	mostrarCapa(html);
}

///////////////////////////////////////////////////////////////

/**
 * Objeto que contiene información del navegador del cliente. Información como
 * el nombr, su versión, el ancho actual de la ventana de navegación
 * 
 * Propiedades:
 *  - nombre,			nombre del navegador
 *  - version,			indica la versión (V.x)
 *  - isIE,				flag que indica si es Internet Explorer
 *  - isNetscape,		flag que indica si es Netscape
 *  - isOpera,			flag que indica si es Opera
 *  - isJavaEnabled,	flag que indica si tiene habilitado la maquina virtual Java
 *  - isCookieEnabled,	flag que indica si tiene habilitadas las cookies
 * 
 * Métodos;
 * 	- anchoVentana,		devuelve el tamaño en pixeles del ancho de la ventana actual
 * 	- altoVentana,		devuelve el tamaño en pixeles del alto de la ventana actual
 *
 * La instancia del navegador se obtiene llamado a la función GetNavegador()
 * 
 * @version 1.0 (11/9/2006) brarcos
 */
function Navegador() {				
	// Cadena con la descripción del navegador				
	this.nombre = navigator.appName;
					
	// indica si está habilitado java en el navegador
	this.isJavaEnabled = navigator.javaEnabled() == 1;
	
	// indican si están habilitadas las cookies
	this.isCookieEnabled = navigator.cookieEnabled == false;
	
	// indica si usuamos un determinado tipo de navegador
	this.isNetscape = this.nombre.indexOf("Netscape") != -1;
	this.isOpera = this.nombre.indexOf("Opera") != -1;
	this.isIE = this.nombre.indexOf("Explorer") != -1;
	
	// leemos la version del navegador
	this.version = navigator.appVersion;
	if (this.isIE)
		this.version = navigator.appVersion.match("MSIE (\\d+)")[1];
	else if (this.isNetscape || this.isOpera)
		this.version = navigator.appVersion.match("\\d+");
	
	// indica el ancho actual del navegador
	this.anchoVentana = function () {					
		// valido para IE 4.0+, Netscape 7.0+, Opera 7.0+
		return document.body.clientWidth;		
	}
	
	// indica el alto actual del navegador
	this.altoVentana = function () {
		// valido para IE 4.0+, Netscape 7.0+, Opera 7.0+
		return document.body.clientWidth;		
	}								
}

// instancia privada del navegador, NO usar, para obtener el navegador 
// llamar a getNavegador
var _navegador;

/**
 * Devuelve la instancia del objeto Navegador
 *
 * @version 1.0 (4/9/2006) brarcos
 */
function getNavegador() {
	if (_navegador == undefined || _navegador == null)
		_navegador = new Navegador();
	return _navegador;
}

/**
 * Añade una etiqueta DIV con un id determinado al BODY del documento
 *
 * Válido para IE 5.0+, Opera 8.0+, Netscape 6.0+
 *  
 * @param {String} id nombre del div que debe ser único
 * @return Referencia al div creado
 * 
 * @version 1.0 (4/9/2006) brarcos
 */
function addDiv(id) {
	var nodo;	
	
	//alert("escribir");
	tab='<div id="' + id + '" style="position:absolute; top:0;left:0;visibility:hidden;z-Index:100"></div>';	 	
	document.write(tab);
	nodo=document.getElementById(id);	// capaMensajeEmergente
		
		
	bExisteCapa=true;
	return nodo;
}

/**
 * Función que devuelve la referencia a la capa para mostrar un mensaje emergente
 *
 * Válido para IE 5.0+, Opera 8.0+, Netscape 6.0+
 *
 * @version 1.0 (4/9/2006) brarcos
 */
function getCapaMensajeEmergente() {
		
	
	// leemos el div para mostrar el mensaje	
	var capa = document.getElementById('capa');	// capaMensajeEmergente
		
	// comprobamos si existe, si no lo creamos 
	if (!capa) {				
		capa = addDiv('capa'); 	
	}	
	
	return capa;
}

/**
 * Función que muestra una capa con un contenido html que indica el usuario, por
 * ejemplo una tabla, un div o cualquier otra cosa. 
 * 
 * Coloca la capa de forma que no sobresale del tamaño actual del la ventana
 * del navegador.
 * 
 * @param html {String} Una etiqueta html con el contenido que se desee, por ejemplo: 
 *				<html width="200px"><tr><td>Hola</td></tr></html>  ó  <div style="width:100px"><p>Adios</p></div>  ó
 *				<p>Hi ho</p> (se establece un ancho fijo)
 * @param posx {int} OPCIONAL si se establece determina la posición del mensaje en x en la pantalla de navegador
 * @param posy {int} OPCIONAL si se establece determina la posición del mensaje en y en la pantalla de navegador
 * @param relativo {boolean} OPCIONAL si se establece determina si posx y posy son relativas o absolutas a la posición del cursor actual
 *
 * Válido para IE 5.0+, Opera 8.0+, Netscape 6.0+
 * 
 * @version 1.0 (4/9/2006) brarcos
 */
function mostrarCapa(html, posx, posy, relativo) {
	// obtenemos la referencia a la capa
	var capa = getCapaMensajeEmergente();
	
	
	if (capa) {
					
		// mostramos el mensaje
		if (html!=undefined)
			capa.innerHTML = html;
		
		// establecer ancho
		capa.style.width = getAnchoDiv(capa, 310) + "px";
				
		// coloca el div en la posición adecuada dependiendo de los parametros pasados
		posicionarDiv(capa, posx, posy, relativo);	
		
		// visualizamos la capa
		capa.style.visibility = "visible";
	}
}

/**
 * Coloca el div capa en la posición indicada por posx y posy. Si está establecido relativo a true, lo posiciona en función
 * de la posición actual del cursor (variables globales xPos e yPos).
 * Si no se establece posx y posy, se posicionará dependiendo de la posición del cursor y del ancho del div, teniendo en cuenta el tamaño
 * de la ventana para que la capa no salga de estos margenes
 * 
 * @version 1.0 (4/9/2006) brarcos 
 */
function posicionarDiv(capa, posx, posy, relativo) {
	var anchoDiv  = getAnchoDiv(capa);
	var posXFinal = null;
	var posYFinal = null;
	
	// posicionamos en x
	if (posx != undefined && ! isNaN(posx)) {
		posXFinal = posx;
		if (relativo)
			posXFinal += xPos;
	} else	// posicionamos en la posición del cursor
		posXFinal = (xPos + anchoDiv) > getNavegador().anchoVentana() ? xPos - anchoDiv : xPos;
		
	// posicionamos en y
	if (posy != undefined && ! isNaN(posy)) {
		posYFinal = posy;
		if (relativo)
			posYFinal += yPos;
	} else // posicionamos en la posición del cursor (por debajo)
		posYFinal = yPos + 20;	
	
	capa.style.top  = posYFinal + "px";
	capa.style.left = posXFinal + "px";
}

/**
 * Función que intenta leer el ancho de una etiqueta DIV. Realiza los siguientes pasos para averiguarlo:
 * 	- Intenta leer el atributo width del elemento HIJO del DIV
 *	- Intenta leer la propiedad style.width del elemento HIJO del DIV
 *	- Intenta leer la propiedad style.width del DIV
 *	- Si no consigue obtener ningún tamaño, devuelve el anchoDefecto que recibe (si no lo recibe se establece a 310)
 *
 * @version 1.0 (4/9/2006) brarcos
 */
function getAnchoDiv(capa, anchoDefecto) {
	var anchoDiv = NaN;
	
	// comprobamos si tiene hijo
	if (capa.firstChild && capa.firstChild.getAttribute) {
		anchoDiv = capa.firstChild.getAttribute("width");
		if (isNaN(anchoDiv)) {					
			anchoDiv = capa.firstChild.style.width;			
			anchoDiv = anchoDiv.match("\\d+");
		}
	} else {	// no tiene hijo
		anchoDiv = capa.style.width;
		anchoDiv = anchoDiv.match("\\d+");		
	}
	anchoDiv = parseInt(anchoDiv);
	
	if (isNaN(anchoDiv))
		anchoDiv = anchoDefecto ? anchoDefecto : 310;
	
	return anchoDiv;
}
-->
