var needMsgWin=false;
var needWinCls=false;
var needReload=false;
var needOpenerReload=false;
var hasOpener=false;
var hasParent=false;

oMsg=window.createPopup();
onLoad='';

function ShowMsgBox()
{
//  Width=tblMsgBox.offsetWidth;
  var Width,Height,Xpos,Ypos;
/*
  if(onLoad.length>0)
  {
    eval(onLoad);
  }
*/
  Width=250;
  Height=tblMsgBox.offsetHeight;
  Xpos=parseInt((document.body.offsetWidth/2)-(Width/2));
  Ypos=(document.body.offsetHeight/2)-(Height/2);
  oMsg.document.body.innerHTML=msgBox.innerHTML;
  oMsg.show(Xpos,Ypos,Width,Height,document.body); 
}

function CloseMsgBox()
{
  if(needMsgWin)
    oMsg.hide();
  needMsgWin=false;
  if(needReload)
    document.location.reload();
  needReload=false;
  if(needOpenerReload)
    opener.document.location.reload();
  needOpenerReload=false;
  if(needWinCls)
    window.close();
  needWinCls=false;
}

function document.onreadystatechange()
{
  if (document.readyState != "complete")
    return;
  if(needMsgWin)
  {
    ShowMsgBox();
    setTimeout("CloseMsgBox()",1000);
  }
  if(hasOpener)
  {
    opener.ShowCloseMsgBox();
  }
  if(hasParent)
  {
    parent.ShowCloseMsgBox();
  }
  if(onLoad.length>0)
    eval(onLoad);
}

function ShowCloseMsgBox()
{
  if(needMsgWin)
  {
    ShowMsgBox();
    setTimeout("CloseMsgBox()",1000);
  }
}
