function ini() {
    tab = document.getElementById('Menu');
    for (i = 0; ele = tab.getElementsByTagName('td')[i]; i++) {
        ele.onmouseover = function() { this.style.cursor = 'pointer'; iluminar(this, true) }
        ele.onmouseout = function() { iluminar(this, false) }
    }
    Selecciona('100'); document.getElementById('iFrameContenido').src = 'inicio.html';
}

function calculaAltoFrame() {

    document.getElementById('iFrameContenido').height = window.frames["iFrameContenido"].document.body.scrollHeight;
    
    var altoMenu = document.getElementById('Menu').offsetHeight;
    var altoIFrame = document.getElementById('iFrameContenido').height;
    var altoCertificados = '0';

    if (altoIFrame > altoMenu) 
        altoCertificados = (altoIFrame - altoMenu + 28).toString();
    else 
        altoCertificados = (altoMenu + 94).toString();

    document.getElementById('Certificados').setAttribute('height', altoCertificados);
}

function iluminar(obj, valor) {
    fila = obj.parentNode;
    for (i = 0; ele = fila.getElementsByTagName('td')[i]; i++)
        ele.style.background = (valor) ? '#FFE8E8' : '';
}

function Selecciona(idMenu) {
    
     document.getElementById('imagenCabecera').setAttribute('src', 'images/' + idMenu.toString() + '.jpg');

     for (fila = 0; opcion = document.getElementById('Menu').getElementsByTagName('tr')[fila]; fila++) {
         //B10AE9   CE00CE
         if (idMenu == opcion.id) opcion.style.color = '#B10AE9'; else opcion.style.color = '#6A6A6A';

//         if (idMenu == opcion.id) { if (opcion.id.substring(2, 3) == '0') opcion.className = 'ws10bSelecc'; else opcion.className = 'ws10Selecc'; } else { if (opcion.id.substring(2, 3) == '0') opcion.className = 'ws10b'; else opcion.className = 'ws10'; }
         if ((opcion.id.substring(1, 2) == '0')
          || (opcion.id.substring(2, 3) == 0 && opcion.id.substring(0, 1) == idMenu.substring(0, 1))
          || (opcion.id.substring(0, 2) == idMenu.substring(0, 2))
          )opcion.style.display = 'inline'; else opcion.style.display = 'none';

     }
     
     switch (idMenu) {
         case '100': document.getElementById('iFrameContenido').src = 'inicio.html'; break;
         case '200': document.getElementById('iFrameContenido').src = 'areas.html'; break;
         case '211': document.getElementById('iFrameContenido').src = 'edificacion/edif_admin.html'; break;
         case '212': document.getElementById('iFrameContenido').src = 'edificacion/edif_educ.html'; break;
         case '213': document.getElementById('iFrameContenido').src = 'edificacion/edif_sanit.html'; break;
         case '214': document.getElementById('iFrameContenido').src = 'edificacion/edif_deport.html'; break;
         case '221': document.getElementById('iFrameContenido').src = 'rehabilitacion/rehabilitacion.html'; break;
         case '230': document.getElementById('iFrameContenido').src = 'obracivil/obracivil.html'; break;
         case '300': document.getElementById('iFrameContenido').src = 'cuadernos.html'; break;
//         case '310': document.getElementById('iFrameContenido').src = 'cuadernos/cuadernoCondeDuque/conde_duque.html'; break;
//         case '320': document.getElementById('iFrameContenido').src = 'cuadernos/cuadernoCasaPinillos/casa_pinillos.html'; break;
         case '400': document.getElementById('iFrameContenido').src = 'calidad.html'; break;
         case '500': document.getElementById('iFrameContenido').src = 'cifrasnegocio.html'; break;
         case '600': document.getElementById('iFrameContenido').src = 'clientes.html'; break;
         case '700': document.getElementById('iFrameContenido').src = 'contactar.html'; break;


     }
     
}




