
//------------------------------------------------------------------------------------------
// The following piece of code is not currently being used, but may be in the future.
// It does an extensive browser/platform/computer check.
//
// Browser upgrade splash page check
//

var browserName = navigator.appName;
var browserVer = navigator.appVersion;
var browserOK = 1;

// Get MSIE version number
if (browserName == "Microsoft Internet Explorer") 
{
	var verIndex = navigator.appVersion.indexOf("MSIE ");
	if (verIndex > 0) 
	{
		var verString = navigator.appVersion.substring(verIndex + 5, verIndex + 9);
		if (verString.substring(3,4) == ';') 
		{
			verString = verString.substring(0,3)
		}
		browserVer = verString;
	}
	var textchange = "OK";
}
else if (browserName == "Netscape") 
{
	var verIndex = navigator.appVersion.indexOf(" ");
	if (verIndex > 0) 
	{
		var verString = navigator.appVersion.substring(0, verIndex);
		browserVer = verString;
	}
	verIndex = browserVer.indexOf("Gold");
	if (verIndex > 0) 
	{
		var verString = browserVer.substring(0, verIndex);
		browserVer = verString;
	}
	else 
	{
		verIndex = browserVer.indexOf("b");
		if (verIndex > 0) 
		{
			var verString = browserVer.substring(0, verIndex);
			browserVer = verString;
		}
	}
}
else 
{
	browserVer = parseInt(navigator.appVersion);
}
	
if (browserName == "Netscape" && browserVer <= 4.05) browserOK = 0;
else if (browserName == "Microsoft Internet Explorer" && (browserVer == "4.01" || browserVer == "4.5")) 
{ 
		if ((navigator.appVersion.indexOf("Macintosh") >= 0) || (navigator.appVersion.indexOf("Mac_") >= 0)) 
		{
			browserOK = 0;
		}
}


//
//  Commented out because we do not want to redirect the audience anywhere if they are not compatible
//
//if (!(browserOK) && (document.cookie.length > 0)) 
//{
//	var browsersplash = parseInt(GetCookie("browsersplash"))
//	if (browsersplash == 0) 
//	{
//		SetCookie ("browsersplash",1,"","/");
//		self.location.href = 'notice.htm';
//	}
//}

//------------------------End of UnUsed Code-----------------------------------------------------------------------

//*********************************************
// DYNAMIC HTML POPUP MENU VARIABLES         //
//*********************************************

// ESTABLISH BROWSER VERSION
var n = (navigator.appName == "Netscape")
var n4 = (document.layers) ? 1:0
var ie = (navigator.appName == "Microsoft Internet Explorer")
var ie4 = (document.all) ? 1:0


//******************************************************************************
//  Validate browser for SIDE MENU rollovers                                  //
//******************************************************************************

var rolloversOK = 0;
browserVer = parseInt(navigator.appVersion);
if (n && browserVer >= 3)
{
	rolloversOK = 1;
}
else if (ie && browserVer >= 4)
{
	rolloversOK = 1;
}

var stylerollOK = 0;
if (n)
{
	stylerollOK = 0;
}
else if (ie && browserVer >= 4)
{
	stylerollOK = 1;
}

//*****************************************************************************
//  Continue testing for dynamic compliance                                  //
//*****************************************************************************

if (n4) {
	// Test for Unix NS4 version and don't allow DHTML elements in it
	if (navigator.appVersion.indexOf("X11") >= 0) 
	{
		n4 = 0;
	}
}
else if (ie4) 
{
	// Test for Mac IE4 version and don't allow DHTML elements in it
	if ((navigator.appVersion.indexOf("Macintosh") >= 0) || (navigator.appVersion.indexOf("Mac_") >= 0)) 
	{
		ie4 = 0;
	}
}

var version = "no";
var top_adjust = 0;
var offset;
var browserWidth;
var browserOffset;
var pageWidth = 600;

if (n4) 
{
	version = "ok";
	top_adjust = 0;
} 
else if (ie4) 
{
	version = "ok";
	top_adjust = 8;
}


