


//Inicializacion de variables. Modificar segun preferencias.
var nwvelocidad=1;	//Velocidad del scroll, cuanto mayor es el valor, mas lento va el scroll.
var nwpaso=1;		//Son los pixels que se mueve el scroll cada vez.
var nwpausa=4000;	//Pausa entre noticias. En milisegundos.
var nwseparador=3;	//Es la altura que tiene la imagen que separa las noticias.

//Variables globales
var nwOLH;	//OutLayer Height
var nwILH;	//InLayer Height
var nwpos;	//Posicion actual del scroll
var nwns;		//True si es NetScape, False si es Internet Explorer
var nwILT;	//Propiedades de InLayer
var nwtimer;	//Temporizador
var nwOffsetY;
var nwpuls;	//True si tenemos pulsado el boton izquierdo del raton, si no false
var nwover;	//True si estamos encima de InLayer. Esto es solo para IE
var nwts=new Array();	//Tabla que contiene las posiciones de las imagenes que separan cada noticia

function scrollnews(){	//Inicializacion de variables y puesta en marcha
	var n,cp;
	nwns=document.layers;
	if (nwns){
		document.OutLayerNews.document.InLayerNews.document.onmousedown=nwomd
		document.OutLayerNews.document.InLayerNews.document.onmouseup=nwomu
		document.OutLayerNews.document.InLayerNews.document.onmousemove=nwomm
		document.OutLayerNews.document.InLayerNews.document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP)
		nwOLH=parseInt(document.OutLayerNews.document.height,10);
		nwILH=parseInt(document.OutLayerNews.document.InLayerNews.document.height,10);
		nwILT=document.OutLayerNews.document.InLayerNews
	}
	else{
		if (document.onmousemove==null) document.onmousemove=nwomm;	//Estos dos eventos funcionan mejor si
		if (document.onmouseup==null) document.onmouseup=nwomu;		//estan para todo el documento.
		InLayerNews.onmousedown=nwomd;
		InLayerNews.onmouseover=nwomov;
		InLayerNews.onmouseout=nwomou;
		nwOLH=parseInt(OutLayerNews.clientHeight,10);
		nwILH=parseInt(InLayerNews.clientHeight,10);
		nwILT=InLayerNews.style
	}
	nwpos=nwOLH;
	nwILT.top=nwpos;
	nwILT.visibility='visible';
	cp=(nwns)?document.OutLayerNews.document.InLayerNews.document:document;
	n=1;
	while(cp.images['stop'+n]){
		nwts[n]=((n>1)?nwseparador:1) + ((nwns)?cp.images['stop'+n].y:cp.images['stop'+n].offsetTop);
		n++;
	}
	nwover=false;
	nwtimer=null;
	nwpuls=false;
	nwstart();
}

function nwmover(){//Bucle que mueve el scroll
	var stoptime;
	nwpos-=nwpaso;
	if ((nwpos<((-1)*nwILH)) || (nwpos>nwOLH)) nwpos=nwOLH
	nwILT.top=nwpos;
	stoptime=nwvelocidad;
	for(i in nwts){
		if (nwpos==((-1)*nwts[i])){
			stoptime=nwpausa
			break;
		}
	}
	nwtimer=setTimeout("nwmover()",stoptime)
	return;
}

function nwstop(){ // Para el movimiento del scroll
	clearTimeout(nwtimer);
	nwtimer=null;
}

function nwstart(){	//Pone en marcha el scroll
	if (nwtimer) return;
	nwmover();
}


//		Eventos

function nwomd(e){	// OnMouseDown
	if ((nwns && e.which!=1) || (!nwns && event.button!=1)) return true;
    nwOffsetY=parseInt(nwILT.top,10) - ((nwns)? e.pageY : event.y+document.body.scrollTop);
	nwstop()
	nwpuls=true;
	return true;
}

function nwomu(e){	// OnMouseUp
	if ((!nwpuls) || (nwns && e.which!=1) || (!nwns && event.button!=1)) return true;
	nwpuls=false;
	if (!nwover) nwstart();
	return true;
}

function nwomm(e){	// OnMouseMove
	if ((!nwpuls) || (nwns && e.which!=1) || (!nwns && event.button!=1)) return true;
    nwpos=nwOffsetY + ((nwns)? e.pageY : event.y+document.body.scrollTop);
	nwILT.top=nwpos
	return false;
}
function nwomov(e){	// OnMouseOver. En NS, el over se produce sobre imagenes y enlaces que contenga la capa.
	nwover=true;
	if (nwpuls) return true;
	nwstop();
	return true;
}
function nwomou(e){	// OnMouseOut. En NS, el out se produce sobre imagenes y enlaces que contenga la capa.
	nwover=false
	if (nwpuls) return true;
	nwstart();
	return true;
}

function JM_omu(e){
	if (!ns) return nwomu(e);
	return true
}

function JM_omm(e){
	if (!ns) return nwomm(e);
	return true
}

// hasta aquí


function MM_reloadPage(init){//reloads the window if Nav4 resized
	if(init==true){
		with(navigator){
			if((appName=="Netscape")&&(parseInt(appVersion)==4)){
				document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage;
			}
		}
	}else if(innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH){
		location.reload();
	}
}

MM_reloadPage(true);

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_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_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 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];}
}



function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function cambio1(object) {
		object.className='fondomenuon';	
}

function cambio2(object) {
		object.className='fondomenuoff';	
}

function salto(capitulo) {
parent.top.location = capitulo;
	} 

//-->
