// DropDownMenus
var dropDownStatus = 0;
function showDropDown(el) {
	var dropDownId;
	if(-1<el.id.indexOf("m_"))el.id = el.id.substring(2,el.id.length);
	if (0<el.id.indexOf("_")) {
	    dropDownId = el.id.substring(0,parseInt(el.id.indexOf("_")));
	} else {
	    dropDownId = el.id;
	}
	dropDownStatus = dropDownId;
	// show active dropDown
	if (document.getElementById("sub_" + dropDownId)) {
		var dropDown = document.getElementById("sub_" + dropDownId);
		
        //Kijk of het een hoofd of subitem is en bepaal juiste actie
		var arrElId;
		arrElId = el.id.split("_");
		if(2<arrElId.length) {
		    dropDown.style.display = "block";
		} else {
		    if (document.getElementById("sub_" + dropDownId).style.display != 'block') {
		        showBox(dropDownId);
		    }
		}
		
	}
	// hide all others
	var uls = document.getElementsByTagName("ul");
	for (var i=0; i<uls.length; i++) {
		//alert(uls[i].id + " = sub_" + dropDownId);
		if (-1<uls[i].id.indexOf("sub") && uls[i].id != "sub_" + dropDownId) {
			uls[i].style.display = "none";
			//hideBox(uls[i]);
		}
	}
}
function hideDropDown(el) {
	var dropDownId;
	if(-1<el.id.indexOf("m_"))el.id = el.id.substring(2,el.id.length);
	if (0<el.id.indexOf("_")) {
	    dropDownId = el.id.substring(0,parseInt(el.id.indexOf("_")));
	} else {
	    dropDownId = el.id;
	}
	dropDownStatus = 0;
	if (document.getElementById("sub_" + dropDownId)) {
		var dropDown = document.getElementById("sub_" + dropDownId);
		if (dropDownStatus == 0) {
			setTimeout(function() {
				if (dropDownStatus == 0) {
					setTimeout(function() { if (dropDownStatus == 0) dropDown.style.display = "none"; }, 350);
					//setTimeout(function() { if (dropDownStatus == 0) hideBox(dropDownId); }, 200);
				}
			}, 350);
		}
	}
}
