function isIE(){
	if(document.all)
		return true;
}

isWs = function(node)
{
  // Use ECMA-262 Edition 3 String and RegExp features
  return !(/[^\t\n\r ]/.test(node.data));
}

isIgnorable = function(node)
{
  return ( node.nodeType == 8) || // A comment node
         ( (node.nodeType == 3) && isWs(node) ); // a text node, all ws
}

previousNode = function(node)
{
	var sib = node;
  while ((sib = sib.previousSibling)) {
    if (!isIgnorable(node)) return sib;
  }
  return null;
}

nextNode = function(node)
{
	var sib = node;
  while ((sib = sib.nextSibling)) {
    if (!isIgnorable(sib)) return sib;
  }
  return null;
}

lastChildNode = function(node)
{
  var res = node.lastChild;
  while (res) {
    if (!isIgnorable(sib)) return res;
    res = res.previousSibling;
  }
  return null;
}

firstChildNode = function(node)
{
  var res = node.firstChild;
  while (res) {
    if (!isIgnorable(res)) return res;
    res = res.nextSibling;
  }
  return null;
}

function setup(){
	setupMenu('aux_menu');
	setupMenu('main_nav');
}

function setupMenu(menu){
	ul = document.getElementById(menu);
	var li = firstChildNode(ul);
	var liChild;
	do {
		liChild = firstChildNode(li);
		do {
			if(liChild.hasAttribute('href') && liChild.href.indexOf(location.pathname) != -1){
				liChild.removeAttribute('href');
				liChild.className = 'active';
				return;
			}
		} while(liChild = nextNode(liChild));
	} while(li = nextNode(li));
}
