/* 

#########################################################################

# Freight Centre CUSTOM CLIENT-SIDE MENU SYSTEM || JAVASCRIPT DEFINITIONS #

#########################################################################

******* 1st Level Sub-Option Definitions ********
These are defined in the header.jsp page.

******* 2nd Level Sub-Option Definitions ********
?RowOptions - Collection of text content corresponding to the 2nd level navigation node.
?RowWidths - Collection of widths corresponding to the 2nd level navigation node.
?SubRowOptions - Collection of 3rd level text contents. ('' if a not valid)
?SubRowWidths - Collection of 3rd level widths. ('' if a not valid)
?Links - Collection of 3rd level links that the corresponding node will redirect to ('' if a link is not desired)
?Options - Collection of all the information above including the 3rd level information.

******* 3rd Level Sub-Option Definitions ********\\
?Strings - Text content of the 3rd level navigation node.
?Links - Links that the corresponding node will redirect to ('' if a link is not desired)
?Widths - Width of the corresponding node.

NOTE: 3rd level nodes must be defined before the 2nd level '?Options' variable can be defined.
*/


var BGCOLOR_LEVEL_1_SELECTED = "#FFFF00";
var BGCOLOR_LEVEL_1_UNSELECTED = "#1F275F";
var FONT_COLOR_LEVEL_1_SELECTED = "#484848";
var FONT_COLOR_LEVEL_1_UNSELECTED = "#FFFFFF";
var BGCOLOR_LEVEL_2_SELECTED = "#A3A7C2";
var BGCOLOR_LEVEL_2_UNSELECTED = "#55608A";
var BGCOLOR_LEVEL_3_SELECTED = "#ECEDF2";
var BGCOLOR_LEVEL_3_UNSELECTED = "#A3A7C2";
var FONT_COLOR_LEVEL_3_SELECTED = "#484848";
var FONT_COLOR_LEVEL_3_UNSELECTED = "#FFFFFF";

//## DEFINITION START ##\\ 
var currentSelection = new Array(1, 0, 0);  // Selects the 1st top level node and nothing else.
var i,    // Temporary variable for looping


//******* HOME - 3rd Level Sub-Option Definitions - (Open an Account) *******\\
homopenStrings = new Array( '', 'Business Registration', '|', 'Security Features', '|', 'Implementation Support', '|', 'Accreditation Program' ),
homopenLinks = new Array( '', '/business_registration.jsp', '', '/ContactUs/advertisingenquiries.jsp', '', '/ContactUs/contacttruckersedge.jsp', '', '/ContactUs/contactaccreditation.jsp' ),
homopenWidths = new Array( 20, 125, 1, 105, 1, 133, 1, 128 ),
custServiceStrings = new Array( '', 'Carrier Tools Support', '|', 'Website Enquiries', '|', 'Feedback', '|', 'Forgotten Passwords', '|', 'Media Relations', '|', 'Shipping Desk Support', '|', 'Technical Problems' ),
custServiceLinks = new Array( '', '/ContactUs/carriertoolsupport.jsp', '', '/ContactUs/generalenquiries.jsp', '', '/ContactUs/resolvecomplaints.jsp', '', '/forgottenpassword.jsp', '', '/ContactUs/mediaenquiries.jsp', '', '/ContactUs/shippersupport.jsp', '', '/ContactUs/technicalenquiries.jsp' ),
custServiceWidths = new Array( 50, 185, 1, 155, 1, 85, 1, 175, 1, 135, 1, 190, 1, 160 ),
transServicesStrings = new Array( '', 'Introduction', '|', 'Freight Centre&trade; Shipping Desk', '|', 'Freight Centre&trade; Carrier Tools' ),
transServicesLinks = new Array( '', '/AboutUs/products_services.jsp', '', '/AboutUs/shipping_desk.jsp', '', '/AboutUs/carrier_tools.jsp' ),
transServicesWidths = new Array( 150, 80, 1, 173, 1, 170 ),
aboutUsStrings = new Array( '', 'Company Profile', '|', 'Our Values', '|', 'News &amp; Events', '|', 'Our People', '|', 'Customers', '|', 'Carrier Opportunites', '|', 'Affiliate Services' ),
aboutUsLinks = new Array( '', '/AboutUs/aboutus-overview.jsp', '', '/AboutUs/ourvalues.jsp', '', '/AboutUs/newsevents.jsp', '', '/AboutUs/ourpeople.jsp', '', '/AboutUs/customers.jsp', '', '/AboutUs/careeropportunities.jsp', '', '/AboutUs/representatives.jsp' ),
aboutUsWidths = new Array( 25, 100, 1, 75, 1, 97, 1, 75, 1, 70, 1, 115, 1, 100 ),

