// NONE of this code is truly my own; it's all pieced together from other
//   people's code and I have no idea whose so I won't even try to give
//   credit.  If you find it a useful cross-browser object manipulation
//   script, take it.
// Note that getElement will require that the object be named with "id='...'"
//   for some browsers, even if it already has a "name='...'" element.  This
//   is most noticable when getting image objects, as IE works fine with just
//   a name tag on images, but Mozilla, for instance, pukes unless it has the
//   id tag as well...

var WindowSizeX, WindowSizeY, ScreenX, ScreenY;
var w3c, ns4, ie4, ie5, ns6, got;

function GetInfo()
{
  if (got) return;

  got = true;

  w3c=(document.getElementById)?true:false;
  ns4=(document.layers)?true:false;
  ie4=(document.all && !this.w3c)?true:false;
  ie5=(document.all && this.w3c)?true:false;
  ns6=(this.w3c && navigator.appName.indexOf("Netscape")>=0 )?true:false;

  WindowSizeX = (ie5 || ie4) ? document.body.clientHeight : window.innerHeight;
  WindowSizeY = (ie5 || ie4) ? document.body.clientWidth : window.innerWidth;
  ScreenX = screen.Width;
  ScreenY = screen.Height;
}

function getElement(id)
{
  GetInfo();
  if (w3c) return document.getElementById(id);
  if (ns4) return document.layers[id];
  if (ie4) return document.all(id);
}

function ShowItem(Item)
{
  var ItemObject = getElement(Item);
  if (ns4) ItemObject.visibility="show";
  else
  {
    ItemObject.style.visibility="visible";
    ItemObject.style.display="block";
  }
}

function HideItem(Item)
{
  ItemObject = getElement(Item);
  if (ns4) ItemObject.visibility="hide";
  else
  {
    ItemObject.style.display="none";
    ItemObject.style.visibility="hidden";
  }
}

function popUp(URL, w, h, l, t, id)
{
  if (w == 0) w = 400;
  if (h == 0) h = 300;
  if (t == 0) t = 20;
  if (l == 0) l = 50;
  day = new Date();
  if (id == '') id = day.getTime();
  x = "page" + id + " = window.open(URL, '" + id + "', 'toolbar=no,scrollbars=no," +
      "location=no,statusbar=no,menubar=no,resizable=no,width=" + w + ",height=" + h + "," +
      "left = " + l + ",top = " + t + "');";
  eval(x);
}

function popUpScroll(URL, w, h, l, t, id)
{
  if (w == 0) w = 400;
  if (h == 0) h = 300;
  if (t == 0) t = 20;
  if (l == 0) l = 50;
  day = new Date();
  if (id == '') id = day.getTime();
  x = "page" + id + " = window.open(URL, '" + id + "', 'toolbar=no,scrollbars=yes," +
      "location=no,statusbar=no,menubar=no,resizable=no,width=" + w + ",height=" + h + "," +
      "left = " + l + ",top = " + t + "');";
  eval(x);
}

function ChangeOpenerURL(URL)
{
  window.opener.document.location=URL;
}

function ChangeImage(ImageId, NewImageFile)
{
  var ImageObj = getElement(ImageId);
  ImageObj.src = NewImageFile;
}