asColoresActual = new Array(); anAlturas = new Array( 44, 50, 25, 25 ); nBotonSobreActual = -1; nBotonSobrePpalActual = -1; nNivelActual = -1; intervaloMenus = null; function guardarColoresBoton( nNivel, sColor_0, sColor_1, sColor_2, sColor_3 ) { var asColores = new Array( "", "#1d1d1b", "#FFF", "#FFF" ); if( nNivel >= 2 ) asColores = new Array( "#626262", "#3A3333", "#FFF", "#FFF" ); else if( nNivel > 0 ) asColores = new Array( "#1d1d1b", "#878787", "#FFF", "#FFF" ); for( c=0; c < asColores.length; c++ ) { if( eval("sColor_"+c) != "" ) asColores[c] = eval("sColor_"+c); } asColoresActual.push( asColores[0]+","+asColores[1]+","+asColores[2]+","+asColores[3] ); //alert( sColor_0+","+sColor_1+","+sColor_2+","+sColor_3+"///"+asColores[0]+","+asColores[1]+","+asColores[2]+","+asColores[3] ); } function configurarMenu( sId ) { var nMargen = 0; //alert( document.getElementById( "menus" ).innerHTML ); var aMenus = getElementsByClassName( document.getElementById( "menus" ), "menu" ); var aDesplegables = getElementsByClassName( document.getElementById( "menus" ), "desplegable" ); var aFondosDesplegables = getElementsByClassName( document.getElementById( "menus" ), "fondoDesplegable" ); nAlturaBotones = 44; var nAncho = 1268 / aMenus.length; var anAnchos = new Array(); var nX = 0; document.getElementById( "menus" ).style.width = 1268+"px"; var aBotonesPpal = getElementsByClassName( document.getElementById( "menus" ), "nivel0" ); var nAnchuraTotal = 0; for( nm = 0; nm < aBotonesPpal.length; nm++ ) { var span = aBotonesPpal[nm].getElementsByTagName( "span" )[0]; anAnchos[nm] = getElementsByClassName( aBotonesPpal[nm], "enlace" )[0].scrollWidth; if( anAnchos[nm] == 0 ) anAnchos[nm] = span.scrollWidth; nAnchuraTotal += anAnchos[nm]; span.innerHTML = span.innerHTML.replace( /;;;/g, " " ); } nAnchuraTotal = (1268 - nAnchuraTotal) / aBotonesPpal.length; for( nm = 0; nm < aBotonesPpal.length; nm++ ) anAnchos[nm] += nAnchuraTotal; anAnchos[0] -= 20; anAnchos[1] -= 10; anAnchos[2] += 50; anAnchos[3] -= 0; anAnchos[4] -= 0; anAnchos[5] -= 10; anAnchos[6] -= 10; //Botones var nNumTotalBoton = 0; var anSizes = new Array( 20, 18, 17, 17 ); var nNumBotonesTotal = 0; nBotonPpalActual = -1; for( nm = 0; nm < aMenus.length; nm++ ) { nAncho = anAnchos[nm]; aMenus[ nm ].style.left = nX+"px"; aMenus[ nm ].style.width = nAncho+"px"; aMenus[ nm ].style.height = 0+"px"; nX += nAncho; var aBotones = getElementsByClassName( aMenus[ nm ], "boton" ); for( d = 0; d < aBotones.length; d++ ) { var asColores = asColoresActual[nNumBotonesTotal].split( "," ); var nNivel = getElementsByClassName( aBotones[ d ], "nivel" )[0].id.split( "-" )[1]; var enlace = getElementsByClassName( aBotones[ d ], "enlace" )[0]; enlace.style.width = nAncho-nMargen-0+"px"; enlace.style.paddingLeft = 0+"px"; enlace.style.paddingRight = 0+"px"; enlace.style.fontSize = anSizes[ nNivel ]+"px"; enlace.style.top = anAlturas[ nNivel ]/2-enlace.scrollHeight/2+"px"; var aAs = enlace.getElementsByTagName("a"); if( aAs.length > 0 ) aAs[0].style.color = asColores[2]; aBotones[ d ].style.width = nAncho-nMargen+"px"; aBotones[ d ].style.height = anAlturas[ nNivel ]+"px"; var aFondosBotonesDesplegables = getElementsByClassName( aBotones[ d ], "fondoBoton" ); aFondosBotonesDesplegables[ 0 ].style.width = nAncho+2+"px"; aFondosBotonesDesplegables[ 0 ].style.height = anAlturas[ nNivel ]+"px"; aFondosBotonesDesplegables[ 0 ].style.backgroundColor = asColores[0]; var sIdBoton = getElementsByClassName( aBotones[ d ], "idBoton" )[0].id.split( "-" )[1]; if( sIdBoton == sId && nNivel == 0 ) { nBotonPpalActual = nNumBotonesTotal; document.getElementById( "fondoSel"+sId ).style.left = -1+"px"; document.getElementById( "fondoSel"+sId ).style.width = nAncho+2+"px"; document.getElementById( "fondoSel"+sId ).style.height = anAlturas[ nNivel ]+"px"; document.getElementById( "fondoSel"+sId ).style.display = "block"; } if( nNivel > 0 ) { aFondosBotonesDesplegables[ 0 ].style.borderTop = "1px solid #fff"; aBotones[ d ].style.display = "none"; } nNumBotonesTotal++; } //Desplegables aFondosDesplegables[ nm ].style.width = nAncho+"px"; aFondosDesplegables[ nm ].style.top = 0 +"px"; aFondosDesplegables[ nm ].style.height =0 +"px"; aDesplegables[ nm ].style.top = nAlturaBotones +"px"; aDesplegables[ nm ].style.width = nAncho+"px"; aDesplegables[ nm ].style.display = "none"; aDesplegables[ nm ].style.visibility = "visible"; } nX = 0; //Palitos for( nm = 0; nm <= aMenus.length; nm++ ) { nAncho = anAnchos[nm]; document.getElementById( "palitos" ).innerHTML += "
"; nX += nAncho; } } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // MENUS DESPLEGABLES ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function sobreBoton( nBoton, nNivel ) { if( nBoton != nBotonSobreActual && intervaloMenus == null ) { if( nBotonSobreActual != -1 ) { if( nNivelActual == 0 && nNivel == 0 ) fueraMenu(); else if( nNivelActual != 0 ) fueraBoton( nNivelActual ); } if( nNivel == 0 ) { document.getElementById( "desplegable"+nBoton ).style.display = "block"; document.getElementById( "fondoMenus" ).style.display = "block"; document.getElementById( "fondoDesplegable"+nBoton ).style.height = 0+"px"; document.getElementById( "fondoDesplegable"+nBoton ).style.display = "block"; nBotonSobrePpalActual = nBoton; } nBotonSobreActual = nBoton; nNivelActual = nNivel; cambiarColor( nBoton, 1, 3, nNivelActual ); nBotonActual = 0; var sId = getElementsByClassName( document.getElementById( "boton"+nBotonSobreActual ), "idBoton" )[0].id.split( "-" )[1]; aBotones = getElementsByClassName( document.getElementById( "desplegable"+nBotonSobrePpalActual ), "boton"+sId ); //alert( aBotones.length ); if( aBotones.length > 0 ) intervaloMenus = window.setInterval( "desplegar()", 25 ); } } function cambiarColor( nBoton, nFondo, nTexto, nNivel ) { var asColores = asColoresActual[nBoton].split( "," ); if( document.getElementById( "a-boton"+nBoton ) != null ) document.getElementById( "a-boton"+nBoton ).style.color = asColores[nTexto]; if( nNivel == 0 ) { //Sobre boton if( nFondo == 1 ) { //if( nBoton == 0 ) document.getElementById( "enlace"+nBoton ).style.borderLeft = "1px solid "+asColores[nFondo]; //document.getElementById( "enlace"+nBoton ).style.borderRight = "none"; } else { //if( nBoton == 0 ) document.getElementById( "enlace"+nBoton ).style.borderLeft = "1px solid #fff"; //document.getElementById( "enlace"+nBoton ).style.borderRight = "1px solid #fff"; } } document.getElementById( "fondoBoton"+nBoton ).style.backgroundColor = asColores[nFondo]; } function fueraBoton( nNivel ) { cambiarColor( nBotonSobreActual, 0, 2, nNivel ); sBotonSobreActual = -1; nNivelActual = -1; } function desplegar() { if( aBotones.length > 0 ) { aBotones[ nBotonActual ].style.display = "block"; document.getElementById( "fondoDesplegable"+nBotonSobrePpalActual ).style.height = aBotones.length*anAlturas[nNivelActual]*nCal+"px"; if( ++nBotonActual >= aBotones.length ) { window.clearInterval( intervaloMenus ); intervaloMenus = null; } } } function fueraMenu() { if( nBotonSobrePpalActual != -1 ) { window.clearInterval( intervaloMenus ); intervaloMenus = null; document.getElementById( "desplegable"+nBotonSobrePpalActual ).style.display = "none"; document.getElementById( "fondoDesplegable"+nBotonSobrePpalActual ).style.display = "none"; cambiarColor( nBotonSobrePpalActual, 0, 2, 0 ); var aBotones = getElementsByClassName( document.getElementById( "desplegable"+nBotonSobrePpalActual ), "boton" ); if( aBotones.length > 0 ) { for( ab = 0; ab < aBotones.length; ab++ ) { cambiarColor( ab+parseInt(nBotonSobrePpalActual)+1, 0, 2, 1 ); aBotones[ab].style.display = "none"; } } document.getElementById( "fondoMenus" ).style.display = "none"; nBotonSobreActual = -1; nBotonSobrePpalActual = -1; nNivelActual = -1; } }