﻿function showMask(show,widthVal,heightVal)
{
	var mask = document.getElementById('dmask');
	var frmmask = document.getElementById('frmmask');
	var frmDialog=document.getElementById('frmDialog');
	if(mask && frmmask)
	{
		var width = document.body.scrollWidth;
		if(width < document.body.clientWidth)
			width = document.body.clientWidth;
		if(width < document.documentElement.clientWidth)
			width = document.documentElement.clientWidth;
		if(width < document.documentElement.scrollWidth)
			width = document.documentElement.scrollWidth;
			
		var height = document.body.scrollHeight;
		if(height < document.body.clientHeight)
			height = document.body.clientHeight;
		if(height < document.documentElement.clientHeight)
			height = document.documentElement.clientHeight;
		if(height < document.documentElement.scrollHeight)
			height = document.documentElement.scrollHeight;
		if (window.XMLHttpRequest){
		     mask.style.position="fixed";
		     frmmask.style.position="fixed"; 
		}       
		mask.style.top = '0px';
		mask.style.left = '0px';
		mask.style.width = width + 'px';
		mask.style.height = height + 'px';
		
		frmmask.style.top = '0px';
		frmmask.style.left = '0px';
		frmmask.style.width = width + 'px';
		frmmask.style.height = height + 'px';

		if(show)
		{
			mask.style.visibility = 'visible';
			frmmask.style.visibility = 'visible';
			frmDialog.style.visibility = 'visible';
		}else
		{
			mask.style.visibility = 'hidden';
			frmmask.style.visibility = 'hidden';
			frmDialog.style.visibility = 'hidden';
		}
	}
	var width=widthVal;
	var height=heightVal;
	var top = (window.screen.height/2 + (document.body.scrollTop>document.documentElement.scrollTop ? document.body.scrollTop:document.documentElement.scrollTop) - height/2 - 100)>0?(window.screen.height/2 + (document.body.scrollTop>document.documentElement.scrollTop ? document.body.scrollTop:document.documentElement.scrollTop) - height/2 - 100):0;
	var left = (window.screen.width/2 + (document.body.scrollLeft>document.documentElement.scrollLeft ? document.body.scrollLeft:document.documentElement.scrollLeft) - width/2)>0?(window.screen.width/2 + (document.body.scrollLeft>document.documentElement.scrollLeft ? document.body.scrollLeft:document.documentElement.scrollLeft) - width/2):0;
	frmDialog.style.top = top + 'px';
	frmDialog.style.left = left + 'px';
	frmDialog.style.width = width + 'px';
	frmDialog.style.height = height + 'px';
}
function showMessage(message){
    var obj = document.createElement("div");
    obj.id="filter";
    obj.innerHTML = '<div id="dmask" style="z-index:10000; display:block; background:#000; filter:alpha(opacity=70); -moz-opacity:0.7; opacity:0.7; position:absolute; visibility:hidden;"></div>\
        <div id="frmmask" style="z-index:9999; display:block; background:#000; filter:alpha(opacity=0); -moz-opacity:0; opacity:0; position:absolute; visibility:hidden;"></div>\
        <div id="frmDialog" style="border: 1px solid #999999;background-color:#FFFFFF; vertical-align:middle;height:68px; width:auto; padding:10px;z-index: 10010; position: absolute; display: block; visibility: hidden;">\
        <div id="showmessage" style="color:#0274C3;height:48px; width:auto; "><div id="showImg" style="color:#0274C3;height:48px; width:auto;float:left;"><img src="http://wwwim.qupan.com/Img/loading.gif"></img></div>\
        <div id="showWord" style="color:#0274C3;height:48px; width:auto;float:left; padding:10px; vertical-align:middle;">'+message+',请稍候...</div></div>';
    document.body.appendChild(obj);
    showMask(true,200,50);
}
function closeForm()
{
    var objF = document.getElementById("filter");
    if(objF)
    {
        document.body.removeChild(objF);
    }
}