//// Dynamic navigation bar generator.// MLB - 11/08/2002//// Indices into format array:var CLEARPIXEL = 0;var TOP_COLOR = 1;var MAINNAV_COLOR = 2;var SUBNAV_COLOR = 3;var SUBSUBNAV_COLOR = 4;var BOTTOM_COLOR = 5;var TAB_WIDTH = 6;var SUBTAB_SPACING = 7;var FOOTER_COLOR = 8;var FOOTER_LINK = 9;// Other constants:var HEXDIGITS = "0123456789ABCDEF";var NUMBLENDS = 5;var TOPCAPTION = 0;var BOTCAPTION = 1;function cleartext(whichbar){	if (document.all || document.getElementById) {		cross_el = document.getElementById ?			document.getElementById("descriptions" + whichbar):			document.all["descriptions" + whichbar];		cross_el.innerHTML = " ";	} else if (document.layers) {		document["d1" + whichbar].document["d2" + whichbar].document.write(" ");		document["d1" + whichbar].document["d2" + whichbar].document.close();	}}function changetext(whichbar, whichcontent){	if (document.all || document.getElementById) {		cross_el = document.getElementById ?			document.getElementById("descriptions" + whichbar):			document.all["descriptions" + whichbar];		cross_el.innerHTML = "<span class='sub-tab-caption'>" + whichcontent + "</span>";	} else if (document.layers) {		document["d1" + whichbar].document["d2" + whichbar].document.write("<span class='sub-tab-caption'>" + whichcontent + "</span>");		document["d1" + whichbar].document["d2" + whichbar].document.close();	}}function toHexString (num){	// Num must be from 0 to 255 -- returns 00 to FF	rnum = Math.floor(num);	n1 = Math.floor(rnum / 16);	n2 = rnum - (n1 * 16);	var s1 = new String(HEXDIGITS.substring(n1, n1 + 1));	var s2 = new String(HEXDIGITS.substring(n2, n2 + 1));	return s1 + s2;}function toColorString (red, green, blue){	// Red, green and blue must be from 0 to 255 -- returns color in the form #XXXXXX	colorStr = "#" + toHexString(red) + toHexString(green) + toHexString(blue);	return colorStr;}function NavBar (maintabs, subtabs, subsubtabs, format){	this.maintabs = maintabs;	this.subtabs = subtabs;	this.subsubtabs = subsubtabs;	this.format = format;		this.draw = function(mainselected, subselected, subsubselected, captionindex)	{		this.drawBlendBar(TOP_COLOR, MAINNAV_COLOR, false);		this.drawMainTabs(mainselected);		this.drawSpacer(SUBNAV_COLOR, 1);		this.drawSubTabs(subselected, captionindex);		this.drawSubSubTabs(subsubselected, 10 + captionindex, false);		this.drawBlendBar(SUBNAV_COLOR, BOTTOM_COLOR, true);	}		this.drawBlendBar = function(topIndex, botIndex, preIncr)	{		// Shaded blend bar - colors must be in form #XXXXXX:		document.write("<table class='header-banner' cellpadding='0' cellspacing='0' border='0'>");		red = parseInt((this.format[topIndex]).substring(1, 3), 16);		green = parseInt((this.format[topIndex]).substring(3, 5), 16);		blue = parseInt((this.format[topIndex]).substring(5, 7), 16);		redIncr = (parseInt((this.format[botIndex]).substring(1, 3), 16) - red) / NUMBLENDS;		greenIncr = (parseInt((this.format[botIndex]).substring(3, 5), 16) - green) / NUMBLENDS;		blueIncr = (parseInt((this.format[botIndex]).substring(5, 7), 16) - blue) / NUMBLENDS;				if (preIncr) {			red += redIncr;			green += greenIncr;			blue += blueIncr;		}		for (i = 0;  i < NUMBLENDS;  i++) {			var colorStr = new String(toColorString(red, green, blue));			document.write("<tr><td bgcolor='" + colorStr + "'><img src='" + this.format[CLEARPIXEL] + "' height='1' width='" + 				getPageWidth(0) + "' border='0'></td></tr>");			red += redIncr;			green += greenIncr;			blue += blueIncr;		}		document.write("</table>");	}		this.drawMainTabs = function(selected)	{				// In case there are no tabs:		if (this.maintabs == null) {			document.write("<table class='header-banner' bgcolor='" + this.format[MAINNAV_COLOR] + "' cellpadding='0' cellspacing='0' border='0'>");			document.write("<tr><td width='100%'><img src='" + this.format[CLEARPIXEL] + "' height='20' width='" + getPageWidth(0) + "' border='0'></td></tr>");			document.write("</table>");			return;		}				// Calculate shades used in tabs:		document.write("<table class='header-banner' bgcolor='" + this.format[MAINNAV_COLOR] + "' cellpadding='0' cellspacing='0' border='0'>");		red = parseInt((this.format[MAINNAV_COLOR]).substring(1, 3), 16);		green = parseInt((this.format[MAINNAV_COLOR]).substring(3, 5), 16);		blue = parseInt((this.format[MAINNAV_COLOR]).substring(5, 7), 16);		darkColor = toColorString(red * 2 / 3, green * 2 / 3, blue * 2 / 3);		darkerColor = toColorString(red / 3, green / 3, blue / 3);				// Top segments of the tabs:		document.write("<tr>");		document.write("<td width='25'><img src='" + this.format[CLEARPIXEL] + "' height='1' width='25' border='0'></td>");		numtabs = this.maintabs.length;		spacerOffset = numtabs * this.format[TAB_WIDTH];		for (i = 0;  i < numtabs;  i++) {			if (i == selected) {				document.write("<td width='1' bgcolor='" + darkColor + "'><img src='" + this.format[CLEARPIXEL] + "' height='1' width='1' border='0'></td>");				document.write("<td width='1' bgcolor='" + darkColor + "'><img src='" + this.format[CLEARPIXEL] + "' height='1' width='1' border='0'></td>");				document.write("<td width='" + (this.format[TAB_WIDTH] - 4) + "' bgcolor='" + darkColor + "'><img src='" + 					this.format[CLEARPIXEL] + "' height='1' width='" + (this.format[TAB_WIDTH] - 4) + "' border='0'></td>");				document.write("<td width='1'><img src='" + this.format[CLEARPIXEL] + "' height='1' width='1' border='0'></td>");				document.write("<td width='1'><img src='" + this.format[CLEARPIXEL] + "' height='1' width='1' border='0'></td>");			} else {				document.write("<td width='" + this.format[TAB_WIDTH] + "'><img src='" + this.format[CLEARPIXEL] + 					"' height='1' width='" + this.format[TAB_WIDTH] + "' border='0'></td>");			}		}		document.write("<td width='100%'><img src='" + this.format[CLEARPIXEL] + "' height='1' width='" + getPageWidth(spacerOffset) + "' border='0'></td>");		document.write("</tr>");				// Middle segments of the tabs containing links:		fontClass = "tab-link";		fontSelected = "tab-selected";		if (isOlderNetscape()) {			fontClass = "old-netscape-tab-link";			fontSelected = "old-netscape-tab-selected";		}		document.write("<tr>");		document.write("<td width='25'><img src='" + this.format[CLEARPIXEL] + "' height='1' width='25' border='0'></td>");		for (i = 0;  i < numtabs;  i++) {			if (i == selected) {				document.write("<td width='1' bgcolor='" + darkColor + "'><img src='" + this.format[CLEARPIXEL] + "' height='1' width='1' border='0'></td>");				document.write("<td width='1' bgcolor='" + this.format[SUBNAV_COLOR] + "'><img src='" + this.format[CLEARPIXEL] + "' height='1' width='1' border='0'></td>");				if (this.maintabs[i][2] == null) {					document.write("<td width='" + (this.format[TAB_WIDTH] - 4) + "' align='center' nowrap bgcolor='" + 						this.format[SUBNAV_COLOR] + "'><a href='" + this.maintabs[i][1] + "'><span class='" + fontSelected + "'>" + 						this.maintabs[i][0] + "</span></a></td>");				} else {					document.write("<td width='" + (this.format[TAB_WIDTH] - 4) + "' align='center' nowrap bgcolor='" + 						this.format[SUBNAV_COLOR] + "'><a href='" + this.maintabs[i][1] + "' onmouseover='self.status=\"" + this.maintabs[i][2] + 						"\"; return true' onmouseout='self.status=\"\"'><span class='" + fontSelected + "'>" + 						this.maintabs[i][0] + "</span></a></td>");				}				document.write("<td width='1' bgcolor='" + darkerColor + "'><img src='" + this.format[CLEARPIXEL] + "' height='1' width='1' border='0'></td>");				document.write("<td width='1' bgcolor='" + darkColor + "'><img src='" + this.format[CLEARPIXEL] + "' height='1' width='1' border='0'></td>");			} else {				if (this.maintabs[i][2] == null) {					document.write("<td width='" + this.format[TAB_WIDTH] + "' align='center' nowrap><a href='" + 						this.maintabs[i][1] + "'><span class='" + fontClass + "'>" + this.maintabs[i][0] + "</span></a></td>");				} else {					document.write("<td width='" + this.format[TAB_WIDTH] + "' align='center' nowrap><a href='" + 						this.maintabs[i][1] + "' onmouseover='self.status=\"" + 						this.maintabs[i][2] + "\"; return true' onmouseout='self.status=\"\"'><span class='" + fontClass + "'>" + 						this.maintabs[i][0] + "</span></a></td>");				}			}		}		document.write("<td width='100%'><img src='" + this.format[CLEARPIXEL] + "' border='0' height='1' width='" + getPageWidth(spacerOffset) + "'></td>");		document.write("</tr>");				// To accomodate older versions of Netscape (4.x and older) add some extra spacing.  This is		// needed because the extra space from the font-height all goes above the text instead of being		// split between above and below:		if (isOlderNetscape()) {			document.write("<tr>");			document.write("<td width='25' bgcolor='" + this.format[MAINNAV_COLOR] + "'><img src='" + this.format[CLEARPIXEL] + "' height='3' width='25' border='0'></td>");			for (i = 0;  i < numtabs;  i++) {				if (i == selected) {					document.write("<td width='1' bgcolor='" + darkColor + "'><img src='" + this.format[CLEARPIXEL] + "' height='3' width='1' border='0'></td>");					document.write("<td width='1' bgcolor='" + this.format[SUBNAV_COLOR] + "'><img src='" + this.format[CLEARPIXEL] + 						"' height='3' width='1' border='0'></td>");					document.write("<td width='" + (this.format[TAB_WIDTH] - 4) + "' bgcolor='" + 						this.format[SUBNAV_COLOR] + "'><img src='" + this.format[CLEARPIXEL] + "' height='3' width='" + (this.format[TAB_WIDTH] - 4) + "' border='0'></td>");					document.write("<td width='1' bgcolor='" + darkerColor + "'><img src='" + this.format[CLEARPIXEL] + "' height='3' width='1' border='0'></td>");					document.write("<td width='1' bgcolor='" + darkColor + "'><img src='" + this.format[CLEARPIXEL] + "' height='3' width='1' border='0'></td>");				} else {					document.write("<td width='" + this.format[TAB_WIDTH] + "' bgcolor='" + this.format[MAINNAV_COLOR] + "'><img src='" + 						this.format[CLEARPIXEL] + "' height='3' width='" + this.format[TAB_WIDTH] + "' border='0'></td>");				}			}			document.write("<td width='100%' bgcolor='" + this.format[MAINNAV_COLOR] + "'><img src='" + this.format[CLEARPIXEL] + "' border='0' height='1' width='" + 				getPageWidth(spacerOffset) + "'></td>");			document.write("</tr>");		}				// Bottom segments of the tabs:		document.write("<tr>");		document.write("<td width='25' bgcolor='" + darkColor + "'><img src='" + this.format[CLEARPIXEL] + "' height='1' width='25' border='0'></td>");		for (i = 0;  i < numtabs;  i++) {			if (i == selected) {				document.write("<td width='1' bgcolor='" + darkColor + "'><img src='" + this.format[CLEARPIXEL] + "' height='1' width='1' border='0'></td>");				document.write("<td width='1' bgcolor='" + this.format[SUBNAV_COLOR] + "'><img src='" + this.format[CLEARPIXEL] + 					"' height='1' width='1' border='0'></td>");				document.write("<td width='" + (this.format[TAB_WIDTH] - 4) + "' bgcolor='" + 					this.format[SUBNAV_COLOR] + "'><img src='" + this.format[CLEARPIXEL] + "' height='1' width='" + (this.format[TAB_WIDTH] - 4) + "' border='0'></td>");				document.write("<td width='1' bgcolor='" + darkerColor + "'><img src='" + this.format[CLEARPIXEL] + "' height='1' width='1' border='0'></td>");				document.write("<td width='1' bgcolor='" + darkColor + "'><img src='" + this.format[CLEARPIXEL] + "' height='1' width='1' border='0'></td>");			} else {				document.write("<td width='" + this.format[TAB_WIDTH] + "' bgcolor='" + darkColor + "'><img src='" + 					this.format[CLEARPIXEL] + "' height='1' width='" + this.format[TAB_WIDTH] + "' border='0'></td>");			}		}		document.write("<td width='100%' bgcolor='" + darkColor + "'><img src='" + this.format[CLEARPIXEL] + "' border='0' height='1' width='" + 			getPageWidth(spacerOffset) + "'></td>");		document.write("</tr>");		document.write("</table>");	}		this.drawSubTabs = function(selected, captionindex)	{		this.drawSubTabBar(this.subtabs, selected, true, captionindex);	}	this.drawSubSubTabs = function(selected, captionindex, drawBlendBars)	{		if (drawBlendBars) {			this.drawBlendBar(BOTTOM_COLOR, SUBNAV_COLOR, false);		}		this.drawSubTabBar(this.subsubtabs, selected, false, captionindex);		if (drawBlendBars) {			this.drawBlendBar(SUBNAV_COLOR, BOTTOM_COLOR, true);		}	}		this.drawSpacer = function(colorIndex, height)	{		document.write("<table class='header-banner' bgcolor='" + this.format[colorIndex] + "' cellpadding='0' cellspacing='0' border='0'>");		document.write("<tr><td width='100%'><img src='" + this.format[CLEARPIXEL] + "' height='" + height + "' width='" + getPageWidth(0) + "' border='0'></td></tr>");		document.write("</table>");	}	this.drawSubTabBar = function(subtabs, selected, showEmpty, captionindex)	{		// In case there are no tabs:		if (subtabs == null) {			if (showEmpty) {				document.write("<table class='header-banner' bgcolor='" + this.format[SUBNAV_COLOR] + "' cellpadding='0' cellspacing='0' border='0'>");				document.write("<tr><td width='100%'><img src='" + this.format[CLEARPIXEL] + "' height='20' width='" + getPageWidth(0) + "' border='0'></td></tr>");				document.write("</table>");			}			return;		}		fontClass = "sub-tab-link";		fontSelected = "sub-tab-selected";		fontNolink = "sub-tab-nolink";		fontCaption = "sub-tab-caption";		if (isOlderNetscape()) {			fontClass = "old-netscape-sub-tab-link";			fontSelected = "old-netscape-sub-tab-selected";			fontNolink = "old-netscape-sub-tab-nolink";			fontCaption = "old-netscape-sub-tab-caption";		}				numtabs = subtabs.length;		spacerOffset = numtabs * 100;	// Only affects older browsers - just guess average width of subtabs.				i = 0;		while (i < numtabs) {			document.write("<table class='header-banner' bgcolor='" + this.format[SUBNAV_COLOR] + "' cellpadding='0' cellspacing='0' border='0'>");			document.write("<tr>");			document.write("<td width='25'><img src='" + this.format[CLEARPIXEL] + "' height='1' width='25' border='0'></td>");				while ((i < numtabs) && (subtabs[i][0] != "*")) {				spacerTab = subtabs[i][0];				if ((subtabs[i][0] != null) && (subtabs[i][0].indexOf('#') == 0)) {					tablen = 4 * subtabs[i][0].length;					spacerTab = "<img src='" + this.format[CLEARPIXEL] + "' height='1' width='" + tablen + "' border='0'>";				}								if (subtabs[i][0] == null) {					document.write("<td width='10'><img src='" + this.format[CLEARPIXEL] + "' height='1' width='10' border='0'></td>");				} else if (subtabs[i][1] == null) {					document.write("<td nowrap><span class='" + fontNolink + "'>" + spacerTab + "</span></td>");				} else if (subtabs[i][0] == '') {					document.write("<td></td>");				} else {					whichClass = fontClass;					// There can be multiple sub-tabs selected:					if (selected != null && selected.length > 0) {						for (j = 0;  j < selected.length;  j++) {							if (i == selected[j]) {								whichClass = fontSelected;								break;							}						}					} else if (i == selected) {						whichClass = fontSelected;					}					if (subtabs[i][2] == null) {						document.write("<td nowrap><a href='" + subtabs[i][1] + "'><span class='" + whichClass + "'>" + subtabs[i][0] + "</span></a></td>");					} else {						document.write("<td nowrap><a href='" + subtabs[i][1] + "' onmouseover='changetext(" + captionindex +						", \"" + subtabs[i][2] + "\")' onmouseout='cleartext(" + captionindex + ")'><span class='" + 						whichClass + "'>" + subtabs[i][0] + "</span></a></td>");					}				}				if (subtabs[i][0] == '') {					document.write("<td></td>");				} else {					document.write("<td width='" + this.format[SUBTAB_SPACING] + "'><img src='" + this.format[CLEARPIXEL] + 						"' height='1' width='" + this.format[SUBTAB_SPACING] + "' border='0'></td>");				}								i++;			}						// Dynamic caption -- captionindex allows for captions on different sub-tab bars:			document.write("<td width='25'><img src='" + this.format[CLEARPIXEL] + "' height='1' width='25' border='0'></td>");			document.write("<td nowrap>");			document.write("<ilayer id='d1" + captionindex + "' top='0' left='0' visibility='show'>");			document.write("<layer id='d2" + captionindex + "' width='200' top='0' left='0'>");			document.write("<div id='descriptions" + captionindex + "' align='left' class='" + fontCaption + "'>&nbsp;</div>");			document.write("</layer>");			document.write("</ilayer>");			document.write("</td>");						document.write("<td width='95%'><img src='" + this.format[CLEARPIXEL] + "' border='0' height='1' width='" + 				(Math.floor(getPageWidth(spacerOffset) * 0.5) + 1) + "'></td>");			document.write("</tr>");			document.write("</table>");						i++;		}	}}