<!-- showHide controls the expanding menus it needs the (group name) // -->
function showHide(id) {
	var e = document.getElementById(id);
	if (e) {
		e.style.display = e.style.display == "none" ? "inline" : "none";
	}	
}

function show(id) {
	var e = document.getElementById(id);
	if (e) {
		e.style.display =  "inline";
	}	
}

function hide(id) {
	var e = document.getElementById(id);
	if (e) {
		e.style.display =  "none";
	}	
}

var sel = new Array();
var grp = new Array();
var ids = new Array();

<!-- linkColors changes the link text to green once the dropdown occurs. It needs (group name, link number). Use 0 for the large link. The first small link is group_1, the second is group_2 and so on // -->

function linkColors(group, id) {
	var gnu = group + '_' + id;
	var child = group + '_1';
	if(undefined == sel[0]) {
		sel.push(gnu);
		grp.push(group);
		ids.push(id);
		if(id == 0) {
			if(document.getElementById(gnu).className  != 'selected') {
				document.getElementById(gnu).className  = 'selected';
			}
			if(undefined != document.getElementById(group)) {
				document.getElementById(child).className  = 'selected';
			}			
		} else {
			document.getElementById(gnu).className  = 'selected';
		}
	} else {
		var old = sel[0];
		var oldgrp = grp[0];
		var parent = oldgrp + '_0';
		if(id == 0) {
			if (undefined != document.getElementById(oldgrp)) { 
				if(oldgrp != group && document.getElementById(oldgrp).style.display == 'inline') {
					hide(grp[0]);
					document.getElementById(parent).className  = '';
					document.getElementById(old).className  = '';
					document.getElementById(gnu).className  = 'selected';
					if (undefined != document.getElementById(child)) {
						document.getElementById(child).className  = 'selected';
					}
				} else if (oldgrp == group && document.getElementById(oldgrp).style.display == 'inline') {
					document.getElementById(child).className  = 'selected';
					document.getElementById(gnu).className  = 'selected';
				} else if (oldgrp == group && document.getElementById(oldgrp).style.display == 'none') {
					document.getElementById(gnu).className = 'selected_right';
					if(old != gnu) {
						document.getElementById(old).className  = '';
					}
				} else {
					document.getElementById(old).className  = '';
					document.getElementById(gnu).className  = 'selected';
				}
			} else if(oldgrp != group) {
				document.getElementById(old).className  = '';
				document.getElementById(gnu).className  = 'selected';
				if (undefined != document.getElementById(child)) {
					document.getElementById(child).className  = 'selected';
				}
			} 
			grp.pop();
			grp.push(group);
			ids.pop();
			ids.push(id);
			sel.pop();
			sel.push(gnu);
		} else {			
			if (ids[0] == 0) {
				document.getElementById(child).className  = '';
			} else {
				document.getElementById(old).className  = '';
			}			
			document.getElementById(gnu).className  = 'selected';
			grp.pop();
			grp.push(group);
			ids.pop();
			ids.push(id);
			sel.pop();
			sel.push(gnu);
		}
	}
}

<!-- request handles populating the main container when a link is selected. It needs (name of the file.php) // -->

function request(task){	
	var hite = getElementHeight('main');
	//native
	if (window.XMLHttpRequest){
		var Req = new XMLHttpRequest();
	}
	// ie 6
	else if (window.ActiveXObject){
		var Req = new ActiveXObject("Microsoft.XMLHTTP");		
	}
			
	Req.open("GET", task,true);
	Req.onreadystatechange = function() 
		{
		if (Req.readyState<=3) {
			var load = document.getElementById('main');
			load.innerHTML = '<div align="center" style="margin-top:20px;height:'+hite+'px">Loading...</div></div>';
		}
		if (Req.readyState==4) {
			var home = document.getElementById('main');
			home.innerHTML = Req.responseText;
		}
	}
	Req.send(null);
}

<!-- swap handles the background image in the top nav. It takes the (id of the <td> that contains that link). You only need to worry about this if the top nav changes // -->

function swapIn(name) {
	var thing = document.getElementById(name);
	if(thing.className != 'active') {
		thing.style.backgroundImage = "url(images/nav_bg_alt.gif)";
	}
}

function swapOut(name) {
	var thing = document.getElementById(name);
	if(thing.className != 'active') {
		thing.style.backgroundImage = "url(images/nav_bg.gif)";
	}
}

function hoverOn(id) {
	var klass = document.getElementById(id);
	if (klass.className != 'selected') {
		klass.className = 'hov';
	}
}

function hoverOff(id) {
	var klass = document.getElementById(id);
	if (klass.className != 'selected') {
		klass.className = '';
	}
}

function getElementHeight(Elem) {
	if(document.getElementById) {
			var elem = document.getElementById(Elem);
		} else if (document.all){
			var elem = document.all[Elem];
		}
		xPos = elem.offsetHeight;
		
		return xPos;
	} 

function checkform() {
	var n = document.getElementById('name').value;
	var c = document.getElementById('country').value;
	var e = document.getElementById('email').value;
	var cmt = document.getElementById('comments').value;
	if (n == '' || c == '' || e == '' || cmt == '') {
		document.getElementById('error').style.display = 'inline';
		return false;
	} else {
		return true;
	}
}

<!-- new window command // -->

function newWindow(glossary) {
	glossaryWindow = window.open
	(glossary,"glossary","innerwidth=450,innerheight=400,toolbar=no,scrollbars=yes,resizable=yes")
	glossaryWindow.focus()
	}

