/* For drop down menu */
function startList() {
	if (document.all && document.getElementById) {
		navRoot = document.getElementById("primaryMenu");
		for (i=0; i< navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName == "LI") {
				node.onmouseover = function() {
					this.className += " over";
				}

				node.onmouseout = function() {
					this.className = this.className.replace(" over", "");
				}
			}
		}
	}
}

// Toggles the class name of the indexed div between 'hideMe' and 'showMe'
// and toggles the src attribute of the referenced img tag between openPicture and closePicture
function toggleBox(index, me, customPlus, customMinus) {
  var openPicture = customPlus == null ? "plus.gif" : customPlus;
  var closePicture = customMinus == null ? "minus.gif" : customMinus;

	var path = "/files/images/";
	
	var splitup = me.src.split("/");
	var name = splitup[splitup.length-1];
	var d = document.getElementById(index);
	if (me != undefined) {
		if (name == closePicture){
			me.src = path + openPicture;
		} else {
			me.src = path + closePicture;
		}
		hideShow(d);
	}
}

// Changes the class of the given tag from classa to classb or back
function hideShow(tag) {
	if (tag.style.display == 'none'){
		tag.style.display = 'block';
	} else {
		tag.style.display = 'none';
	}
}
