// JScript source code

function precargarImagenes(){
    var d = document;
    actual = 0;
    if (d.images){
        if(!d.vector){
            d.vector = new Array();
        }
        var i;
        for(i = 0; i != precargarImagenes.arguments.length; i++){
            d.vector[i] = new Image;
            d.vector[i].src = 'imagenes/' + precargarImagenes.arguments[i];
        }
    }
}
			
function rotulo_title(txt) {
	document.title=txt;
}

function lTrim(sStr){ 
	while (sStr.charAt(0) == " ") 
		sStr = sStr.substr(1, sStr.length - 1); 
    return sStr; 
} 

function rTrim(sStr){ 
    while (sStr.charAt(sStr.length - 1) == " ") 
	    sStr = sStr.substr(0, sStr.length - 1); 
	return sStr; 
} 

function allTrim(sStr){ 
	return rTrim(lTrim(sStr)); 
} 

function Simbolo(aux){
	if (aux.indexOf("'") != -1){return true;}
	if (aux.indexOf(";") != -1){return true;}
	if (aux.indexOf("/") != -1){return true;}
	if (aux.indexOf("\\") != -1){return true;}
	if (aux.indexOf(":") != -1){return true;}
	return false;
}

function ocultarcapa(id){
	document.getElementById(id).style.display = "none";
}

function abrir(direccion, pantallacompleta, herramientas, direcciones, estado, barramenu, barrascroll, cambiatamano, ancho, alto, izquierda, arriba, sustituir){ 
    /*
	fullscreen:  Hace que la ventana se abra en toda la pantalla  
	toolbar:  Hace que la ventana se abra con o sin barra de herramientas  
	location:  Hace que la ventana se abra con o sin barra de direcciones  
	status:  Hace que la ventana se abra con o sin barra de estado  
	menubar:  Hace que la ventana se abra con o sin barra de menú  
	scrollbars:  Hace que la ventana presente o no las barras de desplazamiento  
	resizable:  Si la ventana puede cambiar de tamaño o no  
	width:  El ancho de la ventana  
	height:  El alto de la ventana  
	top:  La posición vertical de la ventana  
	left:  La posición horizontal de la ventana */
	var opciones = "fullscreen=" + pantallacompleta + 
        ",toolbar=" + herramientas + 
        ",location=" + direcciones + 
        ",status=" + estado + 
        ",menubar=" + barramenu + 
        ",scrollbars=" + barrascroll + 
        ",resizable=" + cambiatamano + 
        ",width=" + ancho + 
        ",height=" + alto + 
        ",left=" + izquierda + 
        ",top=" + arriba; 
	 var ventana = window.open(direccion,"venta",opciones,sustituir); 
}   
		
function abreventana(url,alto,ancho) {
    web = url;
	izq = (screen.width - ancho) / 2;
	arr = ((screen.height - alto) / 2) - 15;
	popupWin = window.open(web, "_blank", "scroll='yes',width=" + ancho + ",height=" + alto + ",top=" + arr + ",left=" + izq);
}	

function ValidarCorreo(Email){
	var Formato = /^([\w-\.])+@([\w-]+\.)+([a-z]){2,4}$/;
	var Comparacion = Formato.test(Email);
	if(Comparacion == false){
    	return false;
    } else {
	    return true;
	}
}
			
function fillthescreen() {
    winH = getWindowHeight();
	heightNeeded=winH - 125;//100px del pie (hay que restarlos)
	if( typeof( window.innerWidth ) != 'number' ) {
        //Explorer no reconoce min-height
	    if (winH > 0) {
			var contentHeight = document.getElementById('content').offsetHeight;
			var footerHeight  = document.getElementById('footer').offsetHeight;
			if (winH - (contentHeight + footerHeight) >= 0) { //Posición RELATIVA
                document.getElementById('footer').style.position = 'relative';
	            document.getElementById('footer').style.top = (winH - (heightNeeded + footerHeight)) + 'px';
	            document.getElementById('content').style.height=heightNeeded+'px';
	            heightNeeded = heightNeeded - 145;
                    
                document.getElementById('tbl_1').style.height=heightNeeded+'px';
	            document.getElementById('izq').style.height=heightNeeded+'px';
						
			}
			else { //Posición ESTÁTICA
	
                document.getElementById('footer').style.position = 'static';
                heightNeeded = heightNeeded - 245;
	            document.getElementById('izq').style.height=heightNeeded+'px';
			}
		}
	}
	else { //Para cualquier otro navegador-> minHeight
	    var contentHeight = document.getElementById('content').offsetHeight;
		var footerHeight  = document.getElementById('footer').offsetHeight;
		if (winH - (contentHeight + footerHeight) >= 0) {
	            
	        document.getElementById('footer').style.position = 'relative';
	        document.getElementById('footer').style.top = (winH - (heightNeeded + footerHeight)) + 'px';
            document.getElementById('content').style.height=heightNeeded+'px';
			heightNeeded = heightNeeded - 245;
            document.getElementById('izq').style.height=heightNeeded+'px';
			document.getElementById('tbl_1').style.height=heightNeeded+'px';
		}
	}	
}
		
function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}
	else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}
		else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}

function setFooter() {
	if (document.getElementById) {
		var windowHeight = getWindowHeight();
		if (windowHeight > 0) {
			var contentHeight = document.getElementById('content').offsetHeight;
			var footerElement = document.getElementById('footer');
			var footerHeight  = footerElement.offsetHeight;
			if (windowHeight - (contentHeight + footerHeight) >= 0) {
				footerElement.style.position = 'relative';
				footerElement.style.top = (windowHeight - (contentHeight + footerHeight)) + 'px';
			}
			else {
				footerElement.style.position = 'static';
			}
		}
	}
}