var length = 7; /* =========  TOTAL NUMBER OF MAIN DIVISIONS (Section#)  ========= */	
var NotLink = "";
var LinkNumber = "";
var SectNumber = "";

var SID = "Section"; /* =========  SECTION ID  ========= */
var SSID = "Subsect"; /* =========  SUBSECTION ID  ========= */

var SubSectClose = "";
var SubSectLength = 13; /* =========  TOTAL NUMBER OF SUB-SECTIONS WITH LINKS (subsect#)  ========= */

headeron = new Image(7,11); headeron.src = "images/headeron.gif";
headeroff = new Image(7,11); headeroff.src = "images/headeroff.gif";

subsecton = new Image(7,11); subsecton.src = "images/subsecton.gif";
subsectoff = new Image(7,11); subsectoff.src = "images/subsectoff.gif";	

/* =========  CODE TO OPEN/CLOSE LISTING BY HEADER  ========= */
function HeaderShowSubsect(num) {
	LinkNumber = SID + num;
	if ((document.getElementById(LinkNumber).style.visibility == "hidden")||(document.all[LinkNumber].style.display == "none")) {
		document.getElementById(LinkNumber).style.visibility = "visible";
		document.all[LinkNumber].style.display = "block";
		eval('document.images["DisplayHeader' + num + '"].src = ' + 'headeron.src');	
		
		/* =========  REMOVE SECTION BELOW IF THE MENU NEEDS TO REMAIN OPEN  ========= */							
	    for(var i = 1; i<=length; i++) {
			NotLink = SID + i;
	        if (i != num) {
				document.getElementById(NotLink).style.visibility = "hidden";
				document.all[NotLink].style.display = "none";
				eval('document.images["DisplayHeader' + i + '"].src = ' + 'headeroff.src');
			}
		}
		/* =========  END REMOVABLE SECTION  ========= */
		
	} else {
		document.getElementById(LinkNumber).style.visibility = "hidden";
		document.all[LinkNumber].style.display = "none";
		eval('document.images["DisplayHeader' + num + '"].src = ' + 'headeroff.src');
	}
	/* =========  CODE TO PROPERLY CLOSE ALL SUB-SECTIONS  ========= */
    for(var i = 1; i<=SubSectLength; i++) {
		SubSectClose = SSID + i;
	        document.getElementById(SubSectClose).style.visibility = "hidden";
			document.all[SubSectClose].style.display = "none";
			eval('document.images["subsectoff' + i + '"].src = ' + 'subsectoff.src');
	}		
}	


/* =========  SUB-SECTION DIVISION FUNCTIONS  ========= */	

function subsectBGon(num) {
var secTemp = "";
secTemp = "sst" + num;
		document.getElementById(secTemp).style.backgroundColor = "#661621";
		document.all[secTemp].style.backgroundColor = "#661621";				
}	

function subsectBGoff(num) {
var secTemp = "";
secTemp = "sst" + num;
		document.getElementById(secTemp).style.backgroundColor = "#855058";
		document.all[secTemp].style.backgroundColor = "#855058";
		if ((document.getElementById(secTemp).style.visibility == "hidden")||(document.all[secTemp].style.display == "none")){	
			eval('document.images["subsectoff' + num + '"].src = ' + 'subsectoff.src')
		}		
}	

/* =========  CODE TO OPEN/CLOSE LISTING BY SUB-SECTION  ========= */
function SubSectShow(num) {
SectNumber = SSID + num;
	if ((document.getElementById(SectNumber).style.visibility == "hidden")||(document.all[SectNumber].style.display == "none")) {
		document.getElementById(SectNumber).style.visibility = "visible";
		document.all[SectNumber].style.display = "block";
		eval('document.images["subsectoff' + num + '"].src = ' + 'subsecton.src')	
	} else {
	document.getElementById(SectNumber).style.visibility = "hidden";
	document.all[SectNumber].style.display = "none";
	eval('document.images["subsectoff' + num + '"].src = ' + 'subsectoff.src');	
	}							
}	

/* =========  SUB-SECTION LINK FUNCTIONS  ========= */
function swapLinkBGon(num) {
var secTemp = "";
secTemp = "SubSectLink" + num;
		document.getElementById(secTemp).style.backgroundColor = "#595959";
		document.all[secTemp].style.backgroundColor = "#595959";
		document.getElementById(secTemp).style.color = "white";
		document.all[secTemp].style.color = "white";			
}	

function swapLinkBGoff(num) {
var secTemp = "";
secTemp = "SubSectLink" + num;
		document.getElementById(secTemp).style.backgroundColor = "Silver";
		document.all[secTemp].style.backgroundColor = "Silver";
		document.getElementById(secTemp).style.color = "#3d3d3d";
		document.all[secTemp].style.color = "#3d3d3d";						
}		
/* ==================================== */

/* =========  HEADER FUNCTIONS  ========= */
function swapHeaderon(num1) {
var secTemp = "";
secTemp = "TopMenu" + num1;
		document.getElementById(secTemp).style.backgroundColor = "#400E15";
		document.all[secTemp].style.backgroundColor = "#400E15";					
}	

function swapHeaderoff(num1) {
var secTemp = "";
secTemp = "TopMenu" + num1;
		document.getElementById(secTemp).style.backgroundColor = "#9D102D";
		document.all[secTemp].style.backgroundColor = "#9D102D";									
}		
/* ==================================== */

/* =========  DISPLAY HEADERS BY NUMBER  ========= */
function DisplayHeaders(num1,num2){
	document.write('<div class="header" id="TopMenu' + num1 + '" onmouseover="swapHeaderon(' + num1 + ')" onmouseout="swapHeaderoff(' + num1 + ')" onClick="HeaderShowSubsect(' + num1 + ')"><img src="images/headeroff.gif" alt="" width="7" height="11" border="0" align="right" name="DisplayHeader' + num1 + '"><script language="JavaScript">displayTitles(' + num2 + ');</script></div>');
}

/* =========  DISPLAY LINKS BY NUMBER  ========= */	
function DisplaySectionTitle(num1,num2){
	document.write('<div class="subsection_titles" id="sst' + num1 + '" onmouseover="subsectBGon(' + num1 + ')" onmouseout="subsectBGoff(' + num1 + ')" onclick="SubSectShow(' + num1 + ')"><img src="images/subsectoff.gif" alt="" name="subsectoff' + num1 + '" width="7" height="11" border="0" align="right"><script language="JavaScript">displaySubsection(' + num2 + ');</script></div>');
}

/* =========  DISPLAY LINKS BY NUMBER  ========= */
function DisplayLinks(num){							
			document.write('<div id="SubSectLink' + num + '" class="sublink" onmouseover="swapLinkBGon(' + num + ')" onmouseout="swapLinkBGoff(' + num + ')" onclick="jumptoLinks(' + num + ')"><script language="JavaScript">displayLinkList(' + num + ');</script></div>');
}
