<!--
/**********************************************************************************   
ScrollText 
*   Copyright (C) 2001 Thomas Brattli
*   This script was released at DHTMLCentral.com
*   Visit for more great scripts!
*   This may be used and changed freely as long as this msg is intact!
*   We will also appreciate any links you could give us.
*
*   Made by Thomas Brattli
*
*   Script date: 09/23/2001 (keep this date to check versions) 
*********************************************************************************/
function lib_bwcheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=(navigator.userAgent.indexOf("Opera")>-1 && document.getElementById)?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}
var bw=lib_bwcheck()
/*****************

You set the width and height of the divs inside the style tag, you only have to
change the divScrollTextCont, Remember to set the clip the same as the width and height.
You can remove the divUp and divDown layers if you want. 
This script should also work if you make the divScrollTextCont position:relative.
Then you should be able to place this inside a table or something. Just remember
that Netscape crash very easily with relative positioned divs and tables.

Updated with a fix for error if moving over layer before pageload.

****************/


//If you want it to move faster you can set this lower, it's the timeout:
var speed = 50

//Sets variables to keep track of what's happening
var loop, timer

//Object constructor
function makeObj(obj,nest){
    nest=(!nest) ? "":'document.'+nest+'.'
	this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
  	this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
	this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight
	this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight
	this.up=goUp;this.down=goDown;
	this.moveIt=moveIt; this.x=0; this.y=0;
	this.posLeftIni=this.css.left;
	this.posTopIni=this.css.top;
    this.obj = obj + "Object"
    eval(this.obj + "=this")
    return this
}

// A unit of measure that will be added when setting the position of a layer.
var px = bw.ns4||window.opera?"":"px";

function moveIt(x,y){
	this.x = x
	this.y = y
	this.css.left = this.x+px
	this.css.top = this.y+px
}

//Makes the object go up
function goDown(move){
	if (this.y>-this.scrollHeight+oCont.clipHeight-10){
		this.moveIt(0,this.y-move)
			if (loop) setTimeout(this.obj+".down("+move+")" ,speed)
	}
}

//Makes the object go down
function goUp(move){
	if (this.y<0){
		this.moveIt(0,this.y-move)
		if (loop) setTimeout(this.obj+".up("+move+")" ,speed)
	}
}

function Inicio(){
	mostrarHistoria = new makeObj('divSubHist');
	mostrarActualidad = new makeObj('divSubAct');
	mostrarImagenes = new makeObj('divSubIma');
	mostrarEstacion = new makeObj('divSubEst');
	mostrarSede = new makeObj('divSubSede');
	mostrarHermandad = new makeObj('divSubHdad');
	mostrarAula = new makeObj('divSubAcf');
	mostrarHermanos = new makeObj('divSubHer');
	oEscudo = new makeObj('divEscudo');
	oDivInfo1 = new makeObj('divInfo1');
	oDivInfo2 = new makeObj('divInfo2');
	oPrincipal = new makeObj('divPrincipal');
	centrarCapa();
}

	var divCenter = new Array();
