function menuitemSelectID(element, documentURI) {
  if (element) { 
    for (var i=0; i<element.childNodes.length; i++) {
      if (element.childNodes[i]) {
        if (element.childNodes[i].pathname) 
          if (element.childNodes[i].pathname == documentURI | '/' + element.childNodes[i].pathname == documentURI) {
            element.childNodes[i].className += ' selected';
          }
        menuitemSelectID(element.childNodes[i], documentURI);
      }
    } 
  }
}

function menuitemSelect(documentURI) {
  menuitemSelectID(document.getElementById('sidebar'),documentURI); 
}

function injectPrintable() {
  document.write('<img id="printable" src="/images/printer.gif" alt="Print this page..." onclick="window.print();">');
}

function clearInput(inp,def) {
  if (inp && inp.value && (!def | inp.value == def)) inp.value = '';
}

function showSection(section) {
	var a = document.getElementsByTagName('ul');	
	for (var i = 0; i < a.length; i++)
		if (a[i].className == 'expandinglist')
			for (var j = 0; j < a[i].childNodes.length; j++)
				if (a[i].childNodes[j].nodeName == 'LI')
					for (var k = 0; k < a[i].childNodes[j].childNodes.length; k++)
						if (a[i].childNodes[j].childNodes[k].nodeName == 'UL')
							a[i].childNodes[j].childNodes[k].style.display = 'none';
	var s = document.getElementById(section);
	s.style.display = s.style.display == 'block' ? 'none' : 'block';
}


