var NS4 = (document.layers) ? 1 : 0;	// check for Netscape 4
var IE4 = (document.all) ? 1 : 0;	// check for IE 4
var NS6 = ((document.getElementById) && (!document.all)) ? 1 : 0; // check for Netscape 6 (or Mozilla)

function writeSubBox(title, id, state) {
	document.writeln('<div class="sidesubheader" onclick="changebox(\'' + id + '\');">');
	document.writeln('	<div class="sideexpand" id="' + id + 'a"></div>');
	document.writeln('	<div class="sideexpand2" id="' + id + 'b"></div>');
	document.writeln(title);
	document.writeln('</div>');
	document.writeln('<div class="sidesubmenu" id="' + id + '">');

	if (state == false) {
		changebox(id);
	}
}
function endSubBox() {
	document.writeln('</div>');
}
function writeLink(link, name) {
	document.writeln('<div class="sidelink">');
	document.writeln('<a href="' + link + '">' + name + '</a>');
	document.writeln('</div>');
}

function changebox(active) {
	activea = active + "a";
	activeb = active + "b";
	if (NS4) {
		var box = document[active];
		var boxa = document[activea];
		var boxb = document[activeb];
	} else if (IE4) {
		var box = document.all[active].style;
		var boxa = document.all[activea].style;
		var boxb = document.all[activeb].style;
	} else {
		var box = document.getElementById(active).style;
		var boxa = document.getElementById(activea).style;
		var boxb = document.getElementById(activeb).style;
	}
	if (box.display == "block" || box.display == "") {
		box.visibility = (NS4) ? "hide" : "hidden";
		box.display = "none";

		boxa.visibility = (NS4) ? "hide" : "hidden";
		boxa.display = "none";

		boxb.visibility = (NS4) ? "show" : "visible";
		boxb.display = "block";
	} else {
		box.visibility = (NS4) ? "show" : "visible";
		box.display = "block";

		boxa.visibility = (NS4) ? "show" : "visible";
		boxa.display = "block";

		boxb.visibility = (NS4) ? "hide" : "hidden";
		boxb.display = "none";
	}
}

function newWindow(file, window) {
	msgWindow = open(file, window);
	if (msgWindow.opener == null) msgWindow.opener = self;
}