homeRowWidths = new Array( 15, 120, 90, 110, 80 ),
homeRowOptions = new Array( '', 'Open an Account', 'Contact Us', 'Our Services', 'About Us' ),
homeRowLinks = new Array( '', '/openanaccount.jsp', '', '', '' ),
homeSubRowOptions = new Array( '', homopenStrings, custServiceStrings, transServicesStrings, aboutUsStrings ),
homeSubRowWidths = new Array( '', homopenWidths, custServiceWidths, transServicesWidths, aboutUsWidths ),
homeLinks = new Array( '', homopenLinks, custServiceLinks, transServicesLinks, aboutUsLinks ),
homeOptions = new Array( homeRowOptions, homeSubRowOptions, homeLinks, homeRowWidths, homeSubRowWidths, homeRowLinks ),


//******* Accounts - Sub-Option Definitions *******\\
accRecordsStrings = new Array( '', 'View Account Balance', '|', 'Account Activity Information' ),
accRecordsLinks = new Array( '', '/accountstatement.jsp', '', '/accountstatement.jsp' ),
accRecordsWidths = new Array( 20, 135, 1, 160 ),
invPaymentsStrings = new Array( '', 'Add User Profile', '|', 'Account User Profiles', '|', 'Change My Password' ),
invPaymentsLinks = new Array( '', '/accountuserregistration.jsp', '', '/accountusers.jsp', '', '/changepassword.jsp' ),
invPaymentsWidths = new Array( 60, 95, 1, 125, 1, 125 ),
accDetailsStrings = new Array( '', 'Change Account Details', '|', 'Account Contact Information' ),
accDetailsLinks = new Array( '', '/companyregistration.jsp', '', '/companyregistration.jsp' ),
accDetailsWidths = new Array( 235, 140, 1, 160 ),

accountRowWidths = new Array( 15, 135, 110, 160 ),
accountRowOptions = new Array( '', 'Account Records', 'User Access', 'Business Registration' ),
accountRowLinks = new Array( '', '/accountstatus.jsp', '/accountstatus.jsp', '/accountstatus.jsp' ),
accountSubRowOptions = new Array( '', accRecordsStrings, invPaymentsStrings, accDetailsStrings, custServiceStrings ),
accountSubRowWidths = new Array( '', accRecordsWidths, invPaymentsWidths, accDetailsWidths, custServiceWidths ),
accountLinks = new Array( '', accRecordsLinks, invPaymentsLinks, accDetailsLinks, custServiceLinks ),
accountOptions = new Array( accountRowOptions, accountSubRowOptions, accountLinks, accountRowWidths, accountSubRowWidths, accountRowLinks ),


