
// TEMPORARY ARRAY THAT REPRESENTS NAVIGATION
// _________________________________________________________________________________________


// GENERATES HOME PAGE TABLE FOR PRIMARY NAVIGATION AND DROP DOWN MENUS
// _________________________________________________________________________________________
// Set the size of the gap between each section in the main nav.
var vSpaceBetween = 12;
// Set the total width of the navigation
var vNavWidth = 760;

function fGenerateMainNavHome() {
		// Write the navigation table
		document.write( '<table id="navTable" width="' + vNavWidth + '" cellpadding="0" cellspacing="0" border="0"><tr>' );
		// Loop through the sections and print to the page
		
		for ( i=1; i<vSectionArray.length; i++ ) {
			// Set the table math not accounting for home link.
			document.write( '<td id="cell' + i + '" valign="top" width="' + Math.round( (vNavWidth - ((vSectionArray.length - 2) * vSpaceBetween )) / ( vSectionArray.length - 1) ) + '">' );
			// Create the main nav <div> wrapped in a link 
			// If not the current section make gray and set the rollover color to the section color.
			if ( i != vCurrSection ){ 
				document.write( '<a class="menulink" href="'+vSectionArray[i][3]+'?pageID='+vSectionArray[i][1] +'"><div onMouseOut="fPrimaryRollOver(\'out\',' + i + ',\'#CC0000\'' + ');" onMouseOver="fPrimaryRollOver(\'over\',' + i + ',\''+vSectionArray[i][2]+'\'' + ');" class="menuDiv" id="nav' + i + '">'  + vSectionArray[i][0] + '</div></a>' );
			// else if this is the current section make section color and set the rollover color to the section color.
			} else { 
				document.write( '<a class="menulink" href="section.php?pageID='+vSectionArray[i][1] +'"><div style="background-color: '+vSectionArray[i][2]+';" onMouseOut="fPrimaryRollOver(\'out\',' + i + ',\''+vSectionArray[i][2]+'\'' + ');" onMouseOver="fPrimaryRollOver(\'over\',' + i + ',\''+vSectionArray[i][2]+'\'' + ');" class="menuDivCurrent" id="nav' + i + '">'  + vSectionArray[i][0] + '</div></a>' );
			}
			// Close the table cell
			document.write( '</td>' );
			// Add divider IF it has been set and this is not the last loop through the array
			if ( vSpaceBetween > 0 && i != ( vSectionArray.length - 1 ) ){
				document.write( '<td id="spacerTDs" width="' + vSpaceBetween + '"><img src="imgs/spacer.gif" height="1" width="' + vSpaceBetween + '"></td>' );
			}
		}
		// Close table
		document.write( '</tr></table>' );
}


// ROLLOVER FUNCTIONS FOR MAIN NAVIGATION
// _________________________________________________________________________________________
function fPrimaryRollOver(pStatus, pDivToAffect, pSectionColor) {
		if ( pStatus == "over" ){
			var vDivToEvaluate = document.getElementById( "nav" + pDivToAffect );
			var vCellToEvaluate = document.getElementById( "cell" + pDivToAffect );
			vDivToEvaluate.style.backgroundColor = pSectionColor;
			vCellToEvaluate.style.backgroundColor = pSectionColor;
			vDivToEvaluate.style.color = "#FFFFFF";
		} else {
			var vDivToEvaluate = document.getElementById( "nav" + pDivToAffect );
			var vCellToEvaluate = document.getElementById( "cell" + pDivToAffect );
			if( pDivToAffect != vCurrSection ){
				vCellToEvaluate.style.backgroundColor = "#A6AEB0";
				vDivToEvaluate.style.backgroundColor = "#A6AEB0";
			}
			vDivToEvaluate.style.color = "#FFFFFF";
		}
}