//***********************************************************************
//                     Dynamic HTML Popup Menu Code                    //
//***********************************************************************

// SET-UP POPUP MENU VARIABLES
var totalMenus = 1
var menuPosX = 97
var menuPosY = new Array(totalMenus)
var itemsOnMenu = new Array(totalMenus)
var menuItems = new Array(totalMenus)
var urlLinks = new Array(totalMenus)
var lastMenu = -99
var lastHotItem = -99
var bgHot = "#EFECE5"
var bgNormal = "#DED8CA"
// MENU 0: PERSONAL FINANCIAL SERVICES
menuPosY[0] = 97 + top_adjust;
itemsOnMenu[0] = 7
menuItems[0] = new Array(itemsOnMenu[0])
urlLinks[0] = new Array(itemsOnMenu[0])
menuItems[0][0] = "Commerce Home"
menuItems[0][1] = "Business"
menuItems[0][2] = "Vacation"
menuItems[0][3] = "Entertainment Ind."
menuItems[0][4] = "Communities"
menuItems[0][5] = "Employment"
menuItems[0][6] = "Contact US"
urlLinks[0][0] = "http://www.nccommerce.com/"
urlLinks[0][1] = "http://www.nccommerce.com/categories/business.htm"
urlLinks[0][2] = "http://www.visitnc.com"
urlLinks[0][3] = "http://www.nccommerce.com/categories/entertain.htm"
urlLinks[0][4] = "http://www.nccommerce.com/categories/communities.htm"
urlLinks[0][5] = "http://www.nccommerce.com/categories/employment.htm"
urlLinks[0][6] = "http://www.nccommerce.com/categories/contact.asp"

// POPUP MENU FUNCTIONS
//
// function to open popup menu
//

function doPopup (whichMenu, whichHotItem)
{
	if (version != "ok") 
	{
	return
	}

	// DO WE HAVE TO RE-DRAW THE MENU?
	newMenu = 0
	if (whichMenu != lastMenu) 
	{
		lastMenu = whichMenu
		newMenu = 1 
	} 
	else if (whichHotItem != lastHotItem) 
	{
		newMenu = 1
	}
	
	// RE-DO THE POPUP TABLE, IF NECESSARY
	if (newMenu) 
	{
		lastHotItem = whichHotItem
		popupWidth = "193"; insideWidth = "193";
		popupHeight = (itemsOnMenu[whichMenu] * 16)

		theTable  = '<table width=' + popupWidth + ' height=' + (popupHeight + 2) + ' cellpadding=0 cellspacing=0 border=0><tr><td>\n'
		//theTable += '<table align="center" valign="center" width=' + insideWidth + ' height=' + popupHeight + ' bgcolor=' + bgNormal + ' cellspacing=0 cellpadding=0 border=0>\n'
		//commented out this part, because it puts a "space" between the cells
		//theTable += '<tr><td width="100%" height="1" bgcolor="#404040"></td></tr>\n' //took out bgcolor=#000000 in tr
		for (x = 0; x < itemsOnMenu[whichMenu]; x++ ) 
		{
			bg2Use = bgNormal; class2Use = "notHot";

			if (x == whichHotItem)
			{ 
			bg2Use = bgHot; class2Use = "notHot"; 
			}
			theTable += '<tr bgcolor=' + bg2Use + '><td height=15><a onMouseOver="hidePopups()">&nbsp;</a><a href="' + urlLinks[whichMenu][x] + '" class="' + class2Use + '" onMouseOver="doPopup(' + whichMenu + ',' + x + ');">&nbsp;' + menuItems[whichMenu][x] + '</a></td><td><a onMouseOver="hidePopups()">&nbsp;</a></td></tr>\n'
			if (x != itemsOnMenu[whichMenu]) 
			{
			//commented out this part, because it puts a "space" between the cells
			//theTable += '<tr><td width="100%" height="1" bgcolor="#404040" colspan="2"></td></tr>\n'  //took out bgcolor=#000000 in tr
			}
		}
		//inserted a row on the very bottom of the table to put a link.  the link color is the same as the background color.  purpose: to close menu.
		theTable += '<tr><td colspan="2" bgcolor="#336699"><a id="exit" class="exit" href="#" onClick="hidePopups()" >&nbsp;&nbsp;&nbsp;Close Menu</font></a></td></tr></table></td></tr></table>\n'

		if (n4) 
		{
			//
			// Commented out instead of deleted incase we ever center a page in the future
			//
			//browserWidth = window.innerWidth;
			//browserOffset = 205;
			//if (browserWidth < pageWidth ) 
			//{
			//	browserWidth = pageWidth;
			//}
			//offset = (browserWidth - pageWidth)/2;
			//menuPosX = offset + browserOffset;
			menuPosX = 415;
			whichLayer = "nsPopup"
			document.layers[whichLayer].visibility = 'hide'
		    	document.layers[whichLayer].document.write(theTable)
			document.layers[whichLayer].document.close()
			if (whichHotItem == -1) 
			{
				document.layers["nsBuffer"].visibility = 'hide'
				document.layers["nsBuffer"].document.write(theTable)
				document.layers["nsBuffer"].document.close()
				document.layers["nsBuffer"].moveTo(menuPosX, menuPosY[whichMenu])
				document.layers["nsBuffer"].visibility = 'show'
			}
			document.layers[whichLayer].moveTo(menuPosX, menuPosY[whichMenu])
			document.layers[whichLayer].visibility = 'show'
		}
		else if (ie4) 
		{
                        //
			// Commented out instead of deleted incase we ever center a page in the future
			//
			//browserWidth = parseInt(document.body.offsetWidth);
			//browserOffset = 205;
			//if (browserWidth < pageWidth )
			//{
			//	browserWidth = pageWidth;
			//}
			//offset = (browserWidth - pageWidth)/2;
			//menuPosX = offset + browserOffset;
			menuPosX = 417;
			whichLayer = "iePopup"
			document.all[whichLayer].innerHTML = theTable
			document.all[whichLayer].style.posLeft = menuPosX
			document.all[whichLayer].style.posTop = menuPosY[whichMenu]
			document.all[whichLayer].style.visibility = 'visible'
		}
	}
}