//******* Carrier Tools - Sub-Option Definitions *******\\
controlPanelStrings = new Array( '', 'Site Locations', '|', 'Service Regions', '|', 'Transit Routes', '|', 'Service Schedules', '|', 'Carrier Profile' ),
controlPanelLinks = new Array( '', '/carriersitelocations.jsp', '', '/carrierserviceareas.jsp', '', '/carriertransitroutes.jsp', '', '/carrierserviceschedules.jsp', '', '/carrierregistration.jsp' ),
controlPanelWidths = new Array( 20, 90, 1, 100, 1, 85, 1, 110, 1, 95 ),
transportManagmentStrings = new Array( '', 'Pickup Requests', '|', 'Confirmed Orders', '|', 'Completed Orders' ),
transportManagmentLinks = new Array( '', '/carrierpickuprequests.jsp', '', '/carrierconfirmedorders.jsp', '', '/carriercompletedorders.jsp' ),
transportManagmentWidths = new Array( 100, 100,  1, 105, 1, 105 ),
customerRecordsStrings = new Array( '', 'Add Shipper to List / Activate Account', '|', 'Customer (Account) Records' ),
customerRecordsLinks = new Array( '', '/tradingpartnerregistration.jsp?tp=1&cp=1&referer=/accountstatuscarrier.jsp', '', '/carriercustomerrecords.jsp' ),
customerRecordsWidths = new Array( 260, 280, 1, 165),
messagingStrings = new Array( '', 'Job Availability' ),
messagingLinks = new Array( '', '/searchforload.jsp' ),
messagingWidths = new Array( 460, 110 ),


carrierRowWidths = new Array( 15, 145, 168, 145, 105 ),
carrierRowOptions = new Array( '', 'Service Information', 'Transport Management', 'Customer Records', 'Search Tools' ),
carrierRowLinks = new Array( '', '/accountstatuscarrier.jsp', '/accountstatuscarrier.jsp', '/accountstatuscarrier.jsp', '/accountstatuscarrier.jsp' ),
carrierSubRowOptions = new Array( '', controlPanelStrings, transportManagmentStrings, customerRecordsStrings, messagingStrings ),
carrierSubRowWidths = new Array( '', controlPanelWidths, transportManagmentWidths, customerRecordsWidths, messagingWidths),
carrierLinks = new Array( '', controlPanelLinks, transportManagmentLinks, customerRecordsLinks, messagingLinks ),
carrierOptions = new Array( carrierRowOptions, carrierSubRowOptions, carrierLinks, carrierRowWidths, carrierSubRowWidths, carrierRowLinks ),


//******* Shipper Tools - Sub-Option Definitions *******\\
scontrolPanelStrings = new Array( '', 'Site Locations', '|', 'Shipment Units', '|', 'Billing Addresses', '|', 'Shipper Profile' ),
scontrolPanelLinks = new Array( '', '/shippersitelocations.jsp', '', '/shipmentunits.jsp', '', '/billingaddressbook.jsp', '', '/shipperregistration.jsp' ),
scontrolPanelWidths = new Array( 20, 90, 1, 90, 1, 105, 1, 90 ),
stransportManagmentStrings = new Array( '', 'Create Job Order', '|', 'Unassigned Job Orders', '|', 'Quote Requests', '|', 'Freight Quotations', '|', 'Pickup Requests', '|', 'Assigned Orders', '|', 'Completed Orders' ),
stransportManagmentLinks = new Array( '', '/shipmentdetailregistration.jsp', '', '/shipperunassignedorders.jsp', '', '/shipperquoterequests.jsp', '', '/shipperfreightquotes.jsp', '', '/shipperpickuprequests.jsp', '', '/shipperassignedorders.jsp', '', '/shippercompletedorders.jsp' ),
stransportManagmentWidths = new Array( 30, 125, 1,  155, 1, 110, 1, 120, 1, 110, 1, 115, 1, 120 ),
scarrierRecordsStrings = new Array( '', 'Add Carrier to List / Authorise Account', '|', 'Carrier Account Records'),
scarrierRecordsLinks = new Array( '', '/tradingpartnerregistration.jsp?tp=1&referer=/accountstatusshipper.jsp', '', '/shippercustomerrecords.jsp'),
scarrierRecordsWidths = new Array( 250, 235, 1, 170 ),
scustServiceStrings = new Array( '', 'Uncommitted Cargo Capacity', '|', 'Carrier Services and Schedules'  ),
scustServiceLinks = new Array( '', '/searchforequipment.jsp', '', '/searchforcarrier.jsp' ),
scustServiceWidths = new Array( 330, 160, 1, 175 ),

