﻿﻿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,url){
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:96px; width:auto; padding:10px;z-index: 10010; position: absolute; display: block; visibility: hidden;">\
<div id="showmessage" style="width:96px;float:left;"><img src="'+url+'/images/common/loading.gif"></img></div>\
<div id="showWord" style="color:#0274C3;float:left;width:80px;margin-top:10px;margin-left:5px;">'+message+',<br/>請稍候...</div>';
document.body.appendChild(obj);
showMask(true,200,100);
}
function closeForm()
{
var objF = document.getElementById("filter");
if(objF)
{
document.body.removeChild(objF);
}
}

