  var currentMain = false;
  var currentSub = 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(currentMain);
    if (obj) obj.style.backgroundPosition='0px 0px';
    if (currentMain != theId) {
      if (theId != currentSub) {
        obj = document.getElementById(currentSub);
        if (obj) obj.style.backgroundPosition='0px 0px';
      }
      hideAll();
      currentSub = false;
    }
    obj = document.getElementById(theId);
    obj.style.backgroundPosition='0px 33px';
    if (hasSub) {
        currentSub = theId;
        show('sub_' + theId);
        hide('pagetitle');
    }
    currentMain = theId;
  }

  function mainInAct(theId,hasSub) {
    if (!hasSub) {
      obj = document.getElementById(currentMain);
      if (obj) obj.style.backgroundPosition='0px 0px';
    }
    currentMain = false;
  }
  
  function subAct(theId) {
    obj = document.getElementById(theId);
    obj.style.backgroundPosition='0px 14px';
  }

  function subInAct(theId) {
    obj = document.getElementById(theId);
    obj.style.backgroundPosition='0px 0px';
  }
  function getScreenWidth() {
    isNetscape = (navigator.appName == "Netscape");
    available = (isNetscape) ? window.innerWidth : document.body.clientWidth;
    return available;
  }
  
  function setHeights() {
    mai = document.getElementById('main');
    con = document.getElementById('content');
    sit = document.getElementById('sitemap');
    h = con.offsetHeight;
    //alert(h);
    if (h > 570) {
      mai.style.height = h + 100 + 'px';
      //sitemap.style.top = h + 29 + 'px';
    }
    w = getScreenWidth();
    mai.style.left = Math.round((w - 1010) / 2) + 'px';
    mai.className = 'a1';
  }