shipperRowWidths = new Array( 15, 155, 175, 125, 110 ),
shipperRowOptions = new Array( '', 'Service Information', 'Transport Management', 'Carrier Records', 'Search Tools' ),
shipperRowLinks = new Array( '', '/accountstatusshipper.jsp', '/accountstatusshipper.jsp', '/accountstatusshipper.jsp', '/accountstatusshipper.jsp' ),
shipperSubRowOptions = new Array( '', scontrolPanelStrings, stransportManagmentStrings, scarrierRecordsStrings, scustServiceStrings ),
shipperSubRowWidths = new Array( '', scontrolPanelWidths, stransportManagmentWidths, scarrierRecordsWidths, scustServiceWidths ),
shipperLinks = new Array( '', scontrolPanelLinks, stransportManagmentLinks, scarrierRecordsLinks, scustServiceLinks ),
shipperOptions = new Array( shipperRowOptions, shipperSubRowOptions, shipperLinks, shipperRowWidths, shipperSubRowWidths, shipperRowLinks ),

//******* Tradepay- Sub-Option Definitions *******\\
tradepayStrings = new Array( '' ),
tradepayLinks = new Array( '' ),
tradepayWidths = new Array( 20 ),

tradepayRowWidths = new Array( 15 ),
tradepayRowOptions = new Array( '' ),
tradepayRowLinks = new Array( '' ),
tradepaySubRowOptions = new Array( '' ),
tradepaySubRowWidths = new Array( '' ),
tradepayLinks = new Array( '' ),
tradepayOptions = new Array( tradepayRowOptions, tradepaySubRowOptions, tradepayLinks, tradepayRowWidths, tradepaySubRowWidths, tradepayRowLinks ),

//******* Bureau Services - Sub-Option Definitions *******\\
scontrolPanelStrings = new Array( '', 'third line 1', '|', 'third line 2', '|', 'third line 3' ),
scontrolPanelLinks = new Array( '', '/shipmentdetailregistration.jsp', '', '/shippersitelocations.jsp', '', '/shipperregistration.jsp' ),
scontrolPanelWidths = new Array( 20, 120, 1, 90, 1, 115 ),

stransportManagmentStrings = new Array( '', 'third line 4', '|', 'third line 5', '|', 'third line 6', '|', 'third line 7', '|', 'third line 8' ),
stransportManagmentLinks = new Array( '', '/shipperunassignedorders.jsp', '', '/shipperpickuprequests.jsp', '', '/shipperquoterequests.jsp', '', 'shipperassignedorders.jsp', '', 'shippercompletedorders.jsp' ),
stransportManagmentWidths = new Array( 90, 115, 1, 95, 1, 100, 1, 105, 1, 110 ),

scarrierRecordsStrings = new Array( '', 'third line 9', '|', 'third line 10', '|', 'third line 11' ),
scarrierRecordsLinks = new Array( '', '/shippercustomerrecords.jsp', '', '/shipperinvoicerecords.jsp', '', '/shippershipmentrecords.jsp' ),
scarrierRecordsWidths = new Array( 250, 145, 1, 95, 1, 100 ),

smessagingStrings = new Array( '', 'third line 12', '|', 'third line 13', '|', 'third line 14', '|', 'third line 15' ),
smessagingLinks = new Array( '', '/msginbox.jsp', '', '/msgsentbox.jsp', '', '', '', '/sendmessage.jsp' ),
smessagingWidths = new Array( 360, 50, 1, 55, 1, 60, 1, 90 ),

ssearchToolsStrings = new Array( '', 'third line 16', '|', 'third line 17', '|', 'third line 18', '|', 'third line 19' ),
ssearchToolsLinks = new Array( '', '/shipmenttracking.jsp', '', '/carriertools.jsp?page=equipment', '', '/positionmonitoringservice.jsp', '', '/configurationsettings.jsp' ),
ssearchToolsWidths = new Array( 260, 110, 1, 105, 1, 110, 1, 125  ),		

scustServiceStrings = new Array( '', 'third line 20', '|', 'third line 21', '|', 'third line 22', '|', 'third line 23'  ),
scustServiceLinks = new Array( '', '/stradingpartnerregistration.jsp', '', '/carriershipmentsearch.jsp', '', '/shipperequipmentsearchclasses.jsp', '', '/shipperservicetypesearch.jsp' ),
scustServiceWidths = new Array( 430, 85, 1, 70, 1, 90, 1, 95 ),

