element.style.top = (GetBrowserDocument().scrollTop) + "px";
element.style.left=(window.screen.width/2-element.offsetWidth/2)+'px';
$("msgBox").style.marginTop = (-$("msgBox").offsetHeight/2 + GetBrowserDocument().scrollTop) + "px";
$("msgBox").style.marginLeft = (-$("msgBox").offsetWidth/2 + GetBrowserDocument().scrollLeft) + "px";
function GetBrowserDocument()
{
var _dcw = document.documentElement.clientHeight;
var _dow = document.documentElement.offsetHeight;
var _bcw = document.body.clientHeight;
var _bow = document.body.offsetHeight;
if(_dcw == 0) return document.body;
if(_dcw == _dow) return document.documentElement;
if(_bcw == _bow && _dcw != 0)
return document.documentElement;
else
return document.body;
}