
IE4=(document.all) ? 1 : 0;
NN4=(document.all) ? 0 : 1;
var mov=0;
var ttexto=0;
//////////// SCROLLING /////////////
function scrolame(objeto,id_capa,cancho,calto,rate,delay)
{
	var doc = (IE4) ? eval('document.all.' + id_capa) : eval('document.' + id_capa);
	this.objeto = objeto;
	this.name = doc;
	this.altura = altura;
	this.cancho=cancho;
	this.calto = calto;
	this.scroll = scroll;
	this.dimeTop = dimeTop;
	this.mueveY = mueveY;
	this.donde=0;
	this.rate=rate;
	this.delay=delay;
	this.cuanto="";
	this.cont=0;
	this.scrollArea = 0;
	this.Yinicial = 0;
	this.alto = (IE4) ? (this.name.clientHeight + 5) : (document.listado.document.height + 10);
	this.scrollArea = (this.alto - this.calto);
	var pprepara = (((this.dimeTop()) - (this.scrollArea) - 3)%this.rate);
	this.para = ((this.dimeTop()) - (this.scrollArea) + parseInt(pprepara));
	return this;
}

function conScroll(ancho,alto,av,rate)
{
	//530,220,5,1
	ttexto = new scrolame('ttexto','listado',ancho,alto,rate,av);	
	ttexto.altura();
	if(ttexto.alto > ttexto.calto)
	{
		(IE4) ? document.all.flechau.style.visibility="visible" : document.flechau.visibility="visible"; // hacemos visible las flechas
		(IE4) ? document.all.flechad.style.visibility="visible" : document.flechad.visibility="visible"; // hacemos visible las flechas
	}	
}

function altura()
{
	(IE4) ? eval('this.name.style.clip = "rect(0px ' + this.cancho + 'px ' + this.calto + 'px ' + '0px)"') : eval('this.name.clip.bottom= this.calto');
	this.Yinicial = this.dimeTop() + 2;
}

function dimeTop()
{
	if (IE4){return eval('this.name.style.pixelTop');}	
	else{return eval('this.name.top');}
}

function mueveY(donde,delay,rate,cuanto)
{
	if(this.name.document.forms[0])
	{this.name.document.clear()}
	if(donde && rate && delay)
	{
		this.donde = donde;
		this.rate = rate;
		this.delay = delay;
	}
	if(this.cuanto!="")
	{
		this.cont = this.cont + this.rate;
//		alert(ttexto.dimeTop());
		if(this.dimeTop() < this.cuanto)
		{
			mov=0;
			this.cont=0;
			this.cuanto="";
			return;
		}
	}

	var direccion = (this.donde=='dwn') ? 1 : -1;
	var cuanto = (this.dimeTop()) + (this.rate*direccion);
	var retorna_a = this.objeto + '.mueveY()';
	cliptop= (this.Yinicial-this.dimeTop());
	control= (direccion==1) ? this.Yinicial : this.scrollArea;
	if(this.dimeTop() >= this.para && direccion==-1 && mov!=0)
	{
		(IE4) ? eval('this.name.style.pixelTop = ' + cuanto) : eval('this.name.top = ' + cuanto);
		kk=setTimeout(eval("retorna_a"),this.delay);
		if(IE4)
		{
			eval('this.name.style.clip = "rect(' + cliptop + 'px ' + this.cancho + 'px ' + (cliptop + this.calto) + 'px 0px)"');					
		}
		else
		{
			this.name.clip.top = cliptop;
			this.name.clip.bottom = (cliptop + this.calto);
		}
	}

	else if(direccion==1 && this.dimeTop()<this.Yinicial && mov!=0)
	{
		(IE4) ? eval('this.name.style.pixelTop = ' + cuanto) : eval('this.name.top = ' + cuanto);
		(IE4) ? eval('this.name.style.clip = "rect(' + cliptop + 'px ' + this.cancho + 'px ' + (cliptop + this.calto) + 'px 0px)"') : eval('this.name.clip.top = cliptop');
		kk=setTimeout(eval("retorna_a"),this.delay);
		if(NN4)
			this.name.clip.bottom = (cliptop + this.calto);
	}
}
function scroll(donde,cuanto,tope)
{
	mov=1;
	if(cuanto)
	{
//		this.cont=0;
		this.cuanto = cuanto;
		this.tope = tope;
		this.mueveY(donde,this.delay,this.rate);
	}
	else
	{
		this.mueveY(donde,this.delay,this.rate);
	}
}
////////////////////////////////////////////////////////////////

////////////////// ROLL OVER///////////////////////////////////

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v3.0
  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); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


//////////////////////////////////////////////////////////////




