scrollList=new Array();

window.onload=inicializar;

function definir_scroll(abajo, arriba, bloque, veloc_abajo, veloc_arriba)
{
  if (scrollList[arriba]==null) scrollList[arriba]=new Array();
  if (scrollList[abajo]==null) scrollList[abajo]=new Array();
  scrollList[arriba].push(new Array(bloque, veloc_arriba));
  scrollList[abajo].push(new Array(bloque, veloc_abajo));
}

function getEl(elementId)
{
  return document.getElementById(elementId);
}

function inicializar()
{
  for(key in scrollList)
  {
    var flecha=getEl(key);
    flecha.onmouseover=iniciar_scroll;
    flecha.onmouseout=parar_scroll;
  }
}

function iniciar_scroll()
{
  scrollDivs=new Array();
  velDivs=new Array();
  for(key in scrollList[this.id])
  {
    scrollDivs.push(getEl(scrollList[this.id][key][0]));
    velDivs.push(scrollList[this.id][key][1]);
  }
  identificador=setInterval('hacer_scroll()', 50);
}

function parar_scroll()
{
  clearInterval(identificador);
}

function hacer_scroll()
{
  for(key in scrollDivs)
  {
    var desp_actual=scrollDivs[key].scrollTop;
    var desp_nuevo=desp_actual+velDivs[key];
    scrollDivs[key].scrollTop=desp_nuevo;
   }
}

