var isNS4  = false;
var isIE45 = false;
var isW3C  = false;

if (document.layers) {  // for Netscape 4 proprietary DOM
	isNS4 = true;
	docObj = "document";
	styleObj = "";
	topObj = ".top";
}
else if (document.all) { // for MSIE proprietary DOM
	isIE45 = true;
	docObj = "document.all";
	styleObj = ".style";
	topObj = ".pixelTop";
}
else if (document.getElementById) { // for W3C standards-compliant browsers
	isW3C = true;
	docObj = "document.getElementById";
	styleObj = ".style";
	topObj = ".top";
}

// ---------------------------------------------------------------------------------------------

function setBullet(whichDiv,whichBullet) {

if (isNS4) document.layers[whichDiv].document.images[whichBullet].src='images/bullet.gif';
else document.images[whichBullet].src='images/bullet.gif';

}

// ---------------------------------------------------------------------------------------------

// The following function controls the menu functionality
// for opening and closing the entire menu, as well 
// as the repositioning of the sections within

function controlAll(doWhat) {

if (isNS4 || isIE45) {
	var c1 = eval(docObj + '.closed1' + styleObj);
	var o1 = eval(docObj + '.open1' + styleObj);
	var c2 = eval(docObj + '.closed2' + styleObj);
	var o2 = eval(docObj + '.open2' + styleObj);
	var c3 = eval(docObj + '.closed3' + styleObj);
	var o3 = eval(docObj + '.open3' + styleObj);
	var c4 = eval(docObj + '.closed4' + styleObj);
	var o4 = eval(docObj + '.open4' + styleObj);
	var c5 = eval(docObj + '.closed5' + styleObj);
	var o5 = eval(docObj + '.open5' + styleObj);
	var c6 = eval(docObj + '.closed6' + styleObj);
	var o6 = eval(docObj + '.open6' + styleObj);
	var bB = eval(docObj + '.bottomBdr' + styleObj);
	}
	
else { // for W3C standards-compliant browsers
	var c1 = eval(docObj + '("closed1")' + styleObj);
	var o1 = eval(docObj + '("open1")' + styleObj);
	var c2 = eval(docObj + '("closed2")' + styleObj);
	var o2 = eval(docObj + '("open2")' + styleObj);
	var c3 = eval(docObj + '("closed3")' + styleObj);
	var o3 = eval(docObj + '("open3")' + styleObj);
	var c4 = eval(docObj + '("closed4")' + styleObj);
	var o4 = eval(docObj + '("open4")' + styleObj);
	var c5 = eval(docObj + '("closed5")' + styleObj);
	var o5 = eval(docObj + '("open5")' + styleObj);
	var c6 = eval(docObj + '("closed6")' + styleObj);
	var o6 = eval(docObj + '("open6")' + styleObj);
	var bB = eval(docObj + '("bottomBdr")' + styleObj);
	}

	if (doWhat == "expand") {
	
	for (i=1;i<=6;i++) { // alter upper limit for more or less sections
		cl = eval("c" + i);
		cl.visibility = "hidden";
	}
	for (j=1;j<=6;j++) { // alter upper limit for more or less sections
		op = eval("o" + j);
		op.visibility = "visible";
	}
	
	// set the top positioning for each section when expanded
		
		if (isNS4) {
			c1.top = 10;  o1.top = 10;
			c2.top = 43;  o2.top = 43;
			c3.top = 124; o3.top = 124;
			c4.top = 189; o4.top = 189;
			c5.top = 254; o5.top = 254;
			c6.top = 303; o6.top = 303;
			bB.top = 416; bB.top = 416;
		}
		else if (isIE45) {
			c1.pixelTop = 10;  o1.pixelTop = 10;
			c2.pixelTop = 43;  o2.pixelTop = 43;
			c3.pixelTop = 124; o3.pixelTop = 124;
			c4.pixelTop = 189; o4.pixelTop = 189;
			c5.pixelTop = 254; o5.pixelTop = 254;
			c6.pixelTop = 303; o6.pixelTop = 303;
			bB.pixelTop = 416; bB.pixelTop = 416;
		}
		else { // for W3C standards-compliant browsers
			c1.top = 10 + "px";  o1.top = 10 + "px";
			c2.top = 43 + "px";  o2.top = 43 + "px";
			c3.top = 124 + "px"; o3.top = 124 + "px";
			c4.top = 189 + "px"; o4.top = 189 + "px";
			c5.top = 254 + "px"; o5.top = 254 + "px";
			c6.top = 303 + "px"; o6.top = 303 + "px";
			bB.top = 416 + "px"; bB.top = 416 + "px";
		}
	}
	
	if (doWhat == "close") {

	for (i=1;i<=6;i++) { // alter upper limit for more or less sections
		cl = eval("c" + i);
		cl.visibility = "visible";
	}
	for (j=1;j<=6;j++) { // alter upper limit for more or less sections
		op = eval("o" + j);
		op.visibility = "hidden";
	}
	
	// set the top positioning for each section when expanded
	
		if (isNS4) {
			c1.top = 10;  o1.top = 10;
			c2.top = 27;  o2.top = 27;
			c3.top = 44;  o3.top = 44;
			c4.top = 61;  o4.top = 61;
			c5.top = 78;  o5.top = 78;
			c6.top = 95;  o6.top = 95;
			bB.top = 112; bB.top = 112;
		}
		else if (isIE45) {
			c1.pixelTop = 10;  o1.pixelTop = 10;
			c2.pixelTop = 27;  o2.pixelTop = 27;
			c3.pixelTop = 44;  o3.pixelTop = 44;
			c4.pixelTop = 61;  o4.pixelTop = 61;
			c5.pixelTop = 78;  o5.pixelTop = 78;
			c6.pixelTop = 95;  o6.pixelTop = 95;
			bB.pixelTop = 112; bB.pixelTop = 112;
		}
		else { // for W3C standards-compliant browsers
			c1.top = 10 + "px";  o1.top = 10 + "px";
			c2.top = 27 + "px";  o2.top = 27 + "px";
			c3.top = 44 + "px";  o3.top = 44 + "px";
			c4.top = 61 + "px";  o4.top = 61 + "px";
			c5.top = 78 + "px";  o5.top = 78 + "px";
			c6.top = 95 + "px";  o6.top = 95 + "px";
			bB.top = 112 + "px"; bB.top = 112 + "px";
		}
	}
}