mediationRowWidths = new Array( 15, 155, 168, 120, 95, 138, 110 ),
mediationRowOptions = new Array( '', 'second line 1', 'second line 2', 'second line 3', 'second line 4', 'second line 5', 'second line 6' ),
mediationRowLinks = new Array( '', '/accountstatusshipper.jsp', '/accountstatusshipper.jsp', '/accountstatusshipper.jsp', '/accountstatusshipper.jsp', '/accountstatusshipper.jsp', '' ),
mediationSubRowOptions = new Array( '', scontrolPanelStrings, stransportManagmentStrings, scarrierRecordsStrings, smessagingStrings, ssearchToolsStrings, scustServiceStrings ),
mediationSubRowWidths = new Array( '', scontrolPanelWidths, stransportManagmentWidths, scarrierRecordsWidths, smessagingWidths, ssearchToolsWidths, scustServiceWidths ),
mediationLinks = new Array( '', scontrolPanelLinks, stransportManagmentLinks, scarrierRecordsLinks, smessagingLinks, ssearchToolsLinks, scustServiceLinks ),
mediationOptions = new Array( mediationRowOptions, mediationSubRowOptions, mediationLinks, mediationRowWidths, mediationSubRowWidths, mediationRowLinks ),


//******* Array containing all Sub-Option Definitions *******\\
menuRow1Options = new Array( homeOptions, accountOptions, carrierOptions, shipperOptions, tradepayOptions, mediationOptions );

//## DEFINITION END ##\\



//## METHODS START ##\\

/* Name    : menuselect1
   Purpose : Selects the desired 1st level navigation node and populates it's sub-levels.
   Inputs  : column (The 1st level navigation node to be selected (keeping in mind that 2,4,6,etc are not proper nodes)) */
function menuselect1(column) {
	if( currentSelection[0] == column ) return;
	unselectRow1();
	currentSelection[0] = column;
	selectRow1();
	if( menuRow1Options[(currentSelection[0]-1)/2] == '' ) {
		fillRow2('');
		fillRow3('');
		return;
	}
	fillRow2(menuRow1Options[(currentSelection[0]-1)/2][0], menuRow1Options[(currentSelection[0]-1)/2][3], menuRow1Options[(currentSelection[0]-1)/2][5]);
	selectRow2();
	if( menuRow1Options[(currentSelection[0]-1)/2][1][currentSelection[1]] == '' ) {
		fillRow3('');
		return;	
	}
	fillRow3(menuRow1Options[(currentSelection[0]-1)/2][1][currentSelection[1]], menuRow1Options[(currentSelection[0]-1)/2][4][currentSelection[1]]);
}

/* Name    : unselectRow1
   Purpose : Unselects the currently selected 1st level navigation node. */
function unselectRow1() {
	var r = document.getElementById("header1table").rows[1];
	var c = r.cells[currentSelection[0]];
	c.setAttribute("bgColor", BGCOLOR_LEVEL_1_UNSELECTED);
	for( i = 0; i < c.childNodes[0].childNodes.length; i++ ) {
		if( c.childNodes[0].childNodes[i].tagName == "FONT" ) {
			c.childNodes[0].childNodes[i].setAttribute("color", FONT_COLOR_LEVEL_1_UNSELECTED);
		}
	}
	c = r.cells[currentSelection[0] + 1];
	c.setAttribute("align", "center");
	if( currentSelection[0] != 15 )
		c.innerHTML = '<font color="#FFFFFF"><strong>|</strong></font>';
	else
		c.innerHTML = '';
	c = r.cells[currentSelection[0] - 1];
	c.setAttribute("align", "center");
	if( currentSelection[0] != 1 )
		c.innerHTML = '<font color="#FFFFFF"><strong>|</strong></font>';
	else
		c.innerHTML = '';
}

/* Name    : selectRow1
   Purpose : This is the real method that highlights the currently selected 1st level navigation node. */
