/*	domCollapse() written by Christian Heilmann, with help from Scott Benish and
	Craig Saila of the webdesign-L list homepage: http://www.onlinetools.org/tools/domcollapse.php
*/
function domCollapse(which){
	if (document.getElementById && document.createTextNode){
		if (which=="dispall") {domCollapseAll(1);}
		else if (which=="hideall") {domCollapseAll(0);}
		else {
			m=document.getElementById("menu");
			trig=m.getElementsByTagName("div").item(which).style.display;
			t=m.getElementsByTagName("p").item(which);
			h=t.getElementsByTagName("a").item(0).firstChild;
			if (trig=="block") trig="none";
			else if (trig=="" || trig=="none") trig="block";
			if (trig=="none"){
				h.nodeValue=h.nodeValue.replace(highlighttext,normaltext);
				t.style.background=normalbackground;
				t.style.color=normalcolour;
				}
			else {
				h.nodeValue=h.nodeValue.replace(normaltext,highlighttext);
				t.style.background=highlightbackground;
				t.style.color=highlightcolour;
				}
			m.getElementsByTagName("div").item(which).style.display=trig;
		}
	}
} 

// function domCollapseAll(show). Written by Christian Heilmann
function domCollapseAll(show){
	if (document.getElementById && document.createTextNode){
		m=document.getElementById("menu");
		for (i=0;i<m.getElementsByTagName("div").length;i++){
			t=m.getElementsByTagName("p").item(i);
			h=t.getElementsByTagName("a").item(0).firstChild;
			if (show==1){
				h.nodeValue=h.nodeValue.replace(normaltext,highlighttext);
				t.style.background=highlightbackground;
				t.style.color=highlightcolour;
				m.getElementsByTagName("div").item(i).style.display="block";
			}
			else {
				h.nodeValue=h.nodeValue.replace(highlighttext,normaltext);
				t.style.background=normalbackground;
				t.style.color=normalcolour;
				m.getElementsByTagName("div").item(i).style.display="none";
			}
		}
	}
}
if (document.getElementById && document.createTextNode){
	document.write('<style type="text/css">#menu div{display:none;}</style>')
	}
