  var currentMain = false;
  var currentSub = false;
  var cur = false;

  function setAct(theId) {
    currentActive = theId;
  }
  
  function swap(theName) {
    obj = document.getElementById(theName);
    if (obj.className == 'show' || obj.className == '') {
        hide(theName);
        show(theName + '_act');
    } else {
        hide(theName + '_act');
        show(theName);
    }
  }

  function show(theName) {
    obj = document.getElementById(theName);
    if (obj) {
      cl = obj.className.replace('hide','show');
      obj.className = cl;
    }
  }

  function hide(theName) {
    obj = document.getElementById(theName);
    if (obj) {
      cl = obj.className.replace('show','hide');
      obj.className = cl;
    }
  }

  
  function mainAct(theId,hasSub) {
    obj = document.getElementById('m_' + currentMain);
    if (obj) obj.style.backgroundPosition='0px 0px';
    if (currentMain != theId) {
      if (theId != currentSub) {
        obj = document.getElementById('m_' + currentSub);
        if (obj) obj.style.backgroundPosition='0px 0px';
      }
      hideAll();
      currentSub = false;
    }
    obj = document.getElementById('m_' + theId);
    obj.style.backgroundPosition='0px 33px';
    if (hasSub) {
        currentSub = theId;
        show('sub_' + theId);
        hide('pagetitle');
    }
    currentMain = theId;
    cur = theId;
  }
  function debug(txt)  {
    obj=document.getElementById('footer');
    obj.innerHTML = txt;
  }
  function mainInAct(theId,hasSub) {
    if (!hasSub) {
      obj = document.getElementById('m_' + cur);
      if (obj) obj.style.backgroundPosition='0px 0px';
      hide('sub_' + theId);
      show('pagetitle');
      }
    currentMain = false;
  }
  
  function subAct(theId) {
    obj = document.getElementById('m_' + theId);
    obj.style.backgroundPosition='0px 14px';
  }

  function subInAct(theId) {
    obj = document.getElementById('m_' + theId);
    obj.style.backgroundPosition='0px 0px';
  }

  function getScreenWidth() {
    isNetscape = (navigator.appName == "Netscape");
    available = (isNetscape) ? window.innerWidth : document.body.clientWidth;
    return available;
  }
  
  function getScreenHeight() {
    isNetscape = (navigator.appName == "Netscape");
    available = (isNetscape) ? window.innerHeight : document.body.clientHeight;
    return available;
  }
  
  function setHeights() {
    mai = document.getElementById('main');
    con = document.getElementById('content');
    foo = document.getElementById('footer');
    rig = document.getElementById('right');
    lef = document.getElementById('left');
    lin = document.getElementById('links');
    w = Math.round(window.getScreenWidth() - 992) / 2;
    h = con.offsetHeight;
    if (lin) {
      l = lin.offsetHeight;
      if (l < 120) {
        if (h > 345) l = h - 226;
        else l = 120;
      }
      lin.style.height = l + 'px';
    }
    else l = 0;
    h = Math.max(h,l + 226);
    if (h < 345) h = 345;
    con.style.height = h + 'px';
    foo.style.top = (h + 170) + 'px';
    lef.style.top = h + 180 + 'px';
    if (w > 0) {
        mai.style.left = w + 'px';
        h = window.innerHeight;
        rig.style.width = w + 'px';
        lef.style.width = w + 'px';
    }
    c = Math.round(con.style.height.replace('px',''));
    if (document.body.clientWidth < document.body.scrollWidth) {
      w = rig.style.width.replace('px','');
      rig.style.width = w - 16 + 'px';
    }
    mai.className = 'a1';

    
  }