function selectRow1() {
	var r = document.getElementById("header1table").rows[1];
	var c = r.cells[currentSelection[0]];
	c.setAttribute("bgColor", BGCOLOR_LEVEL_1_SELECTED);
	for( i = 0; i < c.childNodes[0].childNodes.length; i++ ) {
		if( c.childNodes[0].childNodes[i].tagName == "FONT" ) {
			//alert("setting select font color");
			c.childNodes[0].childNodes[i].setAttribute("color", FONT_COLOR_LEVEL_1_SELECTED);
			break;
		}
	}
	c = r.cells[currentSelection[0] + 1];
	c.setAttribute("align", "left");
	c.innerHTML = '<img src="/images/yellowright.gif"/>';
	c = r.cells[currentSelection[0] - 1];
	c.setAttribute("align", "right");
	c.innerHTML = '<img src="/images/yellowleft.gif"/>';
}

/* Name    : menuselect2
   Purpose : Selects the desired 2nd level navigation node and populates it's sub-level.
   Inputs  : column (The 2nd level navigation node to be selected (keeping in mind that 2,4,6,etc are not proper nodes)) */
function menuselect2(column) {
	if( currentSelection[1] == column ) return;
	unselectRow2();
	currentSelection[1] = column;
	selectRow2();
	if( menuRow1Options[(currentSelection[0]-1)/2][1][currentSelection[1]] == '' ) {
		fillRow3('');
		return;	
	}
	fillRow3(menuRow1Options[(currentSelection[0]-1)/2][1][currentSelection[1]], menuRow1Options[(currentSelection[0]-1)/2][4][currentSelection[1]]);
}

/* Name    : unselectRow2
   Purpose : Unselects the currently selected 2nd level navigation node. */
function unselectRow2() {
	var r, c;	
	r = document.getElementById("header2table").rows[1];
	c = r.cells[currentSelection[1]];
	if( c != null ) {
		c.setAttribute("bgColor", BGCOLOR_LEVEL_2_UNSELECTED);
		if( c.childNodes[0] != null )
			c.childNodes[0].setAttribute("src", "/images/arrowright.gif");
	}
}

/* Name    : selectRow2
   Purpose : This is the real method that highlights the currently selected 2nd level navigation node. */
function selectRow2() {
	var r = document.getElementById("header2table").rows[1];
	var c = r.cells[currentSelection[1]];
	if( c != null ) {
		c.setAttribute("bgColor", BGCOLOR_LEVEL_2_SELECTED);
		if( c.childNodes[0] != null )
			c.childNodes[0].setAttribute("src", "/images/arrowdown.gif");
	}
}

/* Name    : fillRow2
   Purpose : Populates the 2nd level navigation with the relevant navigation nodes.
   Inputs  : menuOptions - Array of text content for the 2nd level navigation nodes.
             menuWidths - Array of widths for the 2nd level navigation nodes.
			 menuLinks - Array of links for the 2nd level navigation nodes. */
function fillRow2(menuOptions, menuWidths, menuLinks) {
	var t = document.getElementById("header2table"), total = 0;
	while( t.childNodes.length > 0 ) t.removeChild(t.childNodes[0]);
	if( menuOptions == '' ) return;
	var r = t.insertRow(0);
	var c = r.insertCell(0);
	c.setAttribute("colspan", menuOptions.length);
	c.setAttribute("height", 3);

	// Insert the 2nd (important row)
	r = t.insertRow(1);    

	// Insert the 1st cell (used as a spacer)
	c = r.insertCell(0);

	c.setAttribute("width", menuWidths[0]);
	c.setAttribute("height", 18);
	total += menuWidths[0];
	c.innerHTML = '&nbsp;';

	// Loop through and add the rest of the 2nd level items.
	for( i = 1; i < menuOptions.length; i++ ) {
		c = r.insertCell(i);
		c.setAttribute("align", "center");
		c.setAttribute("width", menuWidths[i]);
		total += menuWidths[i];
		c.setAttribute("id", i);
		c.onmouseover = function (event) { menuselect2(this.id) };
		c.onclick = function (event) { location = menuLinks[this.id]; };
		c.innerHTML = '<img src="/images/arrowright.gif"/>&nbsp;<font color="#FFFFFF"><strong>' + menuOptions[i] + '</strong></font>';
		c.style.cursor = "pointer";
	}

	// Add the final spacer cell.
	c = r.insertCell(i);
	c.setAttribute("width", 770 - total);
	c.innerHTML = '&nbsp;';
	// Set the selection of the 2nd level navigation to the first navigation node (2nd node actually (i think)).
	currentSelection[1] = 1;
}

