function PopupWindow(TheURL, TheName, TheWidth, TheHeight)
{
  var WinProperties;
  WinProperties = "scrollbars,resizeable,top=100,left=100,width=" + TheWidth + ",height=" + TheHeight;

  if(PopWin)  // if it already exists, close it.
  {
    if(!PopWin.closed)
    {
      PopWin.Close();
    }
    PopWin = 0;
    PopupWindow(TheURL, TheName, TheWidth, TheHeight);
  }
  else
  {
    WinProperties = "scrollbars,resizeable,top=100,left=100,width=" + TheWidth + ",height=" + TheHeight;
    PopWin = window.open(TheURL, TheName, WinProperties);
  }
}

function LoadBusyMsg()
{
  var BusyDiv = document.createElement('div');
  BusyDiv.className = 'BusyDiv';
  BusyDiv.id = 'Busy';
  var MyTable = document.createElement("table");
  var head = document.createElement("thead");  // needed for IE
  var foot = document.createElement("tfoot");  // needed for IE
  var tb = document.createElement("tbody");  // needed for IE
  var row1 = document.createElement("tr");
  var cell1 = document.createElement("td");
  var row2 = document.createElement("tr");
  var cell2 = document.createElement("td");
  var ballerina = document.createElement("img");
  ballerina.src = 'images/ballerinaAnimation.gif';

  var Msg = document.createTextNode('');
  var BusyText = document.createElement('div');
  BusyText.className = "BusyText";
  BusyText.Name = 'BusyText';
  BusyText.id = 'BusyText';
  BusyText.appendChild(Msg);

  MyTable.appendChild(tb);
  MyTable.appendChild(head);
  MyTable.appendChild(foot);
  tb.appendChild(row1);
  row1.appendChild(cell1);
  cell1.appendChild(ballerina);
  tb.appendChild(row2);
  cell2.appendChild(BusyText);
  row2.appendChild(cell2);
  BusyDiv.appendChild(MyTable); 
  document.body.appendChild(BusyDiv);
  ShowBusy("50", "50", "Loaded");
//  EraseBusy(); // uncommented disables any showbusy in the same script.
}

function ShowBusyAtMouse(event, message)
{
  if (!event) // IE kluge
  {  event = window.event; }
  ShowBusy(event.clientX, event.clientY, message + event.clientX + ", " + event.clientY); 
}

function ShowBusy(x, y, message)
{ 
  var BusyDiv = document.getElementById('Busy');
  var BusyText = document.getElementById('BusyText');
  var newX = x + "px";

   var newY = Number(y) + Number(document.documentElement.scrollTop) + "px"; 
//alert(newY);

  BusyText.firstChild.data = message;
  if (typeof(BusyDiv) == 'string')
  { 
    BusyDiv.setAttribute('top', newY); 
    BusyDiv.setAttribute('left', newX); 
    BusyDiv.setAttribute('style', 'visibility: visible'); 
  }
  else
  {  // IE kluge
    document.getElementById('Busy').style.top = newY;
    document.getElementById('Busy').style.left = newX;
    document.getElementById('Busy').style.visibility = 'visible';
  }
}

function EraseBusy()
{
  var x = document.getElementById("Busy");
  if (typeof(x) == 'string')
  { x.setAttribute('style', 'visibility: hidden'); }
  else
  document.getElementById('Busy').style.visibility = 'hidden';  // IE kluge
}

function ClickTest()
{
  var txt = document.getElementById("Text1");

  if (!txt)
  { alert("Could not get txt"); }
  else
  {
    txt.align = "center";
    txt.font.size = "7";
    txt.innerHTML = "Now I'm in the middle!";
  }
}

function ShowBrowser()
{
//  var browser = "Browser Information:<br>";
//  for (propname in navigator)
//  { browser += propname + ": " + navigator[propname] + "<br>"; }
//  alert(browser);

  var Browser = navigator.appName;
  document.write(Browser);
}

