  // Funcion para la contraccion de los aņos de los calendarios
  function contraer(ano) {   
    if (ano != ano_seleccionado) {
      obj = document.getElementById("ano_"+ano);
      obj.style.display = "";      
    
      obj_sel = document.getElementById("ano_"+ano_seleccionado);    
      if (obj_sel) obj_sel.style.display = "none";
      
      ano_seleccionado = ano;
    } else {
      obj = document.getElementById("ano_"+ano);
      obj.style.display = "none";
      ano_seleccionado = "";
    }
  }  
  
  // Ventana de acerca de
  
  // Funciones para el movimiento del Visor
    var fotos = new Array();   
  var moviendo = false;
    
  function verFoto(date) {    
    location.href='?date='+date+'&pos='+primerafoto;
  }
  
  function strFoto(data, pos) {
    return '<a href="../proyectos/?date=' + data[2] + '" onclick="verFoto(proyectos/\'' + data[2] + '\'); return false;"><img hspace=5 class="foto" src="' + data[0] + '" width=90 height=68 border="0"></a><br>' + data[1];    
  }

  function cargarvisor(pos) {
    document.write('<table border="0" cellpadding="0" cellspacing="0" id="visor" style="margin-left: ' + pos + 'px;"><tr>');
    for (f = 0; f < fotos.length; f++) {
      if (f >= (primerafoto-1) && f < primerafoto+8) {
        document.write('<td class="df navtexto" style="font-family: Arial; font-size: 10px;" align="center">' + strFoto(fotos[f]) + '</td>');
      } else {
        document.write('<td class="df navtexto" style="font-family: Arial; font-size: 10px;" valign="bottom" align="center"><div style="margin-left: 5px; margin-right: 5px; width: 90px; height: 68px;"><br><br>[' + strCargando + ']</div>' + fotos[f][1] + '</td>');
      }
    }
    
    document.write('</tr></table>');
  }
     
  function ObtenerPosicion() {    
    obj = document.getElementById("visor");
    posicion = obj.style.marginLeft;
    if (posicion == "") posicion = "0px";        
    posicion = parseInt(posicion.substr(0, posicion.length-2), 10);
    return posicion;
  }
  
  function mover(pixels) {
    obj = document.getElementById("visor");
            
    posicion = ObtenerPosicion()-pixels;    
    obj.style.marginLeft=posicion.toString()+'px';        
  }
  
  var posicion_limite;   
  function desplazar(pixeles) {
    posicion = ObtenerPosicion();
    if ((posicion_limite < (posicion-pixeles) && pixeles > 0) || (posicion_limite > (posicion-pixeles) && pixeles < 0)) {
      mover(pixeles);
      if (pixeles > 0)
        pixeles--;
      else
        pixeles++;      
            
      setTimeout("desplazar(" + pixeles + ");", 10);
    } else {
      obj = document.getElementById("visor");    
      obj.style.marginLeft=posicion_limite+'px';
            
      TD = obj.childNodes[0].childNodes[0].childNodes; // se ubica en las TDs
      if (primerafoto > 0) {
        // Controla que este cargada la foto anterior a las actuales
        if (TD[primerafoto-1].childNodes[0].tagName == "DIV") TD[primerafoto-1].innerHTML = strFoto(fotos[primerafoto-1]);
      }
      if (primerafoto < (fotos.length-7)) {
        // Controla que este cargada la foto siguiente a las actuales
        if (TD[primerafoto+7].childNodes[0].tagName == "DIV") TD[primerafoto+7].innerHTML = strFoto(fotos[primerafoto+7]);
      }
      
      // Controla donde queda ubicado
      if (primerafoto==0) {
        begin();
      } else if (primerafoto==(fotos.length-5)) {
        finish();
      } else {
        // Controla que se hayan cargado todas las imagenes
        obj = document.getElementById("visor");
        TD = obj.childNodes[0].childNodes[0].childNodes; // se ubica en las TDs
        for (f = primerafoto; f < primerafoto+7; f++) {
          if (TD[f].childNodes[0].tagName == "DIV") {            
            TD[f].innerHTML = strFoto(fotos[f]);
          } else {
            if (!TD[f].childNodes[0].childNodes[0].complete) {
              TD[f].innerHTML = "";
              TD[f].innerHTML = strFoto(fotos[f]);
            }
          }
        }
        
        // Habilita todos los botones del visor
        try {
        btn = document.getElementById('btn_previous');
        if (btn.style.visibility != 'visible') btn.style.visibility = 'visible';
        btn = document.getElementById('btn_start');
        if (btn.style.visibility != 'visible') btn.style.visibility = 'visible';
        btn = document.getElementById('btn_next');
        if (btn.style.visibility != 'visible') btn.style.visibility = 'visible';
        btn = document.getElementById('btn_end');
        if (btn.style.visibility != 'visible') btn.style.visibility = 'visible';
        } catch (e) { }  
      }      
              
      moviendo = false;
    }
  } 
  function begin() {    
    obj = document.getElementById("visor");
    // Controla que se carguen las primeras 5 imagenes
    TD = obj.childNodes[0].childNodes[0].childNodes; // se ubica en las TDs
    for (f = 0; f < 7; f++) {
      if (TD[f].childNodes[0].tagName == "DIV") TD[f].innerHTML = strFoto(fotos[f]);
    }
    // vuelve al principio al visor
    obj.style.marginLeft = "0px";
    primerafoto=0;
    
    // Deshabilita los de Anterior y Comienzo    
    try {
    btn = document.getElementById('btn_previous');    
    btn.style.visibility = 'hidden';
    btn = document.getElementById('btn_start');    
    btn.style.visibility = 'hidden';
    
    // Habilita los Botones de Final y Siguiente
    btn = document.getElementById('btn_next');    
    btn.style.visibility = 'visible';
    btn = document.getElementById('btn_end');    
    btn.style.visibility = 'visible';
    } catch (e) { }
  }
  function finish() {
    obj = document.getElementById("visor");
    // Controla que se carguen las primeras 5 imagenes
    TD = obj.childNodes[0].childNodes[0].childNodes; // se ubica en las TDs
    for (f = fotos.length-7; f < fotos.length; f++) {
      if (TD[f].childNodes[0].tagName == "DIV") TD[f].innerHTML = strFoto(fotos[f]);
    }
    // vuelve al principio al visor
    obj.style.marginLeft = (-((fotos.length-7)*100))+"px";
    primerafoto=(fotos.length-7);
    
    // Deshabilita los Botones de Final y Siguiente
    try {
    btn = document.getElementById('btn_next');
    btn.style.visibility = 'hidden';
    btn = document.getElementById('btn_end');
    btn.style.visibility = 'hidden';
    
    // Habilita los de Anterior y Comienzo
    btn = document.getElementById('btn_previous');
    btn.style.visibility = 'visible';
    btn = document.getElementById('btn_start');
    btn.style.visibility = 'visible';
    } catch (e) { }
  }
  function next() {    
    if (!moviendo) {
      posicion_limite = ObtenerPosicion()-100;    
      if (primerafoto < (fotos.length-7)) {      
        moviendo = true;
        primerafoto++;        
        desplazar(20);
      }
    }
  }    
  function previous() {    
    if (!moviendo) {
      posicion_limite = ObtenerPosicion()+100;    
      if (primerafoto > 0) {      
        moviendo = true;
        primerafoto--;
        desplazar(-20);
      }
    }
  }
  
  // Funciones de seguridad para boton derecho
  function right(e) {    
    if (e.preventDefault) e.preventDefault();
    if ((navigator.appName == 'Netscape' && e.which == 3) || (navigator.appName == 'Microsoft Internet Explorer' && event.button==2)) {
      alert(msg_botonderecho);
      return false;
    } else {
      return true;
    }
  }

  function trampa() {
    if(document.images) {
      for(i=0;i<document.images.length;i++) {
        document.images[i].onmousedown = right;
        if (navigator.appName == 'Microsoft Internet Explorer') document.images[i].onmouseup = right;
      }
    }
  }
  
  // Funcion que controla que todas las imagenes esten cargadas
  // Controla que se hayan cargado todas las imagenes
  function ControlCargas() {
    try {
    obj = document.getElementById("visor");
    TD = obj.childNodes[0].childNodes[0].childNodes; // se ubica en las TDs
    for (f = primerafoto; f < primerafoto+7 && f < TD.length; f++) {
      if (TD[f].childNodes[0].tagName == "DIV") {            
        TD[f].innerHTML = strFoto(fotos[f]);
      } else {
        if (!TD[f].childNodes[0].childNodes[0].complete) {
          TD[f].innerHTML = "";
          TD[f].innerHTML = strFoto(fotos[f]);
        }
      }
    }
    } catch(e) {}
    setTimeout("ControlCargas()", 5000);
  }
  setTimeout("ControlCargas()", 5000);

