function showsubmenu() {
	li = document.getElementById('menu').getElementsByTagName('li');
	for (i in li) {
      if (li[i].id == 'menu_current' || li[i].id == 'menu_current_sub' || li[i].className == 'current_sub') {
          li[i].className = 'menu_current';
        	ul = li[i].childNodes;
        	for (j in ul) {
        		if (ul[j].nodeType == 1) {
        			ul[j].style.display = 'block';
        		}
        	}
      } 
      if (li[i].className == 'menu_current_menuhover') {
        	ul = li[i].childNodes;
        	for (j in ul) {
        		if (ul[j].nodeType == 1) {
        			ul[j].style.display = 'block';
        		}
        	}
      } 
	}
}

function showSub(showNode) {
	ul = showNode.childNodes;
	for (i in ul) {
		if (ul[i].nodeType == 1) {
			ul[i].style.display = 'block';
		}
	}
	
	li = document.getElementById('menu').getElementsByTagName('li');
	for (i in li) {
      if (li[i].id == 'menu_current' || li[i].id == 'menu_current_sub') 
          li[i].className = 'menu_current_menuhover';
      if (li[i] != showNode) {
        	ul = li[i].childNodes;
        	for (j in ul) {
        		if (ul[j].nodeType == 1 && ul[j].nodeName == 'UL') {
        			ul[j].style.display = 'none';
        		}
        	}
      }
	}
  showNode.className = 'current_sub';

}

function hideSub(hideNode) {
  hideNode.className = hideNode.id;
	ul = hideNode.childNodes;
	for (i in ul) {
		if (ul[i].nodeType == 1 && ul[i].nodeName == 'UL') {
			ul[i].style.display = 'none';
		}
	}
}

window.onload=function()
{

	li = document.getElementById('menu').getElementsByTagName('li');
	for (i in li) {

    ahref = li[i].childNodes;
    for(j in ahref) {
        if(ahref[j].nodeName == 'A') {
            li[i].id = ahref[j].className; 
        }
    }              

    if (li[i].id == 'menu_current') {
        li[i].className = 'menu_current';
      	ul = li[i].childNodes;
      	for (j in ul) {
      		if (ul[j].nodeType == 1) {
      			ul[j].style.display = 'block';
      		}
      	}
    } 


		li[i].onmouseover = function () {
			showSub(this);
		}
		li[i].onmouseout = function () {
			hideSub(this);
		}
	}
  
  showsubmenu();
    
}