/* Name    : menuselect3
   Purpose : Selects the desired 3rd level navigation node.
   Inputs  : column (The 3rd level node to be selected) */
function menuselect3(column) {
	if( currentSelection[2] == column ) return;
	unselectRow3();
	currentSelection[2] = column;
	selectRow3();
}

/* Name    : fillRow3
   Purpose : Populates the 3rd level navigation with the relevant navigation nodes.
   Inputs  : menuOptions - Array of text content for the 2nd level navigation nodes.
             menuWidths - Array of widths for the 2nd level navigation nodes. 
   NOTE    : Links are determined when the 3rd level navigation node is clicked. (activates the method at the bottom) */
function fillRow3(menuOptions, menuWidths) {
	var t = document.getElementById("header3table"), total;
	while( t.childNodes.length > 0 ) t.removeChild(t.childNodes[0]);
	if( menuOptions == '' ) return;
	r = t.insertRow(0);
	c = r.insertCell(0);
	c.setAttribute("width", menuWidths[0]);
	total += menuWidths[0];
	c.innerHTML = '&nbsp;';
	for( i = 1; i < menuOptions.length; i++ ) {
		c = r.insertCell(i);
		c.setAttribute("align", "center");
		c.setAttribute("width", menuWidths[i]);
		total += menuWidths[i];
		c.setAttribute("id", i);
		if( menuOptions[i] != '|' )
			c.onmouseover = function (event) { menuselect3(this.id) };
		if( menuRow1Options[(currentSelection[0]-1)/2][2][currentSelection[1]][i] != '' ) {
			c.onclick = function (event) { relocate() };
			c.innerHTML = '<a href="#" onclick="relocate()" class="mainnav3"><font color="#FFFFFF">' + menuOptions[i] + '</font><a>';
		} else if( menuOptions[i] == '|' ) {
			c.innerHTML = '<font class="HEA13ARN"><font color="#DDDDDD">' + menuOptions[i] + '</font></font>';
		} else
			c.innerHTML = '<font class="HEA13ARN"><font color="#FFFFFF">' + menuOptions[i] + '</font></font>';
	}
	c = r.insertCell(i);
	c.setAttribute("width", 770 - total);
	c.innerHTML = '&nbsp;';
	currentSelection[2] = 2;
}

/* Name    : unselectRow3
   Purpose : Unselects the currently selected 3rd level navigation node. */
function unselectRow3() {
	var r, c;	
	r = document.getElementById("header3table").rows[0];
	c = r.cells[currentSelection[2]];
	c.setAttribute("bgColor", BGCOLOR_LEVEL_3_UNSELECTED);
	if( c.childNodes[0].childNodes[0] != null )
		c.childNodes[0].childNodes[0].setAttribute("color", FONT_COLOR_LEVEL_3_UNSELECTED);
}

/* Name    : selectRow3
   Purpose : This is the real method that highlights the currently selected 3rd level navigation node. */
function selectRow3() {
	var r = document.getElementById("header3table").rows[0];
	var c = r.cells[currentSelection[2]];
	c.setAttribute("bgColor", BGCOLOR_LEVEL_3_SELECTED);
	if( c.childNodes[0].childNodes[0] != null )
		c.childNodes[0].childNodes[0].setAttribute("color", FONT_COLOR_LEVEL_3_SELECTED);
}

/* Name    : relocate
   Purpose : Redirects the user to the currently selected 3rd level navigation nodes link. */
function relocate() {
	location = menuRow1Options[(currentSelection[0]-1)/2][2][currentSelection[1]][currentSelection[2]];
}