//Activa una capa en el lugar donde esté el cursor
//Argumento: nombre de la capa y evento.
function mostDef(capa, e)
{
var doc= objHtml(capa);
var posx = e.clientX - doc.clientWidth;
if (miNavegador.IE){
     var papelY = document.body.scrollTop;
     if (e.clientY > (doc.clientHeight+15))
        doc.style.pixelTop = e.clientY + papelY - doc.clientHeight - 15;
     else
        doc.style.pixelTop = e.clientY + papelY + 15;
     doc.style.pixelLeft = (posx>0)?posx:25;
     doc.style.visibility="visible"
     }
else{
	 posx = e.pageX - doc.clip.width-10;
     var posic = e.pageY - window.pageYOffset;
     if (posic > doc.clip.height)
         doc.top =e.pageY - 25;
     else
         doc.top =e.pageY + 25;
     doc.left = (posx>0)?posx:25;    
     doc.visibility="visible";
     }
}

function ocultarDef(capa, e)
{
doc= objHtml(capa);
if (doc.style){
     doc.style.visibility="hidden"
     }
else{
     doc.visibility="hidden";
     }

}
//Activa para los elementos cuyo id comience por la palabra item seguida de un número
//la capa relacionada se denominará itemd seguido del mismo número.
function setupdefs()
{
var enlace;
var ind=1, idenl;
idenl = "item"+ind;
var enlace =objHtml(idenl);
while (enlace)
   {
    enlace.onmouseover = new Function("mostrar("+idenl+")");
    enlace.onmouseout = new Function("ocultar("+idenl+")");		
    ind++;
    idenl = "itemd"+ind;
    enlace = objHtml(idenl);
   }
/***** Rutina usada para dinamizar los enlaces en la capa barraindice **/
var capaindsec = objHtml('barra')

if (miNavegador.IE)
	{
	var enlaces = capaindsec.children.tags('a');
	var num, cuerpo
	var ind1 = new oIndice('indsecOn', 'indsecOff','');
	for (num=0; num<enlaces.length; num++)
		{
		ind1.agregar("indsec"+num, enlaces[num].innerText, enlaces[num],'');
		}
	ind1.iniciar();
	objHtml('cuerpo').style.height = objHtml('conten').offsetHeight;
	}
}

/**************************** Objetos Indices *************************/

function oIndice(estact, estnorm, desc)
{
this.activo = estact;
this.normal = estnorm;
this.lista = new Array();
this.nitems = 0;
this.descr = objHtml(desc);
this.ancho = 0;
this.agregar = oIndice_agregar;
this.entrar = oIndice_entra;
this.salir = oIndice_sale;
this.picar = oIndice_picar;
this.iniciar = oIndice_iniciar;
}

function oIndice_agregar(capa, titulo, enlace, desc)
{
this.lista[capa] = enlace;
this.lista[capa].padre = this;
this.lista[capa].descr = desc;
this.lista[capa].enlace = enlace+'';
this.lista[capa].titulo = titulo;
this.nitems++;
}

function oIndice_entra()
{
var obj = this.padre;
var ancho ;
if (miNavegador.IE)
	{
	this.className = obj.activo;
	this.style.cursor = "hand";
	if (this.descr)
		{
		this.padre.descr.innerText = this.descr
		this.padre.descr.style.visibility = 'visible'
		}
	}
else
	{
	ancho = obj.ancho;
	this.document.open()
	this.document.write('>table border="0" cellpadding="0" cellspacing="0">')
	this.document.write('<tr><td width="'+ancho+'" >');
	this.document.write('<span class="'+obj.activo+'">'+this.titulo+'</span>');
	this.document.write('</td></tr></table>');
	this.document.close()
	this.clip.width=ancho;
	}	
}

function oIndice_sale()
{
var obj = this.padre;
var ancho;
if (document.all){
	this.className = obj.normal;
	if (this.descr)
		this.padre.descr.style.visibility = 'hidden'
	}
else
	{
	ancho = obj.ancho;
	this.document.open()
	this.document.write('<table border="0" cellpadding="0" cellspacing="0">')
	this.document.write('<tr><td width="'+ancho+'" >');
	this.document.write('<span class="'+obj.normal+'">'+this.titulo+'</span>');
	this.document.write('</td></tr></table>');
	this.document.close();
	this.clip.width=ancho;
	}
}

function oIndice_picar()
{
location.href = this.enlace
}

function oIndice_iniciar()
{
var ind, ancho;
var obj = this.padre;
for (ind in this.lista)
	{
	obj = this.lista[ind];
	obj.padre = this;
	obj.onmouseover = this.entrar;
	obj.onmouseout = this.salir;
	obj.onclick = this.picar;	
	if (document.all)
		{
		obj.className = this.normal;	
		obj.innerText = obj.titulo;
		//obj.style.textAlign="center"
		}
	else
		{
		ancho = obj.clip.width-4;
		obj.document.open()
		obj.document.write('<table border="0" cellpadding="0" cellspacing="0">')
		obj.document.write('<tr><td width="'+ancho+'" >')
		obj.document.write('<span class="'+this.normal+'">');
		obj.document.write(obj.titulo+'</span></td></tr></table>');
		obj.document.close()
		obj.clip.width=ancho;
		this.ancho = ancho;
		}	
	}	
}

