   
   var raiz
   var mantenidaPor
   var mailMantenim
   var prePieComun
   var listaItems      // Lista de elementos del menu
   var barraBotones    // Lista de botones de la barra de botones
   var listaImagenes   // Lista de imágenes para el menu de imágenes
   var infoCabecera
   var imgsCabecera
   var cajaBusqueda
   var buscar    // Botón de buscar
   var inicioUrl
   var urlCabecera   // Dirección a la que se va al pinchar en la cabecera, sino base + index.htm
   var kVertical   = 121
   var kHorizontal = 245
   var colorBarra = "#D8E5EA"
   
  
   if (window.location.href.indexOf("www.ua.es")>=0) inicioUrl = ""
   else inicioUrl = "http://www.ua.es"
   if (window.location.href.indexOf("www.ua.es/web/")>=0) inicioUrl = "http://www.ua.es"
 
   // ------- 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 ();  // Imagen cuando el boton está activado
	  this.imagenOff = new Image ();  // Imagen cuando el boton está desactivado
	  this.imagenOn.src  = raiz + elNombre + "a.gif"; // en el espacio poner la carpeta de imagenes en mi caso /menu/
	  this.imagenOff.src = raiz + elNombre + ".gif";	  
	  this.imagenOn.width   = elAncho;   // Tamaños de las imagenes
	  this.imagenOn.height  = elAlto;
	  this.imagenOff.width  = elAncho;
	  this.imagenOff.height = elAlto;
	  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.length > 0) {
         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(" >");
      }
      document.write("<img src=\""+raiz + 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+ "\">");
      if (this.url.length > 0) document.write("</a>");
      document.write("</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=\"" + inicioUrl + "/imagenes/menus/raya.gif\" border=\"0\" width=\"161\" height=\"1\" vspace=0 hspace=0></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 ();
	  this.imagenOff = new Image ();
	  this.imagenOn.src  = raiz  + elNombre + "a.gif";
	  this.imagenOff.src = raiz + elNombre + ".gif";	  
	  this.imagenOn.width   = elAncho;   // Tamaños de las imagenes
	  this.imagenOn.height  = elAlto;
	  this.imagenOff.width  = elAncho;
	  this.imagenOff.height = elAlto;
   }
   
   // Metodo que genera el codigo html de un elemento del menu
   // Se le pasa el nombre javascript para llegar al objeto 
   function pintaBarraItem (nombreObj, subDirectorio) {
      var auxDir
	  if (subDirectorio === undefined) auxDir = "";
	  else auxDir = subDirectorio + "/";

	  if (this.url.length > 0) {
	     if ((this.url.substr(0,4)=="http") || (this.url.substr(0,1)=="/")) 
		    document.write ("<a href=\"" + this.url +"\" ");
	     else 
		    document.write ("<a href=\"" +raiz + auxDir + this.url +"\" ");
	     document.write("         onMouseover=\"document['" +this.nombre+ "'].src = " + nombreObj + ".imagenOn.src\"  ");
	     document.write("         onMouseout=\"document['" +this.nombre+ "'].src = " + nombreObj + ".imagenOff.src\"  ");
	     document.write("      >");
	  }
	  document.write("<img src=\""+raiz +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+ "\">");
      if (this.url.length > 0) document.write("</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+ this.nombre + ".gif\" ");
	  document.write("      alt=\"" + this.info + "\" ");
	  document.write("      title=\"" + this.info + "\" ");
	  document.write("      nosave=\"\" ");
	  document.write("      border=\"0\" vspace=\"0\"></a></td>");
      document.write("</tr>");
   }
   // ----------- Fin clase imagenItem -------------------------------------------------------------------------------------------

   
   
   
   
   // Muestra la barra de botones
 
   // @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 WIDTH=\"100%\" 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>");
   }

   
   // Pinta una barra de enlaces con imagenes rollover en la orientacion que se envia







