isDOM=document.getElementById //DOM1 browser (MSIE 5+, Netscape 6, Opera 5+)
isMSIE=document.all && document.all.item //MSIE 4+
isNetscape4=document.layers //Netscape 4.*
isOpera=window.opera //Opera
isOpera5=isOpera && isDOM //Opera 5+
isMSIE5=isDOM && isMSIE && !isOpera //MSIE 5+
isMozilla=isNetscape6=isDOM && !isMSIE && !isOpera


var idGlb = new Array();
var flagSub;

function openW(urlW, nameW, W, H)
{
  W = (!W) ? 200 : W + 100;
  H = (!H) ? 200 : H + 150;
  
  window.open(urlW, nameW, 'toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,copyhistory=no,scrollbars=yes,width='+W+',height='+H);
}


function getLayer(layerName)
{
  if (!layerName)
  {
    return false;
  }
  
  if (isDOM)
  {
    return document.getElementById(layerName);
  }
  if (isMSIE)
  {
    return document.all[layerName];
  }
  if (isNetscape4)
  {
    return eval('document.layers[layerName]');
  }
  
  return false;
}


function setStyle(idSct)
{
  var sLayer;
  var tLayer;
  var subLayer;
  
  sLayer = getLayer(idSct);

  if (sLayer)
  {
    if (idGlb[idSct])
    {
      tLayer = getLayer(idGlb[idSct]);
      tLayer.style.display = 'none';
      delete(idGlb[idSct]);
    }
    else
    {
      idGlb[idSct] = idSct;
      sLayer.style.display = isMSIE5 ? 'block' : 'table-row';
    }
  }

  return false;
}

function fastOn(what)
{
  mousex = event.clientX;
  mousey = event.clientY;
  pagexoff = 0;
  pageyoff = 0;
  
  if (isMSIE5)
  {
    pagexoff = document.body.scrollLeft;
    pageyoff = document.body.scrollTop;
  }
  else
  {
    pagexoff = window.pageXOffset;
    pageyoff = window.pageYOffset;
  }
  
  sLayer = getLayer(what);
  if (sLayer)
  {
    if (isNetscape4)
    {
      sObj = sLayer;
    }
    else
    {
      sObj = sLayer.style;
    }

    c_width = sLayer.offsetWidth;
    oCanvas = document.getElementsByTagName(
    (document.compatMode && document.compatMode == "CSS1Compat") ? "HTML" : "BODY"
    )[0];

    if (oCanvas.clientWidth)
    {
      w_width = oCanvas.clientWidth + oCanvas.scrollLeft;
    }
    else
    {
      w_width = window.innerWidth + window.pageXOffset;
    }

    if (sObj)
    {
      leftoff = mousex - pagexoff;
      sObj.left = (mousex+pagexoff);
      
      if (mousex + pagexoff + c_width > w_width)
      {
        sObj.left = w_width - c_width + "px";
      }
    
      topoff = mousey-pageyoff;
  
      if (isOpera && topoff <= 30)
      {
        sObj.top = mousey + 20;
      }
      else
      {
        if ( mousey <= 30)
        {
          sObj.top = (mousey+pageyoff) + 20;
        }
        else
        {
          if (isOpera)
          {
            sObj.top = mousey + 20;
          }
          else
          {
            sObj.top = (mousey+pageyoff) + 20;
          }
        }
      }
  
      sObj.visibility = (isNetscape4 || isMozilla) ? 'show' : 'visible';
    }
  }

  return true;
}


function fastOff()
{
  if (sObj)
  {
    sObj.visibility = (isNetscape4 || isMozilla) ? 'hide' : 'hidden';
  }

  return true;
}