function getPageSize() {
	        
     var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	
	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}

	return [pageWidth,pageHeight];
}

function posaOverlay(dInterior) {
	var objBody = $$('body')[0];
	var over=new Element('div');
		over.id="overlay2";
		objBody.appendChild(over);
		over.style.display='none';
		
		var arrPageSize=getPageSize();
		over.style.position='absolute';
		over.style.top='0px';
		over.style.left='0px';
		over.style.width=arrPageSize[0]+"px";
		over.style.height=arrPageSize[1]+"px";
		over.style.backgroundColor='#000000';
		over.style.zIndex=9000;
		
		dInterior.show();
	var wInt=dInterior.getWidth();
	var hInt=dInterior.getHeight();
		dInterior.hide();
		
		dInterior.style.zIndex=9500;
		dInterior.style.position='absolute';
		
		
		dInterior.style.top="200px";
		dInterior.style.left=parseInt((arrPageSize[0]-wInt)/2)+"px";
		
		new Effect.Appear(over, { duration: 0.5, from: 0.0, to: 0.9 });
		new Effect.Appear(dInterior, { duration: 1.0, from: 0.0, to: 1 });
}

function amagaOverlay(dInterior) {
	new Effect.Fade('overlay2', { duration: 0.5, from: 0.8, to: 0 });
	new Effect.Fade(dInterior, { duration: 0.5, from: 1, to: 0, 
			afterFinish: function() { 
				var objBody = $$('body')[0];
				objBody.appendChild(dInterior);
				objBody.removeChild($('overlay2'));
			} 
		});
}
