var gstrBrowserType = null
if( document.layers ) {
	gstrBrowserType="Netscape";
	function reDo(){ window.location.reload() }
	function setResize(){setTimeout("window.onresize=reDo",733);}
	window.onload = setResize;
}
else if( document.all ) {
	gstrBrowserType="IE";
}

//---------------------------------------------------------------------------
// setMenuVisibility - will change the state of a menu to the value passed in.
//                     Netscape=[hide,show] IE=[hidden,visible]
// Arguments: strMenuItemDiv  - the actual menu item div as a string
//            strNewMenuState - the state to change the div to
//---------------------------------------------------------------------------
function setMenuVisibility( strMenuDiv, strNewMenuState ){
	var objMenuDiv;
	if( gstrBrowserType == "Netscape")
	{
		objMenuDiv = eval(strMenuDiv);
  		if( objMenuDiv ) objMenuDiv.visibility = strNewMenuState;
	}
	else if( gstrBrowserType == "IE" )
	{
		objMenuDiv=eval(strMenuDiv);
		if( objMenuDiv ) objMenuDiv.style.visibility = strNewMenuState;
	}
	else if( gstrBrowserType == "NS6" )
	{
		objMenuDiv=eval("document.getElementById(\"" + strMenuDiv + "\")");
		if( objMenuDiv ){
		objMenuDiv.style.visibility = strNewMenuState;
		}
	}	
	else
	{
		return
	}
}
//---------------------------------------------------------------------------
// setMenuItemBgColor - will change the background color of a menu item to
//                      the color passed in.  This provides the highlighting
//                      effect when the mouse is over a particular menu item.
// Arguments: strMenuItemDiv - the actual menu item div as a string
//            strColor       - the color to change to
//---------------------------------------------------------------------------
function setMenuItemBgColor( strMenuItemDiv, strColor ){
	var objMenuItemDiv;

	if( gstrBrowserType == "Netscape")
	{
		objMenuItemDiv = eval(strMenuItemDiv);
  		if( objMenuItemDiv ) objMenuItemDiv.bgColor = strColor;
	}
	else if( gstrBrowserType=="IE" )
	{
		objMenuItemDiv=eval(strMenuItemDiv);
		if( objMenuItemDiv ) objMenuItemDiv.style.backgroundColor = strColor;
	}
	else if( gstrBrowserType=="NS6" )
	{
		objMenuItemDiv=eval("document.getElementById(\"" + strMenuItemDiv + "\")");
		if( objMenuItemDiv ) objMenuItemDiv.style.backgroundColor = strColor;
	}	
	else
	{
		return
	}
}
//---------------------------------------------------------------------------
// createNetscapeMenu - create the layers for Netscape browsers.  In order to
//	get a border in Netscape, I had to add an extra layer.  The layer was
//	required because we have a left/right margin on the text layers that
//	show the color of the layer behind the text layer.  This "layer behind"
//	was the main layer which was the color of the border.  Thus, the color
//	of the left/right margin all the way out to the border was the color of
//	the border instead of the color of the menu item.
//
//	I put an extra layer in.  The main layer is the color of the desired 
//	border.  The second layer is inset by one pixel with the color of the
//	menu items.  When we apply the margins to the menu items, now you see
//	the menu item color of layer 2 behind the menu item instead of the 
//	border color of the main layer.  Sorry for the novel-like comments!
//
// Arguments: strmenuName - name of the menu to be created. This is used to
//                          index into garyMenuData
//            intLeftPos  - value of left starting point of the menu in pixels
//            intWidth    - value of width of menu in pixels
//            strAlignText- the alignment of the text in the menu (left unless
//                          you are the last menu, then right).
//---------------------------------------------------------------------------
function createNetscapeMenu( strMenuName, intLeftPos, intWidth, strTextAlign ){
	var strLayerDef = "";                    //The HTML definition of the whole menu
	var strID = "";                          //The id of the menu items - it is the first 3 letters
                                                 //of the menu name followed by a counter number (0,1,2...)
	var intTopPos = 130;                     //The absolute top of all the menus
	var intLineHeight = 18;                  //The height of the menu item lines
	var intInsideWidth = intWidth - 2;       //The width of layer 2
	var intItemWidth = intInsideWidth - 2;   //The width of text items which can be highlighted
	var intMargin = 9;                       //The width of the left/right margins
	var separator="<img src=\"images/bar.gif\" width=\"" + (intWidth-20) + "\" height=\"1\">"
	var isMac = (navigator.appVersion.indexOf("Mac") != -1);
	var strLayerStyle = "gNetMenuItemStyle"  //string designating the layer style, specifies either PC or Mac style
	var strTextStyle = "gNetMenuText"		 //string designating the layer style for text in menus
	if( isMac ) {
		strLayerStyle = "gNetMenuItemStyleMac"
		strTextStyle = "gNetMenuTextMac"
	}

	if( strTextAlign == "right" ) strTextAlign = " align=\"right\"";
	else strTextAlign = "";

	//The first layer holds the second layer (which holds all the other elements).  The only visible portion of it is 1px around for the border.
	strLayerDef  = "<layer id=\""+ strMenuName +"\" visibility=\"hide\" left=\"" + intLeftPos + "\" top=\"" + intTopPos + "\" "
 	strLayerDef += "width=\"" + intWidth + "\" z-index=\"1\" bgcolor=\"" + gstrBorderColor + "\" onmouseover=\"showMenu('" + strMenuName + "')\" onmouseout=\"hideMenu('" + strMenuName + "')\">"

	//The second layer just holds all the other elements.  It's background color is the same as that of the menu items so when the menu
	//items are cropped, we don't see the color of the border on the area of the element left transparent by the crop.
	strLayerDef += "<layer id=\""+ strMenuName +"1\" left=\"1\" top=\"1\" "
 	strLayerDef += "width=\"" + intInsideWidth + "\" z-index=\"7\" bgcolor=\"" + gstrMenuColor + "\">"

	var intTopCoord = 2
	strLayerDef += "<layer id=\"firstspacer\" bgcolor=\"" + gstrMenuColor +"\" left=\"1\" width=\"" + intItemWidth + "\" height=\"3\" z-index=\"7\" top=\"" + intTopCoord + "\"></layer>"
	intTopCoord += 3;

	for( var intItem=0; intItem < garyMenuData[strMenuName].length; intItem++ ) {
		strLayerDef += "<layer id=\"separator\" bgcolor=\"" + gstrMenuColor + "\" width=\"" + intItemWidth + "\" left=\"1\" height=\"1\" z-index=\"7\" top=\"" + intTopCoord + "\"><center>"+ separator +"</center></layer>"
		intTopCoord += 1;
		strID = strMenuName.substr(0,3) + intItem
		strLayerDef += "<layer id=\"" + strID + "\" clip=\"" + intMargin + ",0," + (intWidth-intMargin) + "," + intLineHeight + "\" class=\"" + strLayerStyle + "\" "
		strLayerDef += "z-index=\"7\" width=\"" + intItemWidth + "\" top=\"" + intTopCoord + "\" bgcolor=\"" + gstrMenuColor + "\" "
		strLayerDef += "onmouseover=\"setMenuItemBgColor('document.layers[\\'" + strMenuName + "\\'].document.layers[\\'" + strMenuName + "1\\'].document.layers[\\'" + strID + "\\']', '" + gstrMenuColorOn + "')\" "
		strLayerDef += "onmouseout=\"setMenuItemBgColor('document.layers[\\'" + strMenuName + "\\'].document.layers[\\'" + strMenuName + "1\\'].document.layers[\\'" + strID + "\\']', '" + gstrMenuColor + "')\"> "
		if (garyMenuData[strMenuName][intItem][1].substring(0,4).toLowerCase() == "http" || garyMenuData[strMenuName][intItem][1].search("externallink_redirect") > 0 ) {
			//This is an external link so send it to another window
			strLayerDef += "<p" + strTextAlign + "><a class=\"" + strTextStyle + "\" href=\"" + garyMenuData[strMenuName][intItem][1] + "\" target=\"_blank\"> "
		}
		else {
			strLayerDef += "<p" + strTextAlign + "><a class=\"" + strTextStyle + "\" href=\"" + garyMenuData[strMenuName][intItem][1] + "\"> "
		}
		strLayerDef += garyMenuData[strMenuName][intItem][0] + "</a></p></layer>"
		intTopCoord += intLineHeight;
	}
	strLayerDef += "<layer id=\"lastseparator\" bgcolor=\"" + gstrMenuColor +"\" left=\"1\" width=\"" + intItemWidth + "\" height=\"5\" z-index=\"7\" top=\"" + intTopCoord + "\"><center>"+ separator +"</center></layer>"
	intTopCoord += 5;
	strLayerDef += "<layer id=\"lastspacer1\" bgcolor=\"" + gstrMenuColor + "\" width=\"" + intItemWidth + "\" height=\"1\" z-index=\"7\" top=\"" + intTopCoord + "\"></layer>"
	intTopCoord += 1;
	strLayerDef += "<layer id=\"lastspacer\" bgcolor=\"" + gstrBorderColor + "\" width=\"" + intInsideWidth + "\" height=\"1\" z-index=\"7\" top=\"" + intTopCoord + "\"></layer>"
	strLayerDef += "</layer>" //end the 2nd layer
	strLayerDef += "</layer>" //end the main layer for the whole menu

	document.write( strLayerDef );
}
//---------------------------------------------------------------------------
// createMenu - create the menu layers for Internet Explorer and Netscape 6.0
//				browsers
//
// Arguments: strmenuName - name of the menu to be created. This is used to
//                          index into garyMenuData
//            intLeftPos  - value of left starting point of the menu in pixels
//            intWidth    - value of width of menu in pixels
//            strAlignText- the alignment of the text in the menu (left unless
//                          you are the last menu, then right.
//---------------------------------------------------------------------------
function createMenu( strMenuName, intLeftPos, intWidth, strTextAlign ){
	var strDivDef = "";                     //The HTML definition of the whole menu
	var intTopPos = "130";                  //The absolute top of all the menus
	var strID     = "";                     //The id of the menu items - it is the first 3 letters
                                            //of the menu name followed by a counter number (0,1,2...)
	var strRefID  = "";						//string holding reference to id of menu item using DOM
	var intSepMargin = 0;                   //The width of the left/right margins for separator lines
	var intMargin = 0;                      //The width of the left/right margins
	var intItemWidth = intWidth-0;
	var intSepHeight = intSepMargin;
	var lastSep = "";
	var isMac = (navigator.appVersion.indexOf("Mac") != -1);
	var strLayerStyle = "gIEMenuItemStyle"; //string designating the layer style, specifies either PC or Mac style
	var strCursor = "hand";					//cursor style for IE
	if( isMac ) strLayerStyle = "gIEMenuItemStyleMac";
	var separator="<img src=\"images/bar.gif\" width=\"" + intWidth + "\" height=\"1\">";

	if( gstrBrowserType == "NS6" ) {
		//Some configuration settings specific to Netscape 6 and above
		strCursor = "pointer";
		intTopPos = "130";
		intLeftPos -= 0;
		intWidth += 0;
		intItemWidth = intWidth-(2*intMargin);
		intSepHeight = 1;
		lastSep = "<span style=\"line-height:" + intSepHeight + "px;\">&nbsp;</span>\n";
	}
	strDivDef = "<div id=\"" + strMenuName + "\" style=\"visibility:hidden; position:absolute; left:" + 
		intLeftPos + "; top:" + intTopPos + ";cursor: " + strCursor + ";width:" + intWidth + 
		"px; z-index:3; border:1px solid " + gstrBorderColor + "; background-color:" + gstrMenuColor + 
		";\" onmouseover=\"showMenu('" + strMenuName + "')\" onmouseout=\"hideMenu('" + strMenuName + "')\">\n" +
		"<div id=\"separator\" style=\"position:relative; width:" + 
		(intWidth-(2*intSepMargin)) + "px; background-color:" + gstrMenuColor + ";line-height:" + 
		intSepHeight + "px;\">&nbsp;\n</div>\n";

	for( var intItem=0; intItem < garyMenuData[strMenuName].length; intItem++ ) {
		
		strDivDef += "<div id=\"separator\" style=\"position:relative; width:" + (intWidth-(2*intSepMargin)) + 
			"px; margin-right:" + intSepMargin + "px; margin-left:" + intSepMargin + "px; background-color:"
		strDivDef += gstrMenuColor + ";\"><center>" + separator + "</center></div>\n"
		strID = strMenuName.substr(0,3) + intItem;
		if( gstrBrowserType == "NS6" ) {
			strRefID = strID;
		}
		else {
			strRefID = "document.all[\\'" + strID + "\\']";
		}
		strDivDef += "<div id=\"" + strID + "\" style=\"position:relative; text-align:" + strTextAlign + "; "
		strDivDef += "background-color:" + gstrMenuColor + "; margin-left:" + intMargin + "px; margin-right:" + 
			intMargin + "px; width:" + intItemWidth + "px;\" "
		strDivDef += "onmouseover=\"setMenuItemBgColor('" + strRefID + "','" + gstrMenuColorOn + "')\" "
		strDivDef += "onmouseout=\"setMenuItemBgColor('" + strRefID + "','" + gstrMenuColor + "')\" "
		
		if (garyMenuData[strMenuName][intItem][1].substring(0,4).toLowerCase() == "http" || 
			garyMenuData[strMenuName][intItem][1].search("externallink_redirect") > 0 ) {
			strDivDef += "onClick=\"javascript:window.open('" + 
				garyMenuData[strMenuName][intItem][1] + "')\">&nbsp;&nbsp;<span class=\"" + strLayerStyle + "\" >" + 
				garyMenuData[strMenuName][intItem][0];
		}
		else {
			strDivDef += "onClick=\"location.href='" + garyMenuData[strMenuName][intItem][1] + 
				"'\">&nbsp;&nbsp;<span class=\"" + strLayerStyle + "\" >" + garyMenuData[strMenuName][intItem][0];
		}
		strDivDef += "</span>&nbsp;&nbsp;</div>\n";
	}
	strDivDef += "<div id=\"separator\" style=\"position:relative; margin-left:" + intSepMargin + 
		"px; margin-right:" + intSepMargin + "px; width:" + (intWidth-(2*intSepMargin)) + 
		"px; background-color:" + gstrMenuColor + ";\"><center>" + separator + "</center></div>";

	strDivDef += "<div id=\"lastseparator\" style=\"position:relative;width:" + intWidth + 
		"px;background-color:" + gstrMenuColor + ";\"><span style=\"line-height:" + intSepHeight + 
		"px;\">&nbsp;</span></div>" + lastSep + "</div>";
	document.write( strDivDef );
}
//---------------------------------------------------------------------------
// showMenu - This function determines which browser you are using and sends
//            the appropriate (browser-specific) CSS string along to the 
//            setMenuVisibility function to make the current menu visible.
//
// Arguments: strMenu - the name of the menu to show
//---------------------------------------------------------------------------
function showMenu( strMenu ) {
	if( gstrBrowserType == "Netscape" ) {
		setMenuVisibility("document.layers[\"" + strMenu + "\"]","show")
	}
	else if( gstrBrowserType == "IE" ) {
		setMenuVisibility("document.all[\"" + strMenu + "\"]","visible")
	}
	else if( gstrBrowserType == "NS6" ) {
		setMenuVisibility(strMenu,'visible')
	}
}
//---------------------------------------------------------------------------
// hideMenu - This function determines which browser you are using and sends
//            the appropriate (browser-specific) CSS string along to the 
//            setMenuVisibility function to hide the current menu.
//
// Arguments: strMenu - the name of the menu to hide
//---------------------------------------------------------------------------
function hideMenu( strMenu ) {
	if( gstrBrowserType == "Netscape" ) {
		setMenuVisibility("document.layers[\"" + strMenu + "\"]","hide")
	}
	else if( gstrBrowserType == "IE" ) {
		setMenuVisibility(document.all[strMenu],"hidden")
	}
	else if( gstrBrowserType == "NS6" ) {
		setMenuVisibility(strMenu,'hidden')
	}	
}

