// JavaScript Document
isMinNS4 = (navigator.appName.indexOf("Netscape") >= 0 && parseFloat(navigator.appVersion) >= 4) ? 1 : 0;
isMinNS5 = (navigator.appName.indexOf("Netscape") >= 0 && parseFloat(navigator.appVersion) >= 5) ? 1 : 0;
isMinIE4 = (document.all) ? 1 : 0;
isMinIE5 = (isMinIE4 && navigator.appVersion.indexOf("5.")) >= 0 ? 1 : 0;

function moveLayerTo(layer, x, y) {
  if (isMinNS4)
    layer.moveTo(x, y);
  if (isMinIE4) {
    layer.style.left = x;
    layer.style.top  = y;
  }
}
function getWindowWidth() {
  if (isMinNS4)
    return(window.innerWidth);
  if (isMinIE4)
    return(document.body.clientWidth);
  return(-1);
}

function showLayer(layer) {
  if (isMinNS4) layer.visibility = "show";
  if (isMinIE4) layer.style.visibility = "visible";
}
function hideLayer(layer) {
  if (isMinNS4) layer.visibility = "hide";
  if (isMinIE4) layer.style.visibility = "hidden";
}
function getLayer(name) {
  if (isMinNS4) return findLayer(name, document);
  if (isMinIE4) return eval('document.all.' + name);
  return null;
}
function findLayer(name, doc) {
  var i, layer;
  for (i = 0; i < doc.layers.length; i++) {
    layer = doc.layers[i];
    if (layer.name == name) return layer;
    if (layer.document.layers.length > 0) {
      layer = findLayer(name, layer.document);
      if (layer != null) return layer;
    }
  }
  return null;
}

function DoShowWorkingLayer() {
	if ( isMinIE4 || (isMinNS4 && !isMinNS5) ) {
		if (!CancelShow) {
			showLayer(getLayer("workinglayer"));
		}
	}
}
function DoHideWorkingLayer() {
	CancelShow = true;
	clearTimeout(ShowTimer);
	if ( isMinIE4 || (isMinNS4 && !isMinNS5) ) {
		hideLayer(getLayer("workinglayer"));
	}
}

function centerLayer() {
	if ( isMinIE4 || (isMinNS4 && !isMinNS5) ) {
		if (getWindowWidth() > 0) {
			moveLayerTo(getLayer("workinglayer"), (getWindowWidth()-280)/2, 345);
		}
	}
}

CancelShow = false;
centerLayer();
// Show the "Loading..." layer if this page is taking longer than 2 seconds to load.
ShowTimer = setTimeout("DoShowWorkingLayer();", 4000);
