var PostbackLoad = 
{

	UpdateDisplay: function()
	{
	    //show the context and position in the
	    //center of the page.
	    
	    PostbackLoad.ShowLoading();
	},
	
	ShowLoading: function()
	{
        var availHeight;
        var availWidth;
        var scrollHeight;
        var scrollWidth;
     
        if(typeof(window.innerWidth) == 'number'){
            availHeight = window.innerHeight;
            availWidth = window.innerWidth;
            scrollHeight = pageYOffset;
            scrollWidth = pageXOffset;
        }
        else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)){
            availHeight = document.documentElement.clientHeight;
            availWidth = document.documentElement.clientWidth;
            scrollHeight = document.documentElement.scrollTop;
            scrollWidth = document.documentElement.scrollLeft;
        }
        else if(document.body && (document.body.clientWidth || document.body.clientHeight)){
            availHeight = document.body.clientHeight;
            availWidth = document.body.clientWidth;
            scrollHeight = document.body.scrollTop;
            scrollWidth = document.body.scrollLeft;
        }
     
        LoadingControl.style.position="absolute";
        LoadingControl.style.zIndex="100";
        LoadingControl.style.display="block";
        
        var indicatorWidth = LoadingControl.offsetWidth;
        var indicatorHeight = LoadingControl.offsetHeight;

        var left = ((availWidth/2) - (indicatorWidth/2)) + (scrollWidth);
        var top = ((availHeight/2) - (indicatorHeight)) + (scrollHeight);
        
        left = PostbackLoad.Truncate(left);
        top = PostbackLoad.Truncate(top);
        
        LoadingControl.style.top=top+"px";
        LoadingControl.style.left=left+"px";
        LoadingControl.style.visibility="visible";
        LoadingControl.style.margin="0 0 0 0";
    },
    
    Truncate: function(num) {
		var str = num + ''; // Now it's a string.
		if (str.indexOf('.') == -1) { return str; }
		dot = str.indexOf('.');
		return str.substring(0,dot);
	} 

}
