// JavaScript Document
function getScrollPos(){
	if(Nav.esOp) return {y:window.pageYOffset, x:window.pageXOffset};
	else return {y:document.documentElement.scrollTop, x:document.documentElement.scrollLeft};
}
function getWindowDims(){
	if(Nav.esOp) return {w:window.innerWidth, h:window.innerHeight};
	else return {w:document.documentElement.clientWidth, h:document.documentElement.clientHeight};
}
function getBodyWHAvaible(){
	if(Nav.esOp) return {w:window.innerWidth, h:window.innerHeight};
	else return {w:document.documentElement.clientWidth, h:document.documentElement.clientHeight};
}
function getBodyDims(){
	if(Nav.esOp) return {w:document.body.clientWidth, h:document.body.clientHeight};
	else return {w:document.body.offsetWidth, h:document.body.offsetHeight};
}
function WScreen(){ return (Nav.esIE)? document.documentElement.clientWidth : window.innerWidth; }
function HScreen(){ return (Nav.esIE)? document.documentElement.clientHeight : window.innerHeight; }
function YPos(){ return (Nav.esIE)? document.documentElement.scrollTop : window.pageYOffset; }
function XPos(){ return (Nav.esIE)? document.documentElement.scrollLeft : window.pageXOffset; }
function HBody(){ return document.documentElement.scrollHeight; }
function WBody(){ return document.documentElement.scrollWidth; }

var MostrarContenido = function(contenido,e){
	if(contenido && typeof(contenido) == "string")contenido = document.getElementById(contenido);	
	if(!contenido){
		alert("Error en funcion MostrarPopUp: Contenido inexistente");
		return false;
	}
	document.body.appendChild(contenido);
	centrarContenido(contenido);
	
	contenido.style.visibility = "visible";
	if(e)StopEvent(e);
	
}
var OcultarContenido = function(contenido,e){
	if(contenido && typeof(contenido) == "string")contenido = document.getElementById(contenido);	
	contenido.style.visibility = "hidden";
	contenido.style.top = '-'+(contenido.offsetHeight+100)+"px";
	if(e)StopEvent(e);
}
var centrarContenido = function(contenido){
	if(contenido && typeof(contenido) == "string")contenido = document.getElementById(contenido);
	if(!contenido){
		alert("Error en funcion centrarContenido: Contenido inexistente");
		return false;
	}
	var scrll = getScrollPos();
	var dims = getBodyWHAvaible();
	contenido.style.top = (Math.round((dims.h - contenido.offsetHeight)/2)+scrll.y)+"px";
	contenido.style.left = (Math.round((dims.w - contenido.offsetWidth)/2)+scrll.x)+"px";
}
var WINLOAD = false;
AddEvent(window,'load',function(){
	WINLOAD = true;
})

var blockeadorGeneral = null;
var mostrarBlockeador = function(mostrar){
	if(!blockeadorGeneral){
		blockeadorGeneral = document.getElementById("layerBgGral");
		document.body.appendChild(blockeadorGeneral);
		if(Nav.esIE || Nav.esIE7) blockeadorGeneral.style.filter = 'alpha(opacity=45)';
		else blockeadorGeneral.style.MozOpacity = ".45";
		
	}
	if(mostrar){
		var alto = HScreen();
		if(alto < HBody())alto = HBody();
		var scrn = getBodyWHAvaible();
		blockeadorGeneral.style.display = "block";
		blockeadorGeneral.style.height = alto+"px";
		blockeadorGeneral.style.width = scrn.w+"px";
	}
	else blockeadorGeneral.style.display = "none";
}
function obt(i){
	return document.getElementById(i);
}


