function hide_div(div)
{
	div = parent.$(div);
	div.hide();  
	$('overlay').hide();
}

function show_div(div)
{
	$('overlay').style.top = 0;
    //$('overlay').style.height = document.body.scrollHeight+"px"; // no funciona
	$('overlay').show();
    center_div(div);
}

function center_div(element)
{
	element = $(element);
	
	var my_width  = get_window_width();
	var my_height = get_window_height();

	element.style.position = 'absolute';
	element.style.zIndex   = 999999999;
	
	var scrollY = 0;
	if ( document.documentElement && document.documentElement.scrollTop ) {
		scrollY = document.documentElement.scrollTop;
	} else if ( document.body && document.body.scrollTop ) {
		scrollY = document.body.scrollTop;
	} else if ( window.pageYOffset ) {
		scrollY = window.pageYOffset;
	} else if ( window.scrollY ) {
		scrollY = window.scrollY;
	}
	var elementDimensions = Element.getDimensions(element);
	
	var setX = ( my_width  - elementDimensions.width  ) / 2;
	var setY = ( my_height - elementDimensions.height ) / 2 + scrollY;
	
	setX = ( setX < 0 ) ? 0 : setX;
	setY = ( setY < 0 ) ? 0 : setY;
	
	element.style.left = setX + "px";
	element.style.top  = setY + "px";
	
	element.style.display  = 'block';
}

// Alto de la Pagina
function get_window_height() {
	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;
}

// Ancho de la Pagina
function get_window_width()
{
	var windowWidth = 0;
	if (typeof(window.innerWidth) == 'number') {
		windowWidth = window.innerWidth;
	} else {
		if (document.documentElement && document.documentElement.clientWidth) {
			windowWidth = document.documentElement.clientWidth;
		} else {
			if (document.body && document.body.clientWidth) {
				windowWidth = document.body.clientWidth;
			}
		}
	}
	return windowWidth;
}