/**********************************************************************
	scroll.js
	Netscape/Explorer
	13/jun/2001 17:38
	Requiere: MM_findObj para uso con Netscape
	Uso:
	onmousedown="arriba(nombre de la capa a desplazar)" onmouseout="finscroll()" onmouseup="finscroll()"
	onmousedown="abajo(nombre de la capa a desplazar)" onmouseout="finscroll()" onmouseup="finscroll()"

***********************************************************************/


ns4 = (document.layers)?true:false
ie4 = (document.all)?true:false


velocidad = 5  // Desplazamiento del scroll
var idset=0;
var nomb = ''
hayclik = false


/*------
Devuelve el objeto representando la capa con id="nombrecapa"
------*/
function asignarscroll(nombrecapa) {
	if (document.all) {
		return(  eval(nombrecapa)  );
		return(  eval(nombrecapa).currentStyle  );
		}
	else  
		return MM_findObj(nombrecapa);
	}
	

function subir() {
 if(ns4) {
   if (parseInt(nomb.clip.top)>0) {
	   nomb.clip.top = parseInt(nomb.clip.top) - velocidad
	   nomb.top = parseInt(nomb.top) + velocidad
	   nomb.clip.bottom = parseInt(nomb.clip.bottom) - velocidad
   }
 }
 
 else if (document.all) {
    if (parseInt(nomb.currentStyle.clipTop)>0) {
         clipTop = parseInt(nomb.currentStyle.clipTop) - velocidad;
         clipBottom = parseInt(nomb.currentStyle.clipBottom) - velocidad;
	   nomb.style.top = parseInt(nomb.style.top) + velocidad;
	   nomb.style.clip = "rect("+ parseInt(clipTop) +"px "+ parseInt(nomb.currentStyle.clipRight) +"px "+ parseInt(clipBottom) +"px "+ parseInt(nomb.currentStyle.clipLeft) +"px)"
   }

 }

 idset=setTimeout("subir()", 10)
}

function bajar() {
 if (ns4)  {
	 if(nomb.clip.bottom>0) {
		 nomb.clip.top = parseInt(nomb.clip.top) + velocidad
		 nomb.top = parseInt(nomb.top) - velocidad
		 nomb.clip.bottom = parseInt(nomb.clip.bottom) + velocidad
	 }
 }
 else if (document.all) {
    if(parseInt(nomb.currentStyle.clipBottom)>0) {
	       clipTop = parseInt(nomb.currentStyle.clipTop) + velocidad;
	       clipBottom = parseInt(nomb.currentStyle.clipBottom) + velocidad;
		 nomb.style.top = parseInt(nomb.style.top) - velocidad;
		 nomb.style.clip = "rect("+ parseInt(clipTop) +"px "+ parseInt(nomb.currentStyle.clipRight) +"px "+ parseInt(clipBottom) +"px "+ parseInt(nomb.currentStyle.clipLeft) +"px)"
	}
 }
 idset=setTimeout("bajar()", 10)
}



function arriba(capa) {

  nomb = asignarscroll(capa);

  if (document.all) {
	if ( nomb.style.clip == "" ) {
		nomb.style.clip = "rect("+ parseInt(nomb.currentStyle.clipTop) +" "+parseInt(nomb.currentStyle.clipRight)+" "+parseInt(nomb.currentStyle.clipBottom)+" "+parseInt(nomb.currentStyle.clipLeft)+")";
		nomb.style.top = nomb.currentStyle.top;
		}
  }
  hayclik = true
  subir(nomb);
}

function abajo(capa) {

  nomb = asignarscroll(capa);

  if (document.all) {
	if ( nomb.style.clip == "" ) {
		nomb.style.clip = "rect("+ parseInt(nomb.currentStyle.clipTop) +" "+parseInt(nomb.currentStyle.clipRight)+" "+parseInt(nomb.currentStyle.clipBottom)+" "+parseInt(nomb.currentStyle.clipLeft)+")";
		nomb.style.top = nomb.currentStyle.top;
		}
  }
  hayclik = true;
  bajar();
}


function finscroll() {
 hayclik = false;
 if(idset) clearTimeout(idset);
}


