// Liquid Effect
// finds the width/height of the browser and reloads the page when resized to create a liquid layout
// 19990328

// Copyright (C) 1999 Dan Steinman
// Distributed under the terms of the GNU Library General Public License
// Available at http://www.dansteinman.com/dynapi/

function BrowserCheck() {
	var b = navigator.appName
	if (b=="Netscape") this.b = "ns"
	else if (b=="Microsoft Internet Explorer") this.b = "ie"
	else this.b = b
	this.v = parseInt(navigator.appVersion)
	this.ns = (this.b=="ns" && this.v>=4)
	this.ns4 = (this.b=="ns" && this.v==4)

	this.ie = (this.b=="ie" && this.v>=4)
	this.ie4 = (navigator.userAgent.indexOf('MSIE 4')>0)
	this.ie5 = (navigator.userAgent.indexOf('MSIE 5')>0)
	if (this.ie5) this.v = 5
	this.min = (this.ns||this.ie)
}

// automatically create the "is" object
is = new BrowserCheck()

function findWH() {
	winW = (is.ns)? window.innerWidth : document.body.offsetWidth-20
	winH = (is.ns)? window.innerHeight : document.body.offsetHeight-4
}
function makeLiquid() {
	if ((is.ns && (winW!=window.innerWidth || winH!=window.innerHeight)) || is.ie)
	history.go(0)
}

function css(id,left,top,width,height,color,vis,z,other) {
	if (id=="START") return '<STYLE TYPE="text/css">\n'
	else if (id=="END") return '</STYLE>'
	var str = (left!=null && top!=null)? '#'+id+' {position:absolute; left:'+left+'px; top:'+top+'px;' : '#'+id+' {position:relative;'
	if (arguments.length>=4 && width!=null) str += ' width:'+width+'px;'
	if (arguments.length>=5 && height!=null) {
		str += ' height:'+height+'px;'
		if (arguments.length<9 || other.indexOf('clip')==-1) str += ' clip:rect(0px '+width+'px '+height+'px 0px);'
	}
	if (arguments.length>=6 && color!=null) str += (document.layers)? ' layer-background-color:'+color+';' : ' background-color:'+color+';'
	if (arguments.length>=7 && vis!=null) str += ' visibility:'+vis+';'
	if (arguments.length>=8 && z!=null) str += ' z-index:'+z+';'
	if (arguments.length==9 && other!=null) str += ' '+other
	str += '}\n'
	return str
}
function writeCSS(str,showAlert) {
	str = css('START')+str+css('END')
	document.write(str)
	if (showAlert) alert(str)
}


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



function rollover(layer1,layer2,imgname,imgscr,layer3) {
	if (ie4) {
		document.images[imgname].src = eval(imgscr + ".src")
	} 
	if (ns4) {
	
		if (layer3!=null) eval('document.'+layer1+'.document.'+layer2+'.document.'+layer3+'.document.images["'+imgname+'"].src = '+imgscr+'.src'); 
		else {
			if (layer1!=null && layer2!=null) 		eval('document.'+layer1+'.document.'+layer2+'.document.images["'+imgname+'"].src = '+imgscr+'.src');
			}
		}
	
}

var activa = 0;
var foto = 1;
	
	function encender(num) {
		eval("ocultar('tsm"+activa+"','libre')");
		eval("mostrar('tsm"+num+"','libre')");
		activa = num;
	}	
	
	function cambiar(id,num,mad) {
		eval("ocultar('"+id+foto+"','"+mad+"')");
		eval("mostrar('"+id+num+"','"+mad+"')");
		foto = num;
	}

// mostrar-ocultar capas	
function mostrar(id,madre) {
if (ns4 && madre!='libre'){ 
	eval('document.'+madre+'.document.'+id+'.visibility = "show"');
	} 
	else if (ns4 && madre=='libre'){
	eval('document.'+id+'.visibility = "show"');
	}
	else if (ie4) {
	document.all[id].style.visibility = "visible";
	}
}

function ocultar(id,madre) {
if (ns4 && madre!='libre'){ 
	eval('document.'+madre+'.document.'+id+'.visibility = "hide"');
	}
	else if (ns4 && madre=='libre'){
	eval('document.'+id+'.visibility = "hide"');
	}
	else if (ie4) {
	document.all[id].style.visibility = "hidden";
	}
}

//para los links en páginas como "Preguntas"
function ve(n) {
	eval("scrollContent"+capaActiva+".hide();");
	capaActiva=n;
	//if (ie4) {eval ("scrollContent"+capaActiva+"Div.style.top = 0;")}
	//contScroll[capaActiva] = new MiniScroll(scrollWindow,eval("scrollContent" + capaActiva))
	eval("scrollContent"+capaActiva+".show();");
	if (alturatexto[n] > altext) {
			mostrar('flechascrollup','total');
			mostrar('flechascrolldown','total');
			mostrar('scrollbarra','total');
		} else {
			ocultar('flechascrollup','total');
			ocultar('flechascrolldown','total');
			ocultar('scrollbarra','total');
		}
	
	}
	
//función para paginar 
function moveBy(obj,x,y,capa) {
		obj.xpos += x
		obj.left = obj.xpos
		obj.ypos += y
		obj.top = obj.ypos
		if (obj.ypos <0) {mostrar('anterior','total')}
		if (obj.ypos == 0) {ocultar('anterior','total')} 
		if (obj.ypos <= 286-altura) {ocultar('siguiente','total')}
		if (obj.ypos > 286-altura) {mostrar('siguiente','total')}
		}

