function toggleBullet(evt) {
	// Test for compliant browser else use IE function to find event target
	if (document.body.addEventListener) var targetElement = evt.target;
	else var targetElement = window.event.srcElement;
	// Identify list element we want to toggle
	var listitem = findOwner(targetElement);
	if (hasClassName(listitem,'currentPage')) {
		removeClassName(listitem,'currentPage');
	} else {
		addClassName(listitem,'currentPage');
	}
}
function findOwner(evt) {
	// Searches up through the DOM to find the li parent of the supplied element
	var node = evt;
	while (node) {
		if (node.nodeName === "LI") return node;
		node = node.parentNode;
	}
	return null;
}
function projectLoader() {
	var query = document.location.search.indexOf("project=");
	if (query != -1) {
		var projectIndex = query + 8;
		var projectToShow = document.location.search.substring(projectIndex, projectIndex + document.location.toString().length);
		projectDisplay(projectToShow);
	}
}
function projectDisplay(location) {
	var mainContent = document.getElementById("mainContent");
	var targetContent = document.getElementById(location);
	if (targetContent) {
		mainContent.innerHTML = "<a href=\"/projects/projectlist.htm?project=" + location + "\" class=\"permalink\">permalink</a>";
		mainContent.innerHTML += targetContent.innerHTML;
	} else {
		mainContent.innerHTML = "<p>Sorry, there are no projects in this area. Please select an area from the list at right.</p>";
	}
}
function toggleElement(el) {
	var element = document.getElementById(el);
	if (element.style.display === "none") element.style.display = "block";
	else element.style.display = "none";
}
function getProjectId() {
	var query = document.location.search.indexOf("project=");
	if (query != -1) {
		var projectIndex = query + 8;
		var projectToShow = document.location.search.substring(projectIndex, projectIndex + document.location.toString().length);
		var target = document.getElementById("projectLocator");
		target.innerHTML = "The project that you clicked has a Project ID of <strong>" + projectToShow + "</strong>.";
	}
}
