   // --- cmenus.js  versión 1.51 -- castellano ---------------------------------------------------------------------------------
   
   // Cambios de la version 1.51 ------------------------------------------------------------
   //   Si hay algun enlace de un elemento del menu o de la barra de botones que empieza 
   //   por / no lo concatena con la url raiz
   // Cambios de la version 1.5 -------------------------------------------------------------
   //   Se puede poner un array de imagenes para la cabecera que irán cambiando dinamicamente
   
   var raiz
   var mantenidaPor
   var mailMantenim
   var prePieComun
   var listaItems
   var barraBotones
   var listaImagenes  
   var infoCabecera
   var imgsCabecera
   var paginaInicial
   
   imgsCabecera = new Array("cabecera.gif");   // Por defecto solo una imagen en la cabecera

   // ------- Clase menuItem --------------------------------------------------------------------------------------------------   
   // Almacena un elemento del menu
   function menuItem (elNombre, elAncho, elAlto, laUrl, laInfo, elSubMenu) {
      this.nombre    = elNombre;      // Nombre de la imagen
	  this.url       = laUrl;         // Url destino de pinchar en el elento
	  this.info      = laInfo;        // Información de destino (alt)
	  this.pinta     = pintaItem;     // Funcion que genera el codigo del item
	  this.separador = pintaRaya;     // Método que genera el código del separador de los elementos del menu	  
	  this.imagenOn  = new Image (elAncho, elAlto);   // Imagen cuando el boton está activado
	  this.imagenOff = new Image (elAncho, elAlto);   // Imagen cuando el boton está desactivado
	  this.imagenOn.src  = raiz + "imagenes/menu/" + elNombre + "a.gif";
	  this.imagenOff.src = raiz + "imagenes/menu/" + elNombre + ".gif";	  
	  this.subMenu = elSubMenu
   }
   // Metodo que genera el codigo html de un elemento del menu
   // Se le pasa el nombre javascript para llegar al objeto 
   function pintaItem (nombreObj) {
	  document.write("<tr BGCOLOR=\"#FFFFFF\">");
      document.write("  <td ALIGN=\"left\" VALIGN=\"top\">");
	  if ((this.url.substr(0,4)=="http") || (this.url.substr(0,1)=="/")) document.write ("<a href=\"" + this.url +"\" ");
	  else document.write ("<a href=\"" +raiz + this.url +"\" ");
	  document.write("    onMouseover=\"document['" +this.nombre+ "'].src = " + nombreObj + ".imagenOn.src\"  ");
	  document.write("    onMouseout=\"document['" +this.nombre+ "'].src = " + nombreObj + ".imagenOff.src\"  ");
	  document.write(" ><img src=\""+raiz+"imagenes/menu/" +this.nombre+".gif\"" );
	  document.write("       name=\"" + this.nombre+ "\" " );
	  document.write("       alt=\"" + this.info + "\" ");
	  document.write("       title=\"" + this.info + "\" ");	  
	  document.write("       nosave=\"\"");
	  document.write("       border=\"0\"");
	  document.write("       height=\"" +this.imagenOn.height+ "\"");
	  document.write("       width=\"" +this.imagenOn.width+ "\"></a></td>");
      document.write("</tr>");
   }
   // Metodo que genera el codigo html de el separador de los elementos del menu
   function pintaRaya () {
      document.write("<tr BGCOLOR=\"#FFFFFF\">");
      document.write("  <td ALIGN=\"left\" VALIGN=\"top\"><img src=\"imagenes/menu/raya.gif\" border=\"0\" width=\"126\" height=\"1\"></td>");
      document.write("</tr>");
   }
   // ----------- Fin clase menuItem -------------------------------------------------------------------------------------------

   
   // ------- Clase barraItem --------------------------------------------------------------------------------------------------   
   // Almacena un elemento de la barra de enlaces
   function barraItem (elNombre, elAncho, elAlto, laUrl, laInfo) {
      this.nombre    = elNombre;        // Nombre de la imagen
	  this.url       = laUrl;           // Url destino de pinchar en el elento
	  this.info      = laInfo;          // Información de destino (alt)
	  this.pinta     = pintaBarraItem;  // Método que genera el codigo del item
	  this.imagenOn  = new Image (elAncho, elAlto);
	  this.imagenOff = new Image (elAncho, elAlto);
	  this.imagenOn.src  = raiz + "imagenes/menu/" + elNombre + "a.gif";
	  this.imagenOff.src = raiz + "imagenes/menu/" + elNombre + ".gif";	  
   }
   // Metodo que genera el codigo html de un elemento del menu
   // Se le pasa el nombre javascript para llegar al objeto 
   function pintaBarraItem (nombreObj) {
	  if ((this.url.substr(0,4)=="http") || (this.url.substr(0,1)=="/")) document.write ("      <a href=\"" + this.url +"\" ");
	  else document.write ("      <a href=\"" +raiz + this.url +"\" ");
	  document.write("         onMouseover=\"document['" +this.nombre+ "'].src = " + nombreObj + ".imagenOn.src\"  ");
	  document.write("         onMouseout=\"document['" +this.nombre+ "'].src = " + nombreObj + ".imagenOff.src\"  ");
	  document.write("      ><img src=\""+raiz+"imagenes/menu/" +this.nombre+".gif\"" );
	  document.write("            name=\"" + this.nombre+ "\" " );
	  document.write("            alt=\"" + this.info + "\" ");
	  document.write("            title=\"" + this.info + "\" ");	  
	  document.write("            border=\"0\"");
      document.write("            hspace=\"5\"");	  
	  document.write("            height=\"" +this.imagenOn.height+ "\"");
	  document.write("            width=\"" +this.imagenOn.width+ "\"></a>");
   }
   // ----------- Fin clase barraItem -------------------------------------------------------------------------------------------

   
   // ------- Clase imagenItem --------------------------------------------------------------------------------------------------   
   // Almacena una imagen del menu
   function imagenItem (elNombre, laUrl, laInfo) {
      this.nombre    = elNombre;      // Nombre de la imagen
	  this.url       = laUrl;         // Url destino de pinchar en el elento
	  this.info      = laInfo;        // Información de destino (alt)
	  this.pinta     = pintaImagen    // Funcion que genera el codigo del item
   }
   // Metodo que genera el codigo html de un elemento de imagen
   function pintaImagen () {
      document.write("<tr BGCOLOR=\"#FFFFFF\">");
      document.write("  <td ALIGN=\"left\" VALIGN=\"top\">&nbsp;</td>");
      document.write("</tr>");
      document.write("<tr BGCOLOR=\"#FFFFFF\">");
      document.write("  <td ALIGN=\"center\" VALIGN=\"top\"><a href=\"" + this.url + "\"");
	  document.write("><img src=\""+raiz+"imagenes/menu/" + this.nombre + ".gif\" ");
	  document.write("      alt=\"" + this.info + "\" ");
	  document.write("      title=\"" + this.info + "\" ");
	  document.write("      nosave=\"\" ");
	  document.write("      border=\"0\"></a></td>");
      document.write("</tr>");
   }
   // ----------- Fin clase imagenItem -------------------------------------------------------------------------------------------

   
   
   // Genera la cabecera
   function Cabecera() {
      hoy = new Date();     // Vamos a determinar cual es la imagen que toca dependiendo del segundo en el que nos encontremos
      segundos = parseInt(hoy.getSeconds());      
      proporcion = 60 / imgsCabecera.length;   // Vemos con respecto al número de imágenes cuanto tiempo corresponde a cada imagen
      if (proporcion>segundos) indice = 0            // Para el Netscape 4
      else indice = parseInt(segundos/proporcion);   // Obtenemos el índice de la imagen que corresponda
      if (indice>=imgsCabecera.length) indice = imgsCabecera.length-1;  // Si el número no es exacto le regalamos los últimos segundos a la última imagen 
      document.write("<div align=\"center\">");
      document.write("<table BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=682 BGCOLOR=#FFFFFF summary=\"Cabecera de la página\">");
      document.write("  <tr>");
      document.write("    <td><center><map name=\"Map\"><area shape=\"rect\" coords=\"0,0,165,36\" href=\"http://www.ua.es/es/index.html\" alt=\"Universidad de Alicante\" title=\"Universidad de Alicante\"><area shape=\"poly\" coords=\"164,1,164,35,1,35,1,98,680,98,680,1\" href=\""+raiz+ paginaInicial + "\" alt=\""+ infoCabecera + "\" title=\""+ infoCabecera + "\"></map></center></td>");
      document.write("    <td ALIGN=LEFT VALIGN=BOTTOM><img SRC=\""+raiz+"imagenes/menu/" + imgsCabecera[indice] + "\" NOSAVE BORDER=0 usemap=\"#Map\" height=100 width=682></td>");
	  document.write("  </tr>");
      document.write("</table>");
	  document.write("</div>");	  
   }


   // Genera la cabecera
   function CabeceraVa() {
      hoy = new Date();     // Vamos a determinar cual es la imagen que toca dependiendo del segundo en el que nos encontremos
      segundos = parseInt(hoy.getSeconds());      
      proporcion = 60 / imgsCabecera.length;   // Vemos con respecto al número de imágenes cuanto tiempo corresponde a cada imagen
      if (proporcion>segundos) indice = 0            // Para el Netscape 4
      else indice = parseInt(segundos/proporcion);   // Obtenemos el índice de la imagen que corresponda
      if (indice>=imgsCabecera.length) indice = imgsCabecera.length-1;  // Si el número no es exacto le regalamos los últimos segundos a la última imagen 
      document.write("<div align=\"center\">");
      document.write("<table BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=682 BGCOLOR=#FFFFFF summary=\"Cabecera de la página\">");
      document.write("  <tr>");
      document.write("    <td><center><map name=\"Map\"><area shape=\"rect\" coords=\"0,0,165,36\" href=\"http://www.ua.es/va/index.html\" alt=\"Universitat d´Alacant\" title=\"Universitat d´Alacant\"><area shape=\"poly\" coords=\"164,1,164,35,1,35,1,98,680,98,680,1\" href=\""+raiz+ paginaInicial + "\" alt=\""+ infoCabecera + "\" title=\""+ infoCabecera + "\"></map></center></td>");
      document.write("    <td ALIGN=LEFT VALIGN=BOTTOM><img SRC=\""+raiz+"imagenes/menu/" + imgsCabecera[indice] + "\" NOSAVE BORDER=0 usemap=\"#Map\" height=100 width=682></td>");
	  document.write("  </tr>");
      document.write("</table>");
	  document.write("</div>");	  
   }

      

   // Muestra la barra de botones
   function MostrarBarra() {
	  document.write("<DIV align=\"center\">");
	  document.write("<TABLE border=0 cellspacing=0 cellpadding=0 width=\"682\" bgcolor=\"#ffffff\" summary=\"\">");
      // Miro si hay barra de botones o no
	  if (barraBotones === undefined) {
         document.write("  <tr BGCOLOR=\"#FFFFFF\">");
         document.write("    <td ALIGN=\"LEFT\" VALIGN=\"CENTER\">&nbsp;</td>");
         document.write("  </tr>");
      }	  
	  else {
	     document.write("  <TR bgcolor=\"#D8E5EA\">");
	     document.write("    <TD align=\"LEFT\" valign=\"center\" height=\"22\">");
	     for (i=0; i<barraBotones.length; i++) {
	        if (i>0) document.write("      <IMG SRC=\"imagenes/menus/bs.gif\" ALT=\"\" height=18 width=1>");
		    barraBotones[i].pinta("barraBotones["+i+"]");  // Pinto el elemento de la barra
	     }
	     document.write("    </TD>");
	     document.write("  </TR>");
	  }
	  document.write("</TABLE>");
	  document.write("</DIV>");
   }


   // Maximo 3 subniveles
   // @param indice El indice dentro de listaItems del elemento del menu que va a estar desplegado
   // @param subIndice El indice dentro de listaItems[indice].submenu del elemento del subMenu que va a estar desplegado
   function MostrarMenus (indice, subIndice) {
      document.write("<table BORDER=0 CELLSPACING=0 CELLPADDING=0 summary=\"Menús\">");
      for (i=0; i<listaItems.length; i++) {
          if (i>0) listaItems[i].separador(); // pinto una separaión
	      listaItems[i].pinta("listaItems["+i+"]"); // Pinto el elemento del menu
		  // Recorro los submenus y los pinto si es el indice que se envia
		  if (i==indice && listaItems[i].subMenu != null) 
		     for(j=0; j<listaItems[i].subMenu.length; j++) {
			    listaItems[i].subMenu[j].pinta("listaItems["+i+"].subMenu["+j+"]");
			    // Recorro los subsubmenus y los pinto si es el subIndice que se recibo
		        if (j==subIndice && listaItems[i].subMenu[j].subMenu != null) 
		           for(k=0; k<listaItems[i].subMenu[j].subMenu.length; k++) 
			          listaItems[i].subMenu[j].subMenu[k].pinta("listaItems["+i+"].subMenu["+j+"].subMenu["+k+"]");
			 }
      }
      if (!(listaImagenes === undefined))    // Si hay imagenes las pinto
         for (i=0; i<listaImagenes.length; i++) 
	         listaImagenes[i].pinta(); // Pinto el elemento del menu
      document.write("</table>");
   }

   // Devuelve la fecha de modificación
   function fechaModificacion() {
      // Para poner los meses en formato visual
	  var nommeses = new Array("", "ene", "feb", "mar", "abr", "may", "jun", "jul", "ago", "sep", "oct", "nov", "dic")				
	  // Obtenemos la fecha de hoy
	  var mydate = new Date();
	  // Separamos el día, mes y año
	  var anyo = mydate.getYear();
	  if (anyo < 2000)
		  anyo+=1900;
	  var dia  = mydate.getDay();
	  var mes  = mydate.getMonth() + 1;
	  var diam = mydate.getDate();
	  return(diam + "-" + nommeses[mes] + "-" + anyo);
   }

