var constSpHg=12; var ruta=dameRuta();var constAnchoCombo=137; var constAncho=255; var consScroll=12;var consTime=300; var consSalida=50; var desH=2; var desW=-2; var desL=1; var desT=0; var cHeight;var cleft; var	ctop; var	cp; var x; var y;
for (var i=0; i<nivel.length; i++){ eval('var esVisible'+i+' = false'); eval('var winW'+i+'=0'); eval('var winH'+i+'=0'); eval('var posIniTopIni'+i+'=(topy'+i+'+posy'+i+'+3)');
eval('var posIniTop'+i+'=(topy'+i+'+posy'+i+'+3)'); eval('var posIniLeftIni'+i+'=posx'+i); eval('var posIniLeft'+i+'=posx'+i);eval('var inicio2'+i+'=0');eval('var fin2'+i+'=0');
if (isNS4){eval('var combo'+i+' = document.idNivel'+i);eval('var tabla'+i+' = document.idTabla'+i);eval('var cuadro'+i+' = document.idCuadro'+i);eval('var scroll'+i+' = document.idScroll'+i);}
else if (isIE4){eval('var combo'+i+' = idNivel'+i+'.style');eval('var tabla'+i+' = idTabla'+i+'.style');eval('var cuadro'+i+' = idCuadro'+i+'.style');eval('var scroll'+i+' = idScroll'+i+'.style');
}else{eval('var combo'+i+' = document.getElementById("idNivel'+i+'").style');eval('var tabla'+i+' = document.getElementById("idTabla'+i+'").style');eval('var cuadro'+i+' = document.getElementById("idCuadro'+i+'").style');eval('var scroll'+i+' = document.getElementById("idScroll'+i+'").style');
}}if (isNS4){var pestana = document.posicion;}else if (isIE4){var pestana = posicion.style;}else{var pestana = document.getElementById("posicion").style;}
function ini(){for (var i=0; i<nivel.length; i++){construirCapa(i);}}document.onmousemove= MovimientoRaton;
if (isNS4){document.captureEvents(Event.MOUSEMOVE);}if (isNS4){mostrarSi= 'show';mostrarNo= 'hide';}else if (isIE4){mostrarSi= 'visible';mostrarNo= 'hidden';}
else{if (isNM){desH=0;desW=0;}mostrarSi= 'visible';mostrarNo= 'hidden';}
function CerrarTodas(){for (var i=0;i<nivel.length;i++){eval('var es=esVisible'+i);if(es){CerrarCapa(i);}}}
function CerrarCapa(indice){eval('var es=esVisible'+indice);if (es){eval('Ocultar(combo'+indice+','+indice+')');
eval('Ocultar(tabla'+indice+','+indice+')');eval('Ocultar(cuadro'+indice+','+indice+')');eval('Ocultar(scroll'+indice+','+indice+')');}}
function MostrarCapa (indice){CerrarTodas();if (nivel[indice].length>maxScroll)	{eval('situarCapa(scroll'+indice+',posIniLeft'+indice+'+winW'+indice+'+2,posIniTop'+indice+'-1)');
eval('Mostrar(scroll'+indice+','+indice+')');}eval('Mostrar(tabla'+indice+','+indice+')');eval('Mostrar(cuadro'+indice+','+indice+')');eval('Mostrar(combo'+indice+','+indice+')');}
function Mostrar (objeto, indice){if (indice!="N") eval('esVisible'+indice+' = true');objeto.visibility= mostrarSi;}			
function Ocultar (objeto, indice){if (indice!="N") eval('esVisible'+indice+' = false');objeto.visibility= mostrarNo;}
function situarCapa (objeto, a, b){ if (a!=0){ if (!(isNaN(a))){objeto.left = a;}}if (b!=0){if (!(isNaN(b))){objeto.top  = b;}}}
function scrollArriba(indice){eval('var inicio2=inicio2'+indice);eval('var fin2=fin2'+indice);if((inicio2>0)&&(mover==1)){eval('inicio2'+indice+'=inicio2'+indice+'-1');
eval('fin2'+indice+'=fin2'+indice+'-1');eval('txt=generarTxt(indice, inicio2'+indice+', fin2'+indice+')');GenerarCapa(txt, indice, "idNivel");eval('setTimeout("scrollArriba('+indice+')",consTime)');}}
function scrollAbajo(indice){eval('var inicio2=inicio2'+indice);eval('var fin2=fin2'+indice);if((fin2<nivel[indice].length)&&(mover==2)){eval('inicio2'+indice+'=inicio2'+indice+'+1');
eval('fin2'+indice+'=fin2'+indice+'+1');eval('txt=generarTxt(indice, inicio2'+indice+', fin2'+indice+')');GenerarCapa(txt, indice, "idNivel");eval('setTimeout("scrollAbajo('+indice+')",consTime)');}}
function generarTxt(indice, inicio2, fin2){txt='<table border=0 cellspacing=0 cellpadding=0>';for(var i=inicio2; i<fin2; i++){
if (esUrl(i, indice)){txt +='<tr><td width="5" height="1"></td><td align="left" valign="top"><a href="'+enlaces[indice][i]+'" onmouseover="mostrarCuadro('+i+','+indice+')" onmouseout="mostrarCuadro('+i+','+indice+')" target="_new" class="tn11">&nbsp;'+nivel[indice][i]+'</a></td></tr>';}else{
txt +='<tr><td width="5" height="1"></td><td align="left" valign="top"><a href="'+enlaces[indice][i]+'" onmouseover="mostrarCuadro('+i+','+indice+')" onmouseout="mostrarCuadro('+i+','+indice+')" class="tn11">&nbsp;'+nivel[indice][i]+'</a></td></tr>';}}txt +='</table>';return txt;}
function construirCapa (indice){txt=generarTxt(indice, 0, nivel[indice].length);GenerarCapa(txt, indice, "idNivel");
if (isIE4){eval('winW'+indice+' = document.idNivel'+indice+'.offsetWidth');}else if (isNS4){eval('winW'+indice+' = document.idNivel'+indice+'.document.width');}else{eval('winW'+indice+' = document.getElementById("idNivel'+indice+'").offsetWidth');}
eval('var es=esVisible'+indice);if (!es){CerrarTodas();if (nivel[indice].length>maxScroll){eval('fin2'+indice+'=maxScroll');}else{eval('fin2'+indice+'=nivel[indice].length');}
eval('txt=generarTxt(indice, inicio2'+indice+', fin2'+indice+')');GenerarCapa (txt, indice, "idNivel");generarFondo(indice);eval('situarCapa(combo'+indice+',posIniLeft'+indice+',posIniTop'+indice+')');}}
function construirYMostrarPestana (indice, texto){txt='<table border="0" cellspacing="0" cellpadding="0"><tr>';
txt +='<td width="1" bgcolor="#7A181D" width="1"><img src="'+ruta+'img/sp.gif" width="1" height="1"></td>';txt +='<td width="8" bgcolor="#F5ECFF" valign="middle"><img src="'+ruta+'img/sp.gif" width="8"></td>';
txt +='<td width="143" bgcolor="#F5ECFF" valign="middle" class="tn11">'+texto+'</td>';txt +='<td width="1" bgcolor="#7A181D"><img src="'+ruta+'img/sp.gif" width="1"></td></tr><tr>';
txt +='<td colspan="4" width="153" bgcolor="#F5ECFF"><img src="'+ruta+'img/pestan.gif" width="153" height="6"></td></tr></table>';		if (isIE4){
cleft=eval('document.ind'+indice+'.offsetLeft');ctop=eval('document.ind'+indice+'.offsetTop');}else if (isNS4){			cleft=eval('document.ind'+indice+'.left');
ctop=eval('document.ind'+indice+'.top');cp=eval('document.ind'+indice+'.top');alert(cp);}else{cleft=eval('document.getElementById("ind'+indice+'").offsetLeft');
ctop=eval('document.getElementById("ind'+indice+'").offsetTop');}situarCapa(pestana, cleft, (ctop-5));Mostrar (pestana, "N");}
function GenerarCapa (txt, indice, objeto){if (isIE4){eval('document.all["'+objeto+indice+'"].innerHTML= txt');}else{if (isNS4){var capa=eval('document.'+objeto+indice+'.document');capa.write (txt);capa.close();}else{eval('document.getElementById("'+objeto+indice+'").innerHTML=txt');} } }
function generarFondo(indice){if (isIE4){eval('winH'+indice+' = idNivel'+indice+'.style.height');}else if (isNS4){eval('winH'+indice+' = document.idNivel'+indice+'.document.height');}else{eval('winH'+indice+' = document.getElementById("idNivel'+indice+'").offsetHeight');}	
eval('var wW=winW'+indice);eval('var wH=winH'+indice);if (nivel[indice].length<=maxScroll){var consAux=0;}else{var consAux=consScroll;}if ((wW+consAux)<constAnchoCombo){
eval('winW'+indice+'=(constAnchoCombo-consAux)');wW=(constAnchoCombo-consAux);}else if (indice==1){eval('posIniLeft'+indice+'=(posIniLeftIni'+indice+'-(wW+consAux-constAnchoCombo))');}
if (indice==2) colores = new Array('#00287A','#CAD1DF','#B8BDCD');else colores = new Array('#7A181D','#F5ECFF','#C6B5D9');
var contenido= '<table border="0" cellspacing="0" cellpadding="1" bgcolor="'+colores[0]+'"><tr><td align="left" valign="top"><table border="0" cellspacing="0" cellpadding="0" bgcolor="'+colores[1]+'"><tr><td align="left" valign="top"><img src="'+ruta+'img/sp.gif" width="'+wW+'" height="'+(wH+desH)+'"></td></table></td></table>';
GenerarCapa(contenido, indice, "idTabla");eval('situarCapa(tabla'+indice+',posIniLeft'+indice+',(posIniTop'+indice+'-1))');		contenido='<table border="0" cellspacing="0" cellpadding="1" bgcolor="'+colores[2]+'"><tr><td><img src="'+ruta+'img/sp.gif" width="'+(wW+desW)+'" height="'+constSpHg+'"></td></tr></table>';
GenerarCapa(contenido, indice, "idCuadro");eval('situarCapa(cuadro'+indice+',(posIniLeft'+indice+'+desL),(posIniTop'+indice+'+desT))');}
function mostrarCuadro (posicion, indice){eval('situarCapa(cuadro'+indice+',0,(('+posicion+'*constSpHg)+(posIniTop'+indice+'+desT)-(inicio2'+indice+'*constSpHg)))');}
function noEstadentro(x,y, indice){eval('var left=posIniLeft'+indice);eval('var topp=posIniTop'+indice);
eval('var wW=winW'+indice);eval('var wH=winH'+indice);if((nivel[indice].length>maxScroll)){wW=(wW+15);}if ((x>(left+wW))||(y>(topp+wH))){return true;}if ((x<left)||(y<(topp-consSalida))){return true;}else{return false;}}
function IntentaCerrarCapa (x,y,indice){if (noEstadentro(x,y,indice)){CerrarCapa(indice);}}
function MovimientoRaton (evento){if (isNS4){x= evento.pageX;y= evento.pageY;}else{if (isIE4||isIE5){x= window.event.x;y= (window.document.body.scrollTop + window.event.y);}else{x= evento.clientX; y= evento.clientY;} }
for (var i=0; i<nivel.length; i++){eval('var es=esVisible'+i);if (es){eval('window.setTimeout("IntentaCerrarCapa(x,y,'+i+')",1000)');}}}