// MENUS.JS
// Funciones para mostrar la barra superior y los menús de la izquierda de una sección
// Con tipo indicamos la opción que se debe expandir.
// Sino se expande ninguna, posiblemente sea porque el tipo no coincide con ninguno de los tipos definidos. 
   var listaItems;
   var raiz;
   var mantenidaPor;


   // *************************************************************************************************************************
   // ************************************************************************************************************************* 
   //   Elementos que cambian en cada site
   //   Las imagenes del menu tienen que estar en imagenes/menu/
   //   Para cada elemento del menu el constructor es:
   //     menuItem ( nombreImagen, ancho, alto, urlDestino, informacion)
   //         nombreImagen = Los gifs se llamaran nombreImagen.gif y nombreImagena.gif y estarán en imagenes/menu
   //         ancho = Ancho de la imagen en pixels
   //         alto  = Alto de la imagen en pixels
   //         urlDestino = Pues eso
   //         información = Texto que aparece cuando ponemos el raton encima de la imagen (alt)
      
   raiz         = "http://www.ua.es/es/";
 //  raiz         = "http://desarrollo.campus.ua.es/UA/web/discapacidad/";
   mantenidaPor = "el Observatorio de la Discapacidad"   
   mailMantenim = "observatorio.discapacidad@ua.es"
   listaItems  = [ new menuItem("image1",  161, 19, "servicios/observatorio.discapacidad/informacion/index.html" , "Información general"),
                   new menuItem("image2",  161, 19, "servicios/observatorio.discapacidad/agenda/index.html"      , "Agenda de actividades"),

                   new menuItem("image4",  161, 19, "servicios/observatorio.discapacidad/buzon/index.html"       , "Buzón de sugerencias"),
                   new menuItem("image5",  161, 19, "servicios/observatorio.discapacidad/enlaces/index.html"     , "Enlaces"),
                   new menuItem("image6",  161, 19, "servicios/observatorio.discapacidad/estudios/index.html"    , "Estudios e Investigación"),
                   new menuItem("image7",  161, 19, "servicios/observatorio.discapacidad/catalogo/index.html"    , "Catálogo de documentos"),
                   new menuItem("image8",  161, 19, "servicios/observatorio.discapacidad/memorias/index.html"    , "Memorias de actividades"),

                   new menuItem("image10", 161, 19, "servicios/observatorio.discapacidad/noticias/index.html"    , "Noticias de prensa"),
                   new menuItem("image11", 161, 19, "servicios/observatorio.discapacidad/entidades/index.html"   , "Entidades colaboradoras"),
  		   new menuItem("image14", 161, 19, "servicios/observatorio.discapacidad/Experiencias/index.html"   , "Experiencias"),
                  new menuItem("image13", 129, 120, "estudios/seus/alacant/index.html"   , "Sede de Alicante") 
				 ];

   // Fin de los elementos pasticulares 
   // El resto del fichero es comun a todos los sitios web				 
   // *************************************************************************************************************************
   // *************************************************************************************************************************
				 
   // ------- Clase menuItem --------------------------------------------------------------------------------------------------   
   // Almacena un elemento del menu
   function menuItem (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     = pintaItem;  // Funcion que genera el codigo del item
	  this.imagenOn  = new Image (elAncho, elAlto);
	  this.imagenOff = new Image (elAncho, elAlto);
	  this.imagenOn.src  = raiz + "servicios/observatorio.discapacidad/imagenes/menu/" + elNombre + "a.gif";
	  this.imagenOff.src = raiz + "servicios/observatorio.discapacidad/imagenes/menu/" + elNombre + ".gif";	  
   }

   function pintaItem (indice) {
      document.write("<tr BGCOLOR=\"#FFFFFF\">");
      document.write("  <td ALIGN=\"left\" VALIGN=\"top\"><a href=\"" +raiz + this.url +"\" ");
	  document.write("    onMouseover=\"document['" +this.nombre+ "'].src = listaItems["+indice+"].imagenOn.src\"  ");
	  document.write("    onMouseout=\"document['" +this.nombre+ "'].src = listaItems["+indice+"].imagenOff.src\"  ");
	  document.write(" ><img src=\""+raiz+"servicios/observatorio.discapacidad/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>");
   }
   // ----------- Fin clase menuItem -------------------------------------------------------------------------------------------
   
   function pintaRaya () {
      document.write("<tr BGCOLOR=\"#FFFFFF\">");
      document.write("  <td ALIGN=\"left\" VALIGN=\"top\"><img src=\""+raiz+"servicios/observatorio.discapacidad/imagenes/menu/raya.gif\" border=\"0\" width=\"161\" height=\"1\"></td>");
      document.write("</tr>");
   }


   function Cabecera() {
      document.write("<center><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=\"/es/index.html\" alt=\"Universidad de Alicante\"><area shape=\"poly\" coords=\"164,1,164,35,1,35,1,98,680,98,680,1\" href=\""+raiz+"servicios/observatorio.discapacidad/index.html\" alt=\"Observatorio de la Discapacidad\"></map></center></td>");
      document.write("    <td ALIGN=LEFT VALIGN=BOTTOM><img SRC=\""+raiz+"servicios/observatorio.discapacidad/imagenes/menu/cabecera.gif\" NOSAVE BORDER=0 usemap=\"#Map\" height=100 width=682></td>");
      document.write("  </tr>");
      document.write("</table></center>");
   }

   function MostrarBarra() {
      document.write("<DIV align='center'>");
	  document.write("<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=\"682\" BGCOLOR=\"#FFFFFF\" summary=\"\">");
      document.write("  <tr BGCOLOR=\"#FFFFFF\">");
      document.write("    <td ALIGN=\"LEFT\" VALIGN=\"CENTER\">&nbsp;</td>");
      document.write("  </tr>");
      document.write("</TABLE>");
	  document.write("</DIV>");
   }


   function MostrarMenus() {
      document.write("<table BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=\"100%\" summary=\"Menús\">");
      for (i=0; i<listaItems.length; i++) {
          if (i>0) pintaRaya();
	      listaItems[i].pinta(i);
      }
      document.write("</table>");
   }


    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 modificación del documento
	   var mydate = new Date(document.lastModified);						
	   // 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);
    }

	
   function Pie() {
      document.write("<table BORDER=0 CELLSPACING=10 CELLPADDING=0 WIDTH=\"100%\" BGCOLOR=\"#FFFFFF\" summary=\"Pie de página\">");
      document.write("  <tr>");
      document.write("    <td ALIGN=LEFT VALIGN=CENTER COLSPAN=\"2\" BACKGROUND=\""+raiz+"servicios/observatorio.discapacidad/imagenes/menu/fondocolh.gif\" NOSAVE><img SRC=\""+raiz+"servicios/observatorio.discapacidad/imagenes/menu/punto.gif\" ALT=\"\" NOSAVE height=1 width=1></td>");
      document.write("  </tr>");
      document.write("  <tr>");
      document.write("    <td ALIGN=LEFT VALIGN=CENTER><font face=\"Tahoma, Helvetica, Arial\" color=\"#003366\" size=-2>Página mantenida por " + mantenidaPor + ". <br>Última actualización: " + fechaModificacion() + "</font></td>");
      document.write("    <td ALIGN=RIGHT VALIGN=CENTER><a href=\"/es/index.html\"><img SRC=\"/imagenes/casa.gif\" ALT=\"Página principal\" HSPACE=4 VSPACE=2 NOSAVE BORDER=0 height=19 width=23></a><a href=\"mailto:" + mailMantenim + "\"><img SRC=\"/imagenes/correo.gif\" ALT=\"Enviar correo\" VSPACE=2 NOSAVE BORDER=0 height=15 width=21></a></td>");
      document.write("  </tr>");
      document.write("</table>");
   }

