var subactive = false;
var subtimeout = false;

subdect = function(what) {
	//if ( subactive ) {
	//	subtimeout = setTimeout("subactive.style.visibility='hidden'", 50);
	//}
	//subtimeout = setTimeout("document.getElementById('"+what+"').style.visibility='hidden'", 50);
	subtimeout = setTimeout("document.getElementById('"+what+"').style.visibility='hidden';", 100);
}

subact = function(what) {
	if (subactive != false && subactive != what) document.getElementById(subactive).style.visibility='hidden'; else clearTimeout(subtimeout);
	document.getElementById(what).style.visibility='visible';
	subactive = what;
}

activateMenu = function(nav) {
    /* currentStyle restricts the Javascript to IE only */
	if (document.all && document.getElementById(nav).currentStyle) {
		var navroot = document.getElementById(nav);
        /* Get all the list items within the menu */
        var lis=navroot.getElementsByTagName("LI");  
		for (i=0; i<lis.length; i++) {
            /* If the LI has another menu level */
            if(lis[i].lastChild.tagName=="UL" && lis[i].parentNode.id != nav){
                /* assign the function to the LI */
					lis[i].onmouseover=function() {		
		                   /* display the inner menu */
		                   this.style.color = "#FF9000";
		                   //document.getElementById('ulmenu1').style.overflow='visible';
		                   //this.lastChild.style.display="block";
		                   //this.lastChild.style.overflow="visible";
		                   //subdect();
		                   if ( document.getElementById(this.title) ) {
		                   	     /* var submenu = document.getElementById(this.title);
		                   	     if ( subactive && subactive != submenu.id ) clearTimeout(subtimeout);
		                   		submenu.style.visibility='visible';
		                   		subactive = submenu.id;*/
		                   		subact(this.title);
		               	}
		                   
		      		}
					lis[i].onmouseout=function () {
						this.style.color = '#346C30';
						//document.getElementById('ulmenu1').style.overflow='hidden';
						//this.lastChild.style.display='none';
						if ( document.getElementById(this.title) ) {
		                   	     //var submenu = document.getElementById(this.title);
		                   		//subtimeout = setTimeout("document.getElementById('"+this.title+"').style.visibility='hidden'", 50);
		                   		subdect(this.title);
		               	}
						
					}
            } else {
            	lis[i].onmouseover=function() {		
                   for ( j =0; j < this.childNodes.length; j++ ) {
                   		if ( this.childNodes[j].nodeName=="A" && this.childNodes[j].parentNode.className != 'folder1' ) {
                   			this.childNodes[j].style.color="#FF9000";
                   		}
               	}
      		}
			lis[i].onmouseout=function() {                    
				//subdect();   
                    for ( j =0; j < this.childNodes.length; j++ ) {
                   		if ( this.childNodes[j].nodeName=="A" && this.childNodes[j].parentNode.className != 'folder1') {
                   			this.childNodes[j].style.color="#346C30";
                   		}
               	}
			}
            }
		}
	}
}


function inlineMenu(nav) {
	if (document.all && document.getElementById(nav).currentStyle) {
		var navroot = document.getElementById(nav);
	     /* Get all the list items within the menu */
	     var lis=navroot.getElementsByTagName("LI");  
		for (i=0; i<lis.length; i++) {
	            /* If the LI has no other menu level */
	          if(lis[i].parentNode.id==nav){
	          	lis[i].className='folder1';
	          	lis[i].style.color = '#FFFFFF';
				lis[i].style.fontSize = '14px';
				lis[i].style.fontWeight = 'bold';
				//lis[i].style.width = '230px';
				if ( as = lis[i].getElementsByTagName('A') ) {
					if ( as[0] && as[0].parentNode.className == 'folder1' ) {
						as[0].className='maina';
						as[0].style.color = '#FFFFFF';
						as[0].style.fontSize = '14px';
						as[0].style.fontWeight = 'bold';
					}
				}
	          }
	     }
	}
}

/* I do this differently on the test page to fix a problem float container problem in IE5 Mac*/
/*Uncomment the function below*/
window.onload= function(){
   
    if ( document.getElementById('ulmenu1') && navigator.appName != 'Netscape' ) {
    		inlineMenu('ulmenu1');
    		activateMenu('ulmenu1');
    }
}

