	function getPageSize() {
		var xScroll, yScroll;
		if (window.innerHeight && window.scrollMaxY){
			xScroll = document.body.scrollWidth;
			yScroll = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight){
			xScroll = document.body.scrollWidth;
			yScroll = document.body.scrollHeight;
		} else {
			xScroll = document.body.offsetWidth;
			yScroll = document.body.offsetHeight;
		}
		var windowWidth, windowHeight;
		if (self.innerHeight) {
			windowWidth = self.innerWidth;
			windowHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) {
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		} else if (document.body) {
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}	
		if(yScroll < windowHeight) pageHeight = windowHeight;
		else pageHeight = yScroll;
		if(xScroll < windowWidth) pageWidth = windowWidth;
		else pageWidth = xScroll;
		arrayPageSize = {pageWidth:pageWidth,pageHeight:pageHeight,windowWidth:windowWidth,windowHeight:windowHeight}
		return arrayPageSize;
	}
	
	function getPageScroll(){
		var yScroll;
		if (self.pageYOffset) yScroll = self.pageYOffset;
		else if (document.documentElement && document.documentElement.scrollTop) yScroll = document.documentElement.scrollTop;
		else if (document.body) yScroll = document.body.scrollTop;
		arrayPageScroll = {yScroll:yScroll};
		return arrayPageScroll;
	}

	function fechaPop(obj) {
		try {
			document.body.removeChild(document.getElementById('popZoom'));
			document.body.removeChild(document.getElementById('popSombra'));
		} catch(e) {}
	}

	function abrePop(params) {
		var url = params.popUrl;
		var popClass = params.popClass;
		var pageSize = getPageSize();
		var pageScroll = getPageScroll();
		try {
			document.body.removeChild(document.getElementById('popZoom'));
			document.body.removeChild(document.getElementById('popSombra'));
		} catch(e) {}
		var divContainer = document.createElement('div');
		divContainer.style.visibility = 'hidden';
		divContainer.id = 'popZoom';
		divContainer.className = 'popZoom';
		divContainer.style.height = (pageSize.pageHeight + 'px');
		var divSombra = document.createElement('div');
		divSombra.id = 'popSombra';
		divSombra.className = 'popSombra';
		divSombra.style.height = (pageSize.pageHeight + 'px');
		divSombra.style.backgroundPosition = 'center ' + (pageScroll.yScroll + ((pageSize.windowHeight - 100)/2)) + 'px';
		document.body.appendChild(divSombra);
		document.body.appendChild(divContainer);
		var pop = new popObj(url,divContainer,divSombra,popClass);
	}
		
	function popObj(url,divContainer,divSombra,popClass) {
		var self = this;
		this.xml = new xmlObj( {
			url: url,
			obj: self, 
			func: 'show', 
			args: { divContainer:divContainer,divSombra:divSombra,popClass:popClass }
		} );
	}
	
	popObj.prototype.show = function(args) {
		var htm = args.responseText;
		var divContainer = args.divContainer;
		var divSombra = args.divSombra;
		divContainer.innerHTML = htm;
		var popClass = args.popClass;
		var box = false;
		var tags = divContainer.getElementsByTagName('div');
		for(var i=0,len=tags.length;i<len;i++) if(tags[i].className.indexOf(popClass)>-1) box = tags[i];
		if(!box) return;
		var largura = box.offsetWidth;
		var altura = box.offsetHeight;
		var pageSize = getPageSize();
		var pageScroll = getPageScroll();
		var boxTop = pageScroll.yScroll + ((pageSize.windowHeight - altura) / 2);
		var boxLeft = ((pageSize.pageWidth - largura) / 2);
		box.style.position = 'absolute';
		box.style.top = (boxTop < 0) ? "0px" : boxTop + "px";
		box.style.left = (boxLeft < 0) ? "0px" : boxLeft + "px";
		divContainer.style.visibility = 'visible';
		divSombra.style.backgroundImage = 'none';
	}
						
/* --------- */