
function domCollapse(which){
	if (document.getElementById && document.createTextNode){
		if (which=="dispall") {domCollapseAll(1);}
		else if (which=="hideall") {domCollapseAll(0);}
		else {
			m=document.getElementById("submenu");
			trig=m.getElementsByTagName("div").item(which).style.display;
			t=m.getElementsByTagName("h2").item(which);
			h=t.getElementsByTagName("a").item(0).firstChild;
			if (trig=="block") trig="none";
			else if (trig=="" || trig=="none") trig="block";
			if (trig=="none"){
				t.style.background=normalbackground;
				t.style.color=normalcolour;
				}
			else {
				t.style.background=highlightbackground;
				t.style.color=highlightcolour;
				}
			m.getElementsByTagName("div").item(which).style.display=trig;
		}
	}
} 


function domCollapseAll(show){
	if (document.getElementById && document.createTextNode){
		m=document.getElementById("submenu");
		for (i=0;i<m.getElementsByTagName("div").length;i++){
			t=m.getElementsByTagName("h2").item(i);
			h=t.getElementsByTagName("a").item(0).firstChild;
			if (show==1){
				t.style.background=highlightbackground;
				t.style.color=highlightcolour;
				m.getElementsByTagName("div").item(i).style.display="block";
			}
			else {
				t.style.background=normalbackground;
				t.style.color=normalcolour;
				m.getElementsByTagName("div").item(i).style.display="none";
			}
		}
	}
}

// Adding backwards compatibility
if (document.getElementById && document.createTextNode){
	document.write('<style type="text/css">#submenu div{display:none;}</style>')
	}

