msgBox = null;

function getScrollY()
{
  var scrOfY = 0;
  if( typeof(window.pageYOffset) == 'number' )
    //Netscape compliant
    scrOfY = window.pageYOffset;
  else if(document.body && (document.body.scrollLeft || document.body.scrollTop))
    //DOM compliant
    scrOfY = document.body.scrollTop;
  else if(document.documentElement && (document.documentElement.scrollLeft
    || document.documentElement.scrollTop))
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
  return scrOfY;
}

function showShortMsg(msgText, time, width)
{
  var boxExists = false;
  msgBox = document.getElementById("msgBox");
  if (msgBox)
  {
    boxExists = true;
  }
  else
  {
    msgBox = document.createElement("div");    
    msgBox.setAttribute("id", "msgBox");
  }

  msgBox.style.display = "block";
  msgBox.style.position = "absolute";
  msgBox.style.left = ((screen.availWidth - width) / 2) + "px";
  var scrollY = getScrollY();
  msgBox.style.top = ((screen.availHeight) / 2 - 50 + scrollY) + "px";
  msgBox.style.width = width + "px";
  msgBox.style.border = "solid 4px blue";
  msgBox.style.padding = "10px";
  msgBox.style.backgroundColor = "#fff";
  msgBox.style.color = "#454545";
  msgBox.style.textAlign = "center";

  msgBox.innerHTML = msgText;
  if (!boxExists)
    document.body.appendChild(msgBox);
  window.setTimeout("hideMsgBox();", time * 1000);
}

function hideMsgBox()
{
  if (msgBox)
    msgBox.style.display = "none";
}
