var IE5 = (document.getElementById ? true : false);
var IE4 = ((document.all && !IE5) ? true : false);
var NS4 = (document.layers ? true : false);
var timeOut = 0;
hideThis = 0;
visible = true;
openLayer = "";
function setLayer(layerName) {
 if (IE5) {
  var currentLayer = eval("document.getElementById('" + layerName + "').style");
 }
 if (IE4) {
  var currentLayer = eval(document.all[layerName].style);
 }
 if (NS4) {
  var currentLayer = eval(document.layers[layerName]);
 }
 return currentLayer;
}

function showLayer(layerName) {
 if (layerName != openLayer) {
  hide(openLayer);
 }
 visible = true;
 theLayer = setLayer(layerName);
 if(NS4) {
  theLayer.visibility = 'show';
 }
 else {
  theLayer.visibility = 'visible';
 }
 openLayer = layerName;
}

function hideLayer(layerName) {
 visible = false;
 layer = layerName;
 hideThis++;
 timeOut = setTimeout("hideCheck(layer,"+hideThis+")", 300);
}

function hideCheck(layerName,hideThisNow) {
 if (visible == false && hideThis == hideThisNow) {
  hide(layerName);
 }
}

function hide(layerName,hideThisNow) {
 if (visible == false) {
  theLayer = setLayer(layerName);
  if(NS4) { theLayer.visibility = 'hide'; }
  else { theLayer.visibility = 'hidden'; }
 }
 else { visible = true; }
}

