function get(o) {return(document.getElementById(o));}

var html = "";
var locationArray = window.location.toString().split("/");
var thisHTMLPage = locationArray[locationArray.length - 1];

for(i=0;i<menuHeaders.length;i++){
	if (menuDisplayAt[i] == "all" || menuShouldDisplay(thisHTMLPage, i)) {
		html += '<div>';
		html += '<span>' + menuHeaders[i] + '</span>';
		theseLinks = menuLinks[i].split("//");
		theseItems = menuItems[i].split("//");
		for(l=0;l<theseLinks.length;l++) {
			html += "<a href='" + theseLinks[l] + "'>" + theseItems[l] + "</a>";
		}
		html += '</div>';
	}
}

get("my_menu").innerHTML = html;

function menuShouldDisplay(where, index) {
	var menuDisplayList = menuDisplayAt[index].split("//");
	var success;

	for (d=0; d<menuDisplayList.length; d++) {
		if (menuDisplayList[d] == where) {
			success = true;
			break;
		}
	}
	return(success);
}