if (browserObj == "NS") {
	layer = "layer";
} else {
	layer = "div";
}

// Top navigation

for (x = 0, y = 1; x < nav; x++, y++) {

	if (browserObj == "NS") {
		document.write ('<layer id="' + imgName[0] + y + '" TOP=' + navPosY +' LEFT=' + navPosX[x] + ' width=' + imgSizeW[x] + ' height=' + imgSizeH + ' z-index=' + zIndex[0] + ' visibility=' + visibility[0] + '>');

	} else { 

		document.write ('<div id="'  + imgName[0] + y + '" style="position:absolute; left:' + navPosX[x] + 'px; top:' + navPosY + 'px; width:' + imgSizeW[x] + 'px; height:'  + imgSizeH + 'px; z-index:' + zIndex[0] + '; visibility: ' + visibility[0] + ';">');
	}
	
// sets variable url per loop
			
	if (subNavPos[x] == 0) {
		url = dirName[x] + '/' + fileName[x];
	} else { 
		url = "#";
	}

// sets variable state per loop

	if (directory == dirName[x]) {
		state = "_over";
	} else {
		state = '';
	}

// this writes the <a href tag> if needed

	if ((directory != dirName[x]) || ((directory = dirName[x]) && (subNavPos[x] == 1))) {

		document.write ('<a href="/' + url + '.html" onmouseover="');
		
// this writes the MM_showHideLayters() if needed

		if (url == "#") {
			document.write ('MM_showHideLayers(\'' + imgName[0] + y + 'o\',\'\',\'show\',\'navcontrol\',\'\',\'show\')">');
		}				

// this writes the changeImages() if <a href> tag is written
	
		if (url != "#") {
			document.write ('changeImages(\'' + imgName[0] + y + '\', \'/images/' + imgName[0] + y + '_over.gif\'); return true;" onmouseout="changeImages(\'' + imgName[0] + y + '\', \'/images/' + imgName[0] + y + '.gif\')">');	
		}
	}
		
	document.write ('<img src="/images/' + imgName[0] + y + state + '.gif" width="' + imgSizeW[x] + '" height="' + imgSizeH + '" name="' + imgName[0] + y + '" alt="' + imgAlt[x] + '" border="0">');

// closes <a href tag if written
	if ((directory != dirName[x]) || ((directory = dirName[x]) && (subNavPos[x] == 1))) {
		document.write ('</a>');
	}
		
	document.write ('</' + layer + '>');

}

// Sub navigation


for (x = 0, y = 1; x < subNav; x++, y++) {

	if (browserObj == "NS") {
		document.write ('<layer id="' + imgName[0] + subNavNumber[x] + 'o" TOP=' + navPosY +' LEFT=' + subnavPosX[x] + ' width=' + subimgSizeW[x] + ' height='   + (34 + (subimgSizeH * (subNavCount[x] - 1))) + ' z-index=' + zIndex[1] + ' visibility=' + visibility[1] + '>');
	} else { 
		document.write ('<div id="'  + imgName[0] + subNavNumber[x] + 'o" style="position:absolute; left:' + subnavPosX[x] + 'px; top:' + subnavPosY + 'px; width:' + subimgSizeW[x] + 'px; height:'  + (34 + (subimgSizeH * (subNavCount[x] - 1))) + 'px; z-index:' + zIndex[1] + '; visibility: ' + visibility[1] + ';">');
	}		

// centers the over image and includes space to shim down sub nav
	
	document.write ('<div align="center"><img src="/images/' + imgName[0] + subNavNumber[x] +'_over.gif" width="' + imgSizeW[subNavNumber[x] - 1] + '" height="' + imgSizeH + '" name="' + imgName[0] + subNavNumber[x] +'" alt="' + imgAlt[subNavNumber[x]] + '"></div><img src="/images/spacer.gif" height="12" width="'+ subimgSizeW[x] + '">');

// sub nav elements loop
	
	for (s = 0, t = 1; s < subNavCount[x]; s++, t++) {

// the if() below limits the loop to one less than the actual count so that the final image will correctly be the bottom image

		if (s != (subNavCount[x] - 1)) {

// this branch sets the value of subFileName (used for the href) and subimgAlt (used for the Alt tag)

		if (x == 0) {
			subFileName = subFileName2[s];
			subimgAlt = subimgAlt2[s];
		} else if (x == 1) {
			subFileName = subFileName3[s];
			subimgAlt = subimgAlt3[s];
		}
			with (document) {
				write ('<a href="/' + dirName[subNavNumber[x] - 1] + '/' + subFileName + '.html" onmouseover="changeImages(\'' + imgName[0] + subNavNumber[x] + imgName[1] + t + '\', \'/images/' + imgName[0] + subNavNumber[x] +imgName[1] + t +'_over.gif\'); return true;"onmouseout="changeImages(\'' + imgName[0] + subNavNumber[x] + imgName[1] + t +'\', \'/images/' + imgName[0] + subNavNumber[x] + imgName[1] + t +'.gif\')">');
				write ('<img src="/images/' + imgName[0] + subNavNumber[x] + imgName[1] + t +'.gif" width="' + subimgSizeW[x] + '" height="' + subimgSizeH + '" name="' + imgName[0] + subNavNumber[x] + imgName[1] + t +'" alt="' + subimgAlt + '" border="0">');
				write ('</a>');
			}

		} else {

// final image in sub nav		
			document.write('<img src="/images/' + imgName[0] + subNavNumber[x] + imgName[1] + t +'.gif" width="' + subimgSizeW[x] + '" height="4" name="' + imgName[0] + subNavNumber[x] + imgName[1] + t +'" border="0">');
		}
	}
	

	document.write ('</' + layer + '>');
	
}

// nav control

if (browserObj == "NS") {
	document.write ('<layer id="navcontrol" TOP=' + navcontrolY +' LEFT=' + navcontrolX +' width=' + navcontrolW + ' height=' + navcontrolH + ' z-index=' + zIndex[2] + ' visibility=' + visibility[1] + '>');
} else { 
	document.write ('<div id="navcontrol" style="position:absolute; left: ' + navcontrolX + 'px; top: ' + navcontrolY + 'px; width: ' + navcontrolW + 'px; height: ' + navcontrolH + 'px; z-index:' + zIndex[2] + '; visibility: ' + visibility[1] + ';">');
}		
	
document.write ('<a href="#" onmouseover="MM_showHideLayers(');

	for (x = 0; x < subNav; x++) {
	 	document.write ('\'' + imgName[0] + subNavNumber[x] + 'o\',\'\',\'hide\'');

		if ((subNav - x) != 1) {
			document.write (',');
		}
	}
	
document.write (',\'navcontrol\',\'\',\'hide\')">');

document.write('<img src="/images/spacer.gif" width="' + navcontrolW + '" height="' + navcontrolH + '" border="0"></a></' + layer + '>');