
function damefoto(i,c)
{
  xajax_damefoto(i,c);
}
function buscafoto(id_gal,entidad1,cod1,entidad2,cod2,entidad3,cod3,entidad12,cod12,entidad22,cod22,entidad32,cod32,entidad4,cod4,id_com,id_eve,id_fue,texto,fecha,temporada,jornada,fecha2,fecha3)
{
  xajax_buscafoto(id_gal,entidad1,cod1,entidad2,cod2,entidad3,cod3,entidad12,cod12,entidad22,cod22,entidad32,cod32,entidad4,cod4,id_com,id_eve,id_fue,texto,fecha,temporada,jornada,fecha2,fecha3);
}
function buscajug(entidad,cod)
{
  buscafoto(0,entidad,cod,"","","","","","","","","","","","",0,0,0,"","",0,0,"","");
}
function buscaent(entidad,cod)
{
  buscafoto(0,"","",entidad,cod,"","","","","","","","","","",0,0,0,"","",0,0,"","");
}
function buscaequ(entidad,cod)
{
  buscafoto(0,"","","","",entidad,cod,"","","","","","","","",0,0,0,"","",0,0,"","");
}
function buscaarb(entidad,cod)
{
  buscafoto(0,"","","","","","","","","","","","",entidad,cod,0,0,0,"","",0,0,"","");
}
function buscacom(cod)
{
  buscafoto(0,"","","","","","","","","","","","","","",cod,0,0,"","",0,0,"","");
}
function buscaeve(cod)
{
  buscafoto(0,"","","","","","","","","","","","","","",0,cod,0,"","",0,0,"","");
}
function buscafue(cod)
{
  buscafoto(0,"","","","","","","","","","","","","","",0,0,cod,"","",0,0,"","");
}
function buscafecha(fecha)
{
  buscafoto(0,"","","","","","","","","","","","","","",0,0,0,"",fecha,0,0,"","");
}
function inhabilitar(){
    return false
}
function atras()
{
  if (cual>0 && (document.getElementById('bloqueado').value==0))
  {
    document.getElementById('bloqueado').value = 1;
    cual--;
    damefoto(cual,0);
  }
}
function ir_a(num)
{
  if (document.getElementById('bloqueado').value==0)
  {
    document.getElementById('bloqueado').value = 1;
    cuantas = parseInt(document.getElementById('cuantas').value);
    if (num>cuantas)
      cual = cuantas - 1;
    else if (num<0)
      cual = 0;
    else
      cual = parseInt(num)-1;
    cual = parseInt(num)-1;
    damefoto(cual,0);
  }
}
function adelante()
{
  if (document.getElementById('bloqueado').value==0)
  {
    document.getElementById('bloqueado').value = 1;
    cuantas = parseInt(document.getElementById('cuantas').value) - 1;
    if (cual<cuantas)
    {
      cual++;
      damefoto(cual,0);
    }
    else
    {
      if (document.getElementById('titulogaleria').innerHTML=='Últimas imágenes')
      {
        cual++;
        damefoto(cual,0);
      }
      else
        document.getElementById('bloqueado').value = 0;
    }
  }
}
function primero()
{
  if (document.getElementById('bloqueado').value==0)
  {
    document.getElementById('bloqueado').value = 1;
    cual = 0;
    damefoto(cual,0);
  }
}
function ultimo()
{
  if (document.getElementById('bloqueado').value==0)
  {
    document.getElementById('bloqueado').value = 1;
    cuantas = parseInt(document.getElementById('cuantas').value) - 1;
    cual = cuantas;
    damefoto(cual,0);
  }
//   formu = parseInt(cual)+1;
//   document.forms[0].numero.value = formu;
}
function reiniciabusqueda()
{
  document.getElementById('subcapa1').style.visibility='hidden';
  document.getElementById('subcapa3').style.visibility='hidden';
  document.getElementById('subcapa2').style.visibility='visible';
  document.getElementById('fondofoto').style.backgroundImage='url(http://www.acb.com/imgs/fc_06_buscaback.jpg)';
  document.forms[0].temporada.value = 0;
  document.forms[0].id_com.value = 0;
  document.forms[0].id_eve.value = 0;
  document.forms[0].id_fue.value = 0;
  document.forms[0].entidad1.value = '';
  document.forms[0].cod1.value = '';
  document.forms[0].entidad12.value = '';
  document.forms[0].cod12.value = '';
  document.forms[0].entidad2.value = '';
  document.forms[0].cod2.value = '';
  document.forms[0].entidad22.value = '';
  document.forms[0].cod22.value = '';
  document.forms[0].entidad3.value = '';
  document.forms[0].cod3.value = '';
  document.forms[0].entidad32.value = '';
  document.forms[0].cod32.value = '';
  document.forms[0].texto.value = '';
  document.forms[0].numerofoto.value = '';
  document.forms[0].fecha2.value = '';
  document.forms[0].fecha3.value = '';
  document.getElementById('jugador').innerHTML='Busca un jugador';
  document.getElementById('entrenador').innerHTML='Busca un entrenador';
  document.getElementById('equipo').innerHTML='Busca un equipo';
  document.getElementById('jugador2').innerHTML='Busca un jugador';
  document.getElementById('entrenador2').innerHTML='Busca un entrenador';
  document.getElementById('equipo2').innerHTML='Busca un equipo';
  document.getElementById('titulogaleria').innerHTML='Búsqueda de fotos';
  document.getElementById('datos').innerHTML='';
  document.getElementById('piedefoto').innerHTML='';
  document.getElementById('cuantastext').innerHTML='';
  document.getElementById('foto').src='http://www.acb.com/imgs/pixel.gif';
}
function reiniciainfo()
{
  document.getElementById('subcapa1').style.visibility='hidden';
  document.getElementById('subcapa2').style.visibility='hidden';
  document.getElementById('subcapa3').style.visibility='visible';
  document.getElementById('fondofoto').style.backgroundImage='url(http://www.acb.com/imgs/fc_06_infoback.jpg)';
  document.forms[0].numerofoto.value = '';
  document.getElementById('titulogaleria').innerHTML='Información relacionada';
  document.getElementById('datos').innerHTML='';
  document.getElementById('piedefoto').innerHTML='';
  document.getElementById('cuantastext').innerHTML='';
  document.getElementById('foto').src='http://www.acb.com/imgs/pixel.gif';
}
function nohayfoto()
{
  document.images.foto.src='http://www.acb.com/imgs/fc_noexiste.gif';
}
function cambia(nombre,numero)
{
  eval("document.getElementById('"+nombre+"').src='http://www.acb.com/imgs/fc_"+numero+"_on.jpg'");
}
function cambia2(nombre,numero)
{
  eval("document.getElementById('"+nombre+"').src='http://www.acb.com/imgs/fc_"+numero+"_off.jpg'");
}
function capturarTecla(evento)
{
  if (document.getElementById('bloqueado').value==0)
  {
    var tecla;
    if (document.all)
    {
      tecla = event.keyCode; // IE
    }
    else
    {
      tecla = evento.which;
    }
//     alert(tecla);
    if (tecla == 39) // Siguiente ( -> )
    {
    document.getElementById('der').src='http://www.acb.com/imgs/fc_16_click.jpg';
    setTimeout('cambia2(\'der\',16)',200)
    adelante();
    }
    if (tecla == 37) // Anterior ( <- )
    {
    document.getElementById('izq').src='http://www.acb.com/imgs/fc_15_click.jpg';
    setTimeout('cambia2(\'izq\',15)',200)
    atras();
    }
    if (tecla == 36) // Inicio ( ^ )
    {
    document.getElementById('izqt').src='http://www.acb.com/imgs/fc_12_click.jpg';
    setTimeout('cambia2(\'izqt\',12)',200)
    primero();
    }
    if (tecla == 35) // Anterior ( _ )
    {
    document.getElementById('dert').src='http://www.acb.com/imgs/fc_14_click.jpg';
    setTimeout('cambia2(\'dert\',14)',200)
    ultimo();
    }
    if (tecla == 44)  // Impr. Pant.
    {
      return false;
    }
    if (tecla == 17) // Control
    {
      return false;
    }
//    if (tecla == 67) C
//    {
//      return false;
//    }
  }
}