﻿if(isUser)
{
    document.writeln("<div id=\"loadingDiv\" style=\"position:absolute;top:0px;left:0px;width:100%;text-align:center;z-index:100;display:none;\">");
    document.writeln("</div>");
    document.writeln("<div id=\"showLoading\" style=\"filter:alpha(opacity=70);-moz-opacity: 0.7;text-align:center;width:300px;height:60px;display:none;z-index:300;position:absolute;color:#666;background:#fff;border:1px solid #999; padding:5px; \">");
    document.writeln("<table height=60><tr><td valign='center' style='top-margin:20;font-size:12px;'><img src='/Common/Image/LoadingBar.gif' /><br />请稍等，正在加载……</td></tr></table>");
    document.writeln("</div>");
}
else
{
    document.writeln("<div id=\"loadingDiv\" style=\"background-color:#d8e1f1;filter:alpha(opacity=40);-moz-opacity: 0.4;position:absolute;top:0px;left:0px;width:100%;text-align:center;z-index:100;display:none;\">");
    document.writeln("</div>");
    document.writeln("<div id=\"showLoading\" style=\"text-align:center;width:300px;height:60px;display:none;z-index:300;position:absolute;color:#666;background:#fff;border:1px solid #999; padding:5px; \">");
    document.writeln("<table height=60><tr><td valign='center' style='top-margin:20;font-size:12px;'><img src='../../Common/Image/LoadingBar.gif' /><br />请稍等，正在加载……</td></tr></table>");
    document.writeln("</div>");
}

var loadingHeight;
var loadingWidth;
var loadingShowTop;
var loadingShowLeft;

function resetLoading()
{
    if (document.body.scrollHeight>=window.screen.availHeight)
    {
 	    loadingHeight=document.body.scrollHeight;
    }
    else
    {
        loadingHeight=document.body.clientHeight;
    }
    loadingWidth=document.body.offsetWidth;
    loadingShowLeft=(loadingWidth-300)/2;
    loadingShowTop=document.documentElement.scrollTop+(window.screen.availHeight-200)/2;
    
    document.getElementById("loadingDiv").style.height=loadingHeight +"px";
    document.getElementById("showLoading").style.top=loadingShowTop+"px";
    document.getElementById("showLoading").style.left=loadingShowLeft+"px";
    //alert(loadingHeight+","+loadingWidth+","+loadingShowTop+","+loadingShowLeft);
}

function loading(){
    resetLoading();
    //计算加载文字要显示的位置
    //把加载文字的层显示出来
    document.getElementById("loadingDiv").style.display="block";//显示loading层
    document.getElementById("showLoading").style.display="block";
}

function displayLoading()
{
    document.getElementById("loadingDiv").style.display="none";//显示loading层
    document.getElementById("showLoading").style.display="none";
}

loading();

window.onresize=resetLoading;

window.onload=resetLoading;

window.onscroll=resetLoading;

window.onbeforeunload=loading;
