var img_fup, img_fdown, div_texto;
var yorg, ymax, posy, paso=20;
var temporizador, tIni=350, tSig=25;
var divs = new Array();

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function PreCarga() {
 var ind,arg;

 img_fup=MM_findObj("ifup");
 img_fdown=MM_findObj("ifdown");

 img_fup.imgOn = new Image;
 img_fup.imgOn.src = "/images/flecha_up2.gif";
 img_fup.imgOff = new Image;
 img_fup.imgOff.src = "/images/flecha_up.gif";

 img_fdown.imgOn = new Image;
 img_fdown.imgOn.src = "/images/flecha_down2.gif";
 img_fdown.imgOff = new Image;
 img_fdown.imgOff.src = "/images/flecha_down.gif";
 
 if (document.getElementById)
  div_texto = document.getElementById("texto");
 else if (document.all)
  div_texto = document.all.texto;
 else
  div_texto = document.texto;
 if (div_texto.style)
  div_texto = div_texto.style;
 yorg = parseInt(div_texto.top,10);
 posy = yorg + 10;
 if (div_texto.pixelHeight)
  ymax = -div_texto.pixelHeight+100;
 else if (div_texto.clip.height)
  ymax = -div_texto.clip.height+100;
 else
  ymax = -10000;
 
 arg=PreCarga.arguments;
 for(ind=0;ind<arg.length;ind++) {
  divs[ind]=new Object;
  if (document.getElementById)
   divs[ind].div = document.getElementById(arg[ind]);
  else if (document.all)
   eval("divs[ind].div = document.all."+arg[ind]+";");
  else
   eval("divs[ind].div = document."+arg[ind]+";");
  if (divs[ind].div.style)
   divs[ind].div = divs[ind].div.style;
  divs[ind].yorg = parseInt(divs[ind].div.top,10);
 }
 
 document.onmousewheel = Wheel;
}
function Move(dir) {
 var ind;
 posy += dir*paso;
 if (posy>yorg) posy=yorg;
 if (posy<ymax) posy=ymax;
 div_texto.top = posy;
 for(ind=0;ind<divs.length;ind++) {
  divs[ind].div.top = divs[ind].yorg+posy-yorg;
 }
}
function On(img,dir) {
 img.src = img.imgOn.src;
 Move(dir);
 temporizador=window.setTimeout("tOn("+dir+")",tIni,"JavaScript");
 return false;
}
function tOn(dir) {
 Move(dir);
 temporizador=window.setTimeout("tOn("+dir+")",tSig,"JavaScript");
}
function Off(img) {
 img.src = img.imgOff.src;
 clearTimeout(temporizador);
 return false;
}
function Wheel() {
 Move(event.wheelDelta/120);
}
function nada() {
 return false;
}

