/*
 * date:    2002-12-13
 * info:    http://inspire.server101.com/js/xc/
 */

var xcNode = [];

function xcSet(m, c) {
  if (document.getElementById && document.createElement) {
    m = document.getElementById(m).getElementsByTagName('ul');
    var d, p, x, h, i, j;
    for (i = 0; i < m.length; i++) {
      if (d = m[i].getAttribute('id')) {
        x = xcCtrl(d, c, 'x', 'x', 'Show', m[i].getAttribute('title')+' (expand menu)');
        x = xcCtrl(d, c, 'c', 'c', 'Hide', m[i].getAttribute('title')+' (collapse menu)');

        p = m[i].parentNode;
        if (h = !p.className) {
          j = 2;
          while ((h = !(d == arguments[j])) && (j++ < arguments.length));
          if (h) {
            m[i].style.display = 'none';
            x = xcNode[d+'x'];
          }
        }

        p.className = c;
        p.insertBefore(x, p.firstChild);
      }
    }
  }
}



function xcShow(m) {
  xcXC(m, 'block', m+'c', m+'x');
}


function xcHide(m) {
  xcXC(m, 'none', m+'x', m+'c');
}


function xcSpecial(m) {
  e = document.getElementById(m);
  if (e.style.display == 'none')
    xcShow(m);
  else
    xcHide(m);
}


function xcXC(e, d, s, h) {
  e = document.getElementById(e);
  e.style.display = d;
  e.parentNode.replaceChild(xcNode[s], xcNode[h]);
  xcNode[s].firstChild.focus();
}

function xcCtrl(m, c, s, v, f, t) {
  var i = document.createElement('img');
  if (v == 'x') {
    i.setAttribute('src', strCodeBase+'images/common/nav/nav10i02.gif');
    i.setAttribute('border', 0);
    i.setAttribute('width', 20);
    i.setAttribute('alt', ' ');
  }
  else {
    i.setAttribute('src', strCodeBase+'images/common/nav/nav10i02.gif');
    i.setAttribute('border', 0);
    i.setAttribute('width', 20);
    i.setAttribute('alt', ' ');
  }

  var a = document.createElement('a');
  a.setAttribute('href', 'javascript:xc'+f+'(\''+m+'\');');
  a.setAttribute('title', t);
  //a.appendChild(document.createTextNode(v));
  a.appendChild(i);

  var d = document.createElement('div');
  d.className = c+s;
  d.appendChild(a);

  return xcNode[m+s] = d;
}


function enableNavigation(e1, e2) {
  if (document.getElementById && document.createElement) {
    e1 = document.getElementById(e1);
    e2 = document.getElementById(e2);
    e1.style.display = 'none';
    e2.style.display = 'block';
    xcShow('mnuCat37');
  }
}
