﻿// JScript File
//window.onscroll=scolled;
window.onload=LoadOverLay;
// window.captureEvents(Event.CLICK);
//   window.onClick=test;
var CurrentlyLoading=false;
var windowWidth, windowHeight;
var processMessage;
var overlay;
var IE = document.all?true:false;
var PageArray=new Array();

function LoadOverLay()
{
overlay=document.getElementById('overlay');    
processMessage=document.getElementById('processMessage');    
PageArray=getPageSize();
overlay.style.width=PageArray[0]+'px';
overlay.style.height=PageArray[1]+'px';
processMessage.style.width=PageArray[0]+'px';
//var height=(windowHeight/2)+window.scrollY;alert(document.getElementById('loadImage').style.marginTop);
//document.getElementById('loadImage').style.marginTop= height+'px';
var ScrollTop = document.body.scrollTop;
if (ScrollTop == 0)
{
    if (window.pageYOffset)
        ScrollTop = window.pageYOffset;
    else
        ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
}
//document.getElementById('loadImage').style.marginTop= ScrollTop+'px';
}

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;
	}
	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];
}