function centrarCapa()
{
	divCenter[0]=	"mostrarHistoria";
	divCenter[1]=	"mostrarActualidad";
	divCenter[2]=	"mostrarImagenes";
	divCenter[3]=	"mostrarEstacion";
	divCenter[4]=	"mostrarSede";
	divCenter[5]=	"mostrarHermandad";
	divCenter[6]=	"mostrarAula";
	divCenter[7]=	"mostrarHermanos";
	divCenter[8]= "oPrincipal"
	divCenter[9]=	"oEscudo";
	divCenter[10]=	"oDivInfo1";
	divCenter[11]=	"oDivInfo2";

	var windowWidth = bw.ie ? document.body.clientWidth : window.innerWidth;
	var windowHeight = bw.ie ? document.body.clientHeight : window.innerHeight;
	//alert("ancho: "+windowWidth)
	//alert("alto: "+windowHeight)
	var posLeftNum;
	var posUpNum;
	for (i=0;i<12;i++)
	{ 
		eval("posIniUp = parseInt(" + divCenter[i] +".posTopIni)")
		eval("posIniLeft = parseInt(" + divCenter[i] +".posLeftIni)")
		eval(divCenter[i] + ".moveIt( posIniLeft, posIniUp)")
	}

	if(windowWidth>700)
	{
		for (i=0;i<12;i++){ 
			eval("posIniLeft = parseInt(" + divCenter[i] +".posLeftIni)")
			eval("posUp = parseInt(" + divCenter[i] + ".css.top)")
			eval(divCenter[i] + ".moveIt(posIniLeft," + posUp +")")
			eval("posLeft = parseInt(" + divCenter[i] + ".css.left)")
			posLeft=posLeft+(Math.floor(windowWidth / 2)-350)
			eval(divCenter[i] + ".moveIt(" + posLeft + "," + posUp +")")
		}
	}
	if(windowHeight>426)
	{
		for (i=0;i<12;i++){ 
			eval("posIniUp = parseInt(" + divCenter[i] +".posTopIni)")
			eval("posLeft = parseInt(" + divCenter[i] + ".css.left)")
			eval(divCenter[i] + ".moveIt(" + posLeft + ", posIniUp)")
			eval("posUp = parseInt(" + divCenter[i] + ".css.top)")
			posUp=posUp+(Math.floor(windowHeight / 2)-213)
			eval(divCenter[i] + ".moveIt(" + posLeft + "," + posUp +")")
		}
	}

	for (i=8;i<12;i++){ 
		if (!(divCenter[i]=="oFlechas" && limit>=0))
			eval(divCenter[i] + ".css.visibility=\"visible\"")
	}
}

function initFadeIn() {
	imageId = 'thephoto';
	image = document.getElementById(imageId);
//	setOpacity(image, 0);
//	image.style.visibility = "visible";
	setOpacity(image, 0);
	image.style.visibility = "visible";
	fadeIn(imageId,110);
}
function fadeIn(objId,opacity) {
	if (document.getElementById) {
		obj = document.getElementById(objId);
		if (opacity <= 100) {
			setOpacity(obj, opacity);
			opacity += 10;
			opacidad=opacity;
			el=window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 50);
		}
		else
		{
			obj.style.visibility = "visible";
			//scrolltextInit();
		}
	}
}

