/*############################################################
########### RWR DHTML MENU v1.0 by Andres Gonzalez ###########
##############################################################
*- you are free to use this code as you wish, as long as you
   keep these comments on the top of the code.
############################################################*/

var timeout = 400; // time in ms for menu before menu hides
var clear; // holds timeout funtion for menu to be cleared

var menuSubs = new Array(7); // total menu items -1 (0 is first)
menuSubs[2] = 'mn2Sub';
menuSubs[4] = 'mn4Sub';
menuSubs[5] = 'mn5Sub';


function mnuTgl(tgl,menu) {
	if (tgl == 1) {
		clearTimeout(clear);
		mnuHideOth(menu);
		mnuShow(menu);
	}else{ clear = setTimeout("mnuHide('"+menu+"')",timeout);}
}

function mnuShow(m){ document.getElementById(m).style.display = "block"; }
function mnuHide(m){ document.getElementById(m).style.display = "none"; }

function mnuHideOth(m){
	for(x=0; x <= menuSubs.length; x++){ //loop through array
		if(m.indexOf(x) == -1 && menuSubs[x] != null){ // if its not the current menu item && submenu exists
			mnuHide(menuSubs[x]);
		}
	}
}
