<!--
/**********************************************************************************   
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.ie7=(this.ver.indexOf("MSIE ")>-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.ie7
	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.ie7 || 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, wait

//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.scrollWidth=bw.ns4?this.css.document.width:this.el.offsetWidth
	this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight
	this.clipWidth=bw.ns4?this.css.clip.width:this.el.offsetWidth
	this.up=goUp;this.down=goDown;
	this.left=goLeft;this.right=goRight;
	this.left2=goLeft2;this.right2=goRight2;
	this.moveIt=moveIt; this.x=0; this.y=0;
    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.x<0){
		this.moveIt(0,this.y-move)
		if (loop) setTimeout(this.obj+".up("+move+")" ,speed)
	}
}

//Makes the object go up
function goLeft(move){
	if (oScroll.x<=-oScroll.scrollWidth)
	{
		oScroll.moveIt(oScroll2.x+oScroll2.scrollWidth,0);
	}
	if (oScroll.x>-oScroll.scrollWidth){
		oScroll.moveIt(oScroll.x-move,0)
			if (loop) setTimeout(oScroll.obj+".left("+move+")" ,speed)
	}
}

//Makes the object go down
function goRight(move){
	if (oScroll.x>=oCont.scrollWidth)
	{
		oScroll.moveIt(oScroll2.x-oScroll.scrollWidth,0);
	}
	if (oScroll.x<0+oCont.scrollWidth){
		oScroll.moveIt(oScroll.x-move,0)
		if (loop) setTimeout(oScroll.obj+".right("+move+")" ,speed)
	}
}

//Makes the object go up
function goLeft2(move){
	if (oScroll2.x<=-oScroll2.scrollWidth)
	{
		oScroll2.moveIt(oScroll.x+oScroll.scrollWidth,0);
	}
	if (oScroll2.x>-oScroll2.scrollWidth){
		oScroll2.moveIt(oScroll2.x-move,0)
			if (loop) setTimeout(oScroll2.obj+".left2("+move+")" ,speed)
	}
}

//Makes the object go down
function goRight2(move){
	if (oScroll2.x>=0+oCont.scrollWidth)
	{
		oScroll2.moveIt(oScroll.x-oScroll2.scrollWidth,0);
	}
	if (oScroll2.x<0+oCont.scrollWidth){
		oScroll2.moveIt(oScroll2.x-move,0)
		if (loop) setTimeout(oScroll2.obj+".right2("+move+")" ,speed)
	}
}
//Calls the scrolling functions. Also checks whether the page is loaded or not.
function scroll(speed){
	if (scrolltextLoaded){
		loop = true;
		if (speed>0)
		{
			oScroll.down(speed)
		}
		else
		{
			oScroll.up(speed)
		}
	}
}

function scrollh2(speed){
	if (scrolltextLoaded){
		loop = true;
		if (speed>0)
		{
			oScroll2.left2(speed)
		}
		else
		{
			oScroll2.right2(speed)
		}
	}
}
function scrollh(speed){
	if (scrolltextLoaded){
		loop = true;
		if (speed>0)
		{
		//	scrollh2(oScroll2.scrollWidth/(oScroll.scrollWidth/speed))
			oScroll.left(speed)
			oScroll2.left2(speed)
		}
		else
		{
		//	scrollh2(oScroll2.scrollWidth/(oScroll.scrollWidth/speed))
			oScroll.right(speed)
			oScroll2.right2(speed)
		}
	}
}

function avPag(){
	if (oScroll.x>-oScroll.scrollWidth+oCont.clipWidth-10){
		if (oScroll.x-250<-oScroll.scrollWidth+oCont.clipWidth-10)
		{
			oScroll.moveIt(-oScroll.scrollWidth+oCont.clipWidth-10,0)
		//	mover=parseInt(oMarco.css.left)-parseInt(oCont2.css.left)
		//	oScroll2.moveIt(-oScroll2.scrollWidth+oCont2.clipWidth-3-mover,0)
		}
		else
		{
			oScroll.moveIt(oScroll.x-250,0)
		//	oScroll2.moveIt(oScroll2.x-50,0)
		}
	}
}

function rePag(){
	if (oScroll.x<0){
		if (oScroll.x+250>0)
		{
			oScroll.moveIt(0,0)
		//	mover=parseInt(oMarco.css.left)-parseInt(oCont2.css.left)
		//	oScroll2.moveIt(mover,0)
		}
		else
		{
			oScroll.moveIt(oScroll.x+250,0)
		//	oScroll2.moveIt(oScroll2.x+50,0)
		}
	}
}

//Stops the scrolling (called on mouseout)
function noScroll(){
	loop = false
	if (timer) clearTimeout(timer)
}

function pauseScroll()
{
	if (loop==true)
	{
		wait=true;
		noScroll();
	}
}

function reanudeScroll(speed)
{
	if(wait==true)
	{
		wait=false;
		scrollh(speed);
	}
}

function playScroll(speed)
{
	if(loop==false)
	{
		scrollh(speed);
	}
}

function expScroll(speed)
{
	loop = false;
	if (timer) clearTimeout(timer)
	setTimeout("scrollh("+speed+")",150);
}
function expScrollStop()
{
		loop = false;
		if (timer) clearTimeout(timer)
		setTimeout("scrollh(3)",150);
}
//Makes the object
var scrolltextLoaded = false

function scrolltextInit(){
	oCont = new makeObj('divScrollTextCont')
	oScroll = new makeObj('divText','divScrollTextCont')
	oScroll2 = new makeObj('divText2','divScrollTextCont')
//	oCont2 = new makeObj('divScrollTextCont2')
//	oScroll2 = new makeObj('divText2','divScrollTextCont2')
	oCab = new makeObj('divCab')
	oBarSub = new makeObj('divBarSub')
	oEscFond = new makeObj('divEscFond')
	oMenu = new makeObj('divMenu')
	oPiePag = new makeObj('divPiePag')
	oFlechas = new makeObj('divFlechas')
	//oMarco = new makeObj('divScrollMarco')
	centrarCapa()
	//oScroll.moveIt(0,0)
	oCont.css.visibility = "visible"
	scrolltextLoaded = true
	
		scrollh(3);
}
function stopscrolltextInit(){
	oCont = new makeObj('divScrollTextCont')
	oScroll = new makeObj('divText','divScrollTextCont')
//	oScroll2 = new makeObj('divText2','divScrollTextCont')
//	oCont2 = new makeObj('divScrollTextCont2')
//	oScroll2 = new makeObj('divText2','divScrollTextCont2')
	oCab = new makeObj('divCab')
	oBarSub = new makeObj('divBarSub')
	oEscFond = new makeObj('divEscFond')
	oMenu = new makeObj('divMenu')
	oPiePag = new makeObj('divPiePag')
	oFlechas = new makeObj('divFlechas')
	//oMarco = new makeObj('divScrollMarco')
	stopcentrarCapa()
	//oScroll.moveIt(0,0)
	oCont.css.visibility = "visible"
	scrolltextLoaded = true
}
function centrarCapa()
{
	var divCenter = new Array();
	divCenter[0]="oCont";
//	divCenter[1]="oCont2";
	divCenter[1]="oCab";
	divCenter[2]="oBarSub";
	divCenter[3]="oEscFond";
	divCenter[4]="oMenu";
	divCenter[5]="oPiePag";
	divCenter[6]="oFlechas";
	//divCenter[7]="oMarco";
	//divCenter[8]="oScroll2";
	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;
	oScroll2.moveIt(oScroll.x+oScroll.scrollWidth,0);
	if(windowWidth>700)
	{
		for (i=0;i<7;i++){ 
			eval("posUp = parseInt(" + divCenter[i] + ".css.top)")
			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<7;i++){ 
			eval("posUp = parseInt(" + divCenter[i] + ".css.top)")
			eval("posLeft = parseInt(" + divCenter[i] + ".css.left)")
			posUp=posUp+(Math.floor(windowHeight / 2)-213)
			eval(divCenter[i] + ".moveIt(" + posLeft + "," + posUp +")")
		}
	}
//	mover=parseInt(oMarco.css.left)-parseInt(oCont2.css.left)
//	oScroll2.moveIt(mover,0)
	limit=-oScroll.scrollHeight+oCont.clipHeight-10

	for (i=0;i<7;i++){ 
		if (!(divCenter[i]=="oFlechas" && limit>=0))
			eval(divCenter[i] + ".css.visibility=\"visible\"")
	}
}
function stopcentrarCapa()
{
	var divCenter = new Array();
	divCenter[0]="oCont";
//	divCenter[1]="oCont2";
	divCenter[1]="oCab";
	divCenter[2]="oBarSub";
	divCenter[3]="oEscFond";
	divCenter[4]="oMenu";
	divCenter[5]="oPiePag";
	divCenter[6]="oFlechas";
	//divCenter[7]="oMarco";
	//divCenter[8]="oScroll2";
	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;
	if(windowWidth>700)
	{
		for (i=0;i<7;i++){ 
			eval("posUp = parseInt(" + divCenter[i] + ".css.top)")
			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<7;i++){ 
			eval("posUp = parseInt(" + divCenter[i] + ".css.top)")
			eval("posLeft = parseInt(" + divCenter[i] + ".css.left)")
			posUp=posUp+(Math.floor(windowHeight / 2)-213)
			eval(divCenter[i] + ".moveIt(" + posLeft + "," + posUp +")")
		}
	}
//	mover=parseInt(oMarco.css.left)-parseInt(oCont2.css.left)
//	oScroll2.moveIt(mover,0)
	limit=-oScroll.scrollHeight+oCont.clipHeight-10

	for (i=0;i<6;i++){ 
		if (!(divCenter[i]=="oFlechas" && limit>=0))
			eval(divCenter[i] + ".css.visibility=\"visible\"")
	}
}
function ruedaDesp()
{
	if (event.wheelDelta <= -120)
	{
		if (oScroll.x>-oScroll.scrollWidth+oCont.clipWidth-10)
		{
			oScroll.moveIt(oScroll.x-10,0)
			//oScroll2.moveIt(oScroll2.x-(oScroll2.scrollWidth/(oScroll.scrollWidth/10)),0)
		}
	}
	else if (event.wheelDelta >= 120)
	{
		if (oScroll.x<0)
		{
			oScroll.moveIt(oScroll.x+10,0)
			//oScroll2.moveIt(oScroll2.x+(oScroll2.scrollWidth/(oScroll.scrollWidth/10)),0)
		}
	}
}

function tecladoDesp()
{
	if (event.keyCode == 40)
	{
		if (oScroll.x>-oScroll.scrollWidth+oCont.clipWidth-10)
		{
			oScroll.moveIt(oScroll.x-10,0)
			//oScroll2.moveIt(oScroll2.x-(oScroll2.scrollWidth/(oScroll.scrollWidth/10)),0)
		}
	}
	else if (event.keyCode = 38)
	{
		if (oScroll.x<0)
		{
			oScroll.moveIt(oScroll.x+10,0)
			//oScroll2.moveIt(oScroll2.x+(oScroll2.scrollWidth/(oScroll.scrollWidth/10)),0)
		}
	}
}

//a partir de aqui, código para el fadeout.


function initImage() {
	oPhoto = 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;
	if(windowWidth>604 && windowHeight>451)
	{
		posUp = parseInt(oPhoto.css.top)
		posLeft = parseInt(oPhoto.css.left)
		posUp=posUp+(Math.floor(windowHeight / 2)-225)
		posLeft=posLeft+(Math.floor(windowWidth / 2)-302)
		oPhoto.moveIt(posLeft,posUp)
	}
	imageId = 'thephoto';
	image = document.getElementById(imageId);
//	setOpacity(image, 0);
//	image.style.visibility = "visible";
//	fadeOut(imageId,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 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 initFadeLine() {
	imageId = 'thephoto';
	image = document.getElementById(imageId);
//	setOpacity(image, 0);
//	image.style.visibility = "visible";
	fadeOutLine(imageId,100);
}
function fadeOutLine(objId,opacity) {
	if (document.getElementById) {
		obj = document.getElementById(objId);
		if (opacity >= 0) {
			setOpacity(obj, opacity);
			opacity -= 10;
			window.setTimeout("fadeOutLine('"+objId+"',"+opacity+")", 50);
		}
		else
		{
			obj.style.visibility = "hidden";
			scrolltextInitLine();
		}
	}
}

function initFadeGo(go) {
	window.clearTimeout(el);
	imageId = 'thephoto';
	image = document.getElementById(imageId);
//	setOpacity(image, 0);
//	image.style.visibility = "visible";
	fadeOutGo(imageId,opacidad,go);
}
function fadeOutGo(objId,opacity,go) {
	if (document.getElementById) {
		obj = document.getElementById(objId);
		if (opacity >= 0) {
			setOpacity(obj, opacity);
			opacity -= 10;
			window.setTimeout("fadeOutGo('"+objId+"',"+opacity+",'"+go+"')", 50);
		}
		else
		{
			obj.style.visibility = "hidden";
			document.location.href=go;
		}
	}
}
		
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 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

// -->