function setOpacity(obj, opacity) {
	opacity = (opacity == 100)?99.999:opacity;
	// IE/Win
	obj.style.filter = "alpha(opacity:"+opacity+")";
	// Safari<1.2, Konqueror
	obj.style.KHTMLOpacity = opacity/100;
	// Older Mozilla and Firefox
	obj.style.MozOpacity = opacity/100;
	// Safari 1.2, newer Firefox and Mozilla, CSS3
	obj.style.opacity = opacity/100;
}
function initFade(init) {
	imageId = 'thephoto';
	image = document.getElementById(imageId);
//	setOpacity(image, 0);
//	image.style.visibility = "visible";
	fadeOut(imageId,100,init);
}
function fadeOut(objId,opacity,init) {
	if (document.getElementById) {
		obj = document.getElementById(objId);
		if (opacity >= 0) {
			setOpacity(obj, opacity);
			opacity -= 10;
			window.setTimeout("fadeOut('"+objId+"',"+opacity+",'"+init+"')", 50);
		}
		else
		{
			obj.style.visibility = "hidden";
			//scrolltextInit();
			eval(init+"()")
		}
	}
}
function initFadeIndex(init) {
	imageId = 'thephoto2';
	image = document.getElementById(imageId);
	imageId2 = 'act';
	image2 = document.getElementById(imageId2);
//	setOpacity(image, 0);
//	image.style.visibility = "visible";
	fadeOutIndex(imageId, imageId2,100,init);
}
function fadeOutIndex(objId,objId2,opacity,init) {
	if (document.getElementById) {
		obj = document.getElementById(objId);
		obj2 = document.getElementById(objId2);

			//obj.style.zIndex ="0";
		if (opacity >= 0) {
			//eval(init+"()")
			mostrar(init);
			setOpacity(obj, opacity);
			setOpacity(obj2, opacity);
			opacity -= 10;
			window.setTimeout("fadeOutIndex('"+objId+"', '"+objId2+"',"+opacity+",'"+init+"')", 50);
		}
		else
		{
			document.getElementById('divEscudo').style.zIndex = 0;
			//obj.style.zIndex ="0";
			//scrolltextInit();
		}
	}
}
function mostrar(init)
{
	mostrarHistoria = new makeObj('divSubHist');
	mostrarActualidad = new makeObj('divSubAct');
	mostrarImagenes = new makeObj('divSubIma');
	mostrarEstacion = new makeObj('divSubEst');
	mostrarSede = new makeObj('divSubSede');
	mostrarHermandad = new makeObj('divSubHdad');
	mostrarAula = new makeObj('divSubAcf');
	mostrarHermanos = new makeObj('divSubHer');
	textoNoticias = new makeObj('divNoticias');
	//textoNoticias.el.css.visibility="hidden";
	textoNoticias.el.innerHTML="";
	var divSub = new Array();

	divSub[0]=	"mostrarHistoria";
	divSub[1]=	"mostrarActualidad";
	divSub[2]=	"mostrarImagenes";
	divSub[3]=	"mostrarEstacion";
	divSub[4]=	"mostrarSede";
	divSub[5]=	"mostrarHermandad";
	divSub[6]=	"mostrarAula";
	divSub[7]=	"mostrarHermanos";
	for (i=0;i<8;i++){ 
		if (!(divSub[i]==init))
			eval(divSub[i] + ".css.visibility=\"hidden\"")
		else
			eval(divSub[i] + ".css.visibility=\"visible\"")
		}
}
function mostrarHistoria()
{
		obj1 = document.getElementById("divSubHist");
		obj2 = document.getElementById("divSubAct");
		obj1.style.visibility = "visible";
		obj2.style.visibility = "hidden";
}
function mostrarAct()
{
		obj2 = document.getElementById("divSubHist");
		obj1 = document.getElementById("divSubAct");
		obj1.style.visibility = "visible";
		obj2.style.visibility = "hidden";
}
function fadeOut(objId,opacity,init) {
	if (document.getElementById) {
		obj = document.getElementById(objId);
		if (opacity >= 0) {
			setOpacity(obj, opacity);
			opacity -= 10;
			window.setTimeout("fadeOut('"+objId+"',"+opacity+",'"+init+"')", 50);
		}
		else
		{
			obj.style.visibility = "hidden";
			//scrolltextInit();
			eval(init+"()")
		}
	}
}
function centrarFondo()
{
	fondo=new makeObj('photoholder')
	var windowWidth = bw.ie ? document.body.clientWidth : window.innerWidth;
	var windowHeight = bw.ie ? document.body.clientHeight : window.innerHeight;
	var posLeftNum;
	var posUpNum;
	var posUp=0
	var posLeft=0
	if(windowWidth>700)
	{
			posLeft=posLeft+(Math.floor(windowWidth / 2)-350)
			fondo.moveIt(posLeft,posUp)
	}
	if(windowHeight>426)
	{

			posUp=posUp+(Math.floor(windowHeight / 2)-213)
			fondo.moveIt(posLeft,posUp)
	}
}
function centrarFondo()
{
	fondo=new makeObj('photoholder')
	var windowWidth = bw.ie ? document.body.clientWidth : window.innerWidth;
	var windowHeight = bw.ie ? document.body.clientHeight : window.innerHeight;
	var posLeftNum;
	var posUpNum;
	var posUp=0
	var posLeft=0
	if(windowWidth>700)
	{
			posLeft=posLeft+(Math.floor(windowWidth / 2)-350)
			fondo.moveIt(posLeft,posUp)
	}
	if(windowHeight>426)
	{

			posUp=posUp+(Math.floor(windowHeight / 2)-213)
			fondo.moveIt(posLeft,posUp)
	}
}
//function LeerArchivo(nombreArchivo)
//    nombreArchivo = server.mapPath(nombreArchivo);
//    fso = Server.CreateObject("Scripting.FileSystemObject");
//    f = fso.openTextFile(nombreArchivo) ;
//    contenidoArchivo = f.readall 
//    set f = nothing 
//    set fs = nothing 
//    LeerArchivo = contenidoArchivo
//end function

// -->