var gstrBrowserType = null
if( document.layers )   gstrBrowserType="Netscape";
else if( document.all )	gstrBrowserType="IE";
else if( document.getElementById ) gstrBrowserType = "NS6";
gstrMenuColor = "#F5A22F"
gstrMenuColorOn = "#cb7705"
gstrBorderColor = "#F5A22F"
var strAlignment = "left"
if( gstrBrowserType == "Netscape" )
{
	for (var intCnt=0; intCnt<garyMenuNames.length; intCnt++) {
		if( intCnt == (garyMenuNames.length - 1) ){
			//All menus are left-aligned except the last menu
			strAlignment = "left"
		}
		//Pass the menu name, the menu left position Netscape, the Netscape width, and the alignment of text in the menu
		createNetscapeMenu(garyMenuNames[intCnt][0], garyMenuNames[intCnt][1], garyMenuNames[intCnt][3], strAlignment)
	}
}
else if( gstrBrowserType == "IE" || gstrBrowserType == "NS6" )
{
	for (var intCnt=0; intCnt<garyMenuNames.length; intCnt++) {
		if( intCnt == (garyMenuNames.length - 1) ){
			//All menus are left-aligned except the last menu
			strAlignment = "left"
		}
		//Pass the menu name, the menu left position for IE, the IE width, and the alignment of text in the menu
		createMenu(garyMenuNames[intCnt][0], garyMenuNames[intCnt][2], garyMenuNames[intCnt][4], strAlignment)
	}
}
function showMap()
{
var codestr;
var swidth;
swidth = screen.width;
if (swidth>=800)
	{
		codestr = 'window.open("http://display.maxvr.com/mapviewer/fullpopup.asp?ident=BNCCV-XBWBM","TransInfo","height=470,width=796,menubar=no,top=5,scrollbars=no,resizable=no,left=0")';
	}
else
	{
		codestr = 'window.open("http://display.maxvr.com/mapviewer/pop.asp?ident=BNCCV-XBWBM","TransInfo","height=409,width=495,menubar=no,top=5,scrollbars=no,resizable=yes,left=0")';
	}
eval(codestr);
}