// The following function controls the menu functionality such as the opening
// and closing of specific sections of the menus, and the repositioning

function controlMenu(whichMenu,vis,amtMove) {

amtMove = (amtMove * 14); // multiplies number of menu items by their height

if (isNS4 || isIE45) {
	domOpen = eval(docObj + '.open' + whichMenu + styleObj);
	domClosed = eval(docObj + '.closed' + whichMenu + styleObj);
	}
	
else { // for W3C standards-compliant browsers
	domOpen = eval(docObj + '("open' + whichMenu + '")' + styleObj);
	domClosed = eval(docObj + '("closed' + whichMenu + '")' + styleObj);
	}

// reverse the current state of the menu section when clicked

if (vis == "openIt") {
	domOpen.visibility = "visible";
	domClosed.visibility = "hidden";
	}
else {
	domOpen.visibility = "hidden";
	domClosed.visibility = "visible";
	}

// set the appropriate DOM specifications

if (isNS4 || isIE45) {
	var c1 = eval(docObj + '.closed1' + styleObj);
	var o1 = eval(docObj + '.open1' + styleObj);
	var c2 = eval(docObj + '.closed2' + styleObj);
	var o2 = eval(docObj + '.open2' + styleObj);
	var c3 = eval(docObj + '.closed3' + styleObj);
	var o3 = eval(docObj + '.open3' + styleObj);
	var c4 = eval(docObj + '.closed4' + styleObj);
	var o4 = eval(docObj + '.open4' + styleObj);
	var c5 = eval(docObj + '.closed5' + styleObj);
	var o5 = eval(docObj + '.open5' + styleObj);
	var c6 = eval(docObj + '.closed6' + styleObj);
	var o6 = eval(docObj + '.open6' + styleObj);
	var bB = eval(docObj + '.bottomBdr' + styleObj);
	}
	
else { // for W3C standards-compliant browsers
	var c1 = eval(docObj + '("closed1")' + styleObj);
	var o1 = eval(docObj + '("open1")' + styleObj);
	var c2 = eval(docObj + '("closed2")' + styleObj);
	var o2 = eval(docObj + '("open2")' + styleObj);
	var c3 = eval(docObj + '("closed3")' + styleObj);
	var o3 = eval(docObj + '("open3")' + styleObj);
	var c4 = eval(docObj + '("closed4")' + styleObj);
	var o4 = eval(docObj + '("open4")' + styleObj);
	var c5 = eval(docObj + '("closed5")' + styleObj);
	var o5 = eval(docObj + '("open5")' + styleObj);
	var c6 = eval(docObj + '("closed6")' + styleObj);
	var o6 = eval(docObj + '("open6")' + styleObj);
	var bB = eval(docObj + '("bottomBdr")' + styleObj);
	}

// move all menu items below clicked one down

if (isNS4) {
	switch(whichMenu) {
		case "1":
			c2.top += amtMove;
			o2.top += amtMove;
		case "2":
			c3.top += amtMove;
			o3.top += amtMove;
		case "3":
			c4.top += amtMove;
			o4.top += amtMove;
		case "4":
			c5.top += amtMove;
			o5.top += amtMove;
		case "5":
			c6.top += amtMove;
			o6.top += amtMove;
		case "6":
			bB.top += amtMove;
			break;
		default:
			alert("Broken");
			break;
		}
	}
	
else if (isIE45) {
	switch(whichMenu) {
		case "1":
			c2.pixelTop += amtMove;
			o2.pixelTop += amtMove;
		case "2":
			c3.pixelTop += amtMove;
			o3.pixelTop += amtMove;
		case "3":
			c4.pixelTop += amtMove;
			o4.pixelTop += amtMove;
		case "4":
			c5.pixelTop += amtMove;
			o5.pixelTop += amtMove;
		case "5":
			c6.pixelTop += amtMove;
			o6.pixelTop += amtMove;
		case "6":
			bB.pixelTop += amtMove;
			break;
		default:
			alert("Broken");
			break;
		}
	}
	
else { // for W3C standards-compliant browsers
	switch(whichMenu) {
		case "1":
			c2.top = parseInt(c2.top) + amtMove + "px";
			o2.top = parseInt(o2.top) + amtMove + "px";
		case "2":
			c3.top = parseInt(c3.top) + amtMove + "px";
			o3.top = parseInt(o3.top) + amtMove + "px";
		case "3":
			c4.top = parseInt(c4.top) + amtMove + "px";
			o4.top = parseInt(o4.top) + amtMove + "px";
		case "4":
			c5.top = parseInt(c5.top) + amtMove + "px";
			o5.top = parseInt(o5.top) + amtMove + "px";
		case "5":
			c6.top = parseInt(c6.top) + amtMove + "px";
			o6.top = parseInt(o6.top) + amtMove + "px";
		case "6":
			bB.top = parseInt(bB.top) + amtMove + "px";
			break;
		default:
			alert("Broken");
			break;
		}
	}
}