//
// function to hide the popup window
// called from mouseovers inside of the <a> tag
//

function hidePopups () 
{
  if (version != "ok") 
  {
	return
  }
  lastMenu = -99
  lastHotItem = -99
  if (n4) 
  {
  	document.layers["nsPopup"].visibility = "hide";
  	document.layers["nsBuffer"].visibility = "hide";
  }
  else if (ie4) 
  { 
	document.all["iePopup"].style.visibility = 'hidden';
  }
}

//***********************************************************************
//                  End Dynamic HTML Popup Menu Code                   //
//***********************************************************************


//***********************************************************************
//                    Mouseovers for the side menu                     //
//***********************************************************************


function imgInact(imgName)
{
	if (rolloversOK == 1)
	{
		document.images[imgName].src = eval(imgName + "off.src");
	}
}

function imgAct(imgName)
{
	if (rolloversOK == 1)
	{
		document.images[imgName].src = eval(imgName + "on.src");
	}
}

//***************************************************************
//                      End Mouseovers                         //
//***************************************************************


//**********************************************************************************
// function for alternate dropdown menu when viewed with browser less than 4.0    //
//**********************************************************************************
//
// this function takes a filename value, tacks on a file type extension,
// and goes to it
//
function goPage(thisDest) 
{
if (thisDest == 'comhome') 
	{
		htmlDest = 'http://www.nccommerce.com';
	}
else if (thisDest == 'busrec')
	{
		htmlDest = 'http://www.investnc.com';
	}
else if (thisDest == 'ncvis')
	{
		htmlDest = 'http://www.visitnc.com';
	}
else if (thisDest == 'govtech')
	{
		htmlDest = 'http://www.its.state.nc.us';
	} 
else 
	{
		htmlDest = thisDest;
	}
	if(thisDest != 'index') 
	{
		window.top.location = htmlDest;
	}
}

//
//************************************************************
// End function                                             //
//************************************************************


