/*
'**************************************************************************'
' COPYRIGHT                                                                '
' UNITED BUILDING CENTERS                                                  '
' 125 WEST FIFTH STREET                                                    '
' WINONA, MN 55987-9985                                                    '
'**************************************************************************'
' PURPOSE: Build a dynamic menu system user control.                       '
'**************************************************************************'
' VERSION 01: KLR - 03-10-06 - Initial Build                               '
' VERSION 01: KLR - 06-23-06 - RFS 2006-135                                '
'                              Added this Versioning Documentation.        '
' VERSION 02: KLR - 10-12-06 - Assign text color on page load.             '
'                              Passing in menuID to determine requirements '
'                              based on what menu is being built.
'**************************************************************************'*/

/* iubito's menu - http://iubito.free.fr/prog/menu.php - javascript configuration */

/* true = to make menu vertical, on left.
   false = to make menu horizontal, on top */
// var vertical = false;

/* VERY IMPORTANT !
It's needed to assign in this variable number of menus, javascript code is not
capable of calculating itself :-p So if your html code goes until <p id="menu5"...> you have to assign 5. */
/* VERY IMPORTANT 2 by Bogac
I disabled this variable because my asp .net code will calculate number of menus and
generate required javascript code with this variable there */
// var nbmenu = 3;

/* Center the menu ? (true/false).
	Center vertically or horizontaly; according to chosen layout */
// var centrer_menu = false;

/* It's needed to define width for manus.
	To make them in different widths :
	var largeur_menu = new Array(largeur menu1, largeur menu2, largeur menu3...)
	You have to assign in that array as much values as number of menus !
	Attention, if you are in vertical mode, use fixed width (No Array) !
	*/
// var largeur_menu = 95;

/* In vertical mode, we've got to know height of each menu.
	Even if "boxes" are not measured in height. (Bogac's note: just translated, didn't really get)
	Add this variable where menus are too near each other in vertical mode.
	To make them in different heights:
	var hauteur_menu = new Array(hauteur menu1, hauteur menu2, hauteur menu3...)
	You have to assign in that array as much values as number of menus !
	Attention, if you are in horizontal mode, use fixed width (No Array) !
	*/
// var hauteur_menu = 25;

/* In horizontal mode.
	Width of sub-menus, for IE only, other browsers respect auto-width
	Use "auto" only if you are sure to have used &nbsp; instead of spaces in items.
	To make sub-menus in different widths :
	var largeur_sous_menu = new Array(largeur1, largeur2...).
	You have to assign in that array as much values as number of menus !
	If a menu doesn't have a sub-menu, still need to assign something !
	It's possible to use "auto" for some colums respecting the rule above.
	*/
//var largeur_sous_menu = 140;  //4-18-2006. Set this value in menu.ascx.vb. Read value in from database.

/* For browsers with automatic width capability (addapted by content), this
	option (active by default) let us get an automatic width. Other case
	(false), sub-menus will have value of largeur_sous_menu. 
	3-17-2006 - KLR - changed to false so the width of the sub menu would be the
	 same for all sub menus and not sized according to the length of the menu title.*/
var largeur_auto_ssmenu = false;  //set to true for auto width for sub menu, set to false for fixed width. 
/* ... to get some space between menus ! */
var espace_entre_menus = 5;

/* position of menu by top of page
	0 = menu at very top. in px */
//var top_menu = 2;  //commented out 4-12-2006
var top_menu = 0;

/* Position by left of screen, in px. */
//var left_menu = 10;
var left_menu = 10;  //4-12-2006
/* In vertical mode.
	Position of submenus by left of screen, in px */
var left_ssmenu = largeur_menu+6;

/* Users might feel uncomfortable if submenu vanishes instantly, also bad for users with small screen like Palms,
	We can have a delay before submenu dissapears.
	500 ms is fine :-) */
var delai = 30; // in miliseconds

/* In horizontal mode.
	As it is possibe for page's content superposed by menu content it's a good idea to
	lower page contents (or adding some top margin for page content)
	about forty pixels would do the job. in px*/
//var marge_en_haut_de_page = top_menu + 40;
var marge_en_haut_de_page = top_menu;
/* In vertical mode.
	We move document to right so that its content doesn't get superposed by menu */
//var marge_a_gauche_de_la_page = largeur_menu + 10;  //commented out 4-12-2006
;

/* Put "true" if you want menu to be always visible.
	Put "false" if you don't want so. In that case when you move the page lower
	menu will disappear	*/
// var suivre_le_scroll=true;

/* Only for IE, <select> tags always get above of menu, so by default we hide dropdown list
	when menu is open, then we make them appear when menu is closed
	To avoid that use "false" */
var cacher_les_select=true;

//Styles values are brought in from menu.ascx.vb. Variables are:
    //backgroundColor
    //backgroundImage
    //color
    //backgroundColorHover
    //backgroundImageHover
    //colorHover
    //subMenuBackgroundColor
    //subMenuBackgroundColorHover
    //subMenuTextColor
    //subMenuTextColorHover
   //SubMenuFontSize
   //MainMenuFontSize
   //TopMenuHeight; V03: 10-15-2006. Added in this variable to allow height adjustment to top menu item. (added in Menu2.ascx.vb code)
   //menuID 'V02: passing in menuID to determine some differences that are required based on the menu being built.
//nbsubMenus_2 holds number of subSubMenus
//nbSubMenus_3 holds number of menus that branch off of subSubMenus
//largeur_sous_menu

var IDofMenu = "noID"; //3-24-2006. Added to keep track of the main menu you're leaving
var timeout; //don't touch it, this is to declare the variable
var agt = navigator.userAgent.toLowerCase();
var isMac = (agt.indexOf('mac') != -1);
var isOpera = (agt.indexOf("opera") != -1);
var IEver = parseInt(agt.substring(agt.indexOf('msie ') + 5));
var isIE = ((agt.indexOf('msie')!=-1 && !isOpera && (agt.indexOf('webtv')==-1)) && !isMac);
var isIE5win = (isIE && IEver == 5);
var isIE5mac = ((agt.indexOf("msie") != -1) && isMac);
var blnOk=true;
//to erase "px"s when calculating
var reg = new RegExp("px", "g");

/* In horizontal mode.
	position of submenus by top of screen or page. You need to consider
	top of menus, so not to put 0, which will cause submenu on main menu. in px */
var top_ssmenu
if (isIE){
	//top_ssmenu=top_menu + 36;
	top_ssmenu=top_menu;
	//V03: 10-15-2006. Not adding a value to top_ssmenu anymore. Further down in code, I'm adding the (TopMenuHeight2 + 2) value
                              // to top_ssmenu2. This is to allow height of top menu item to be dynamic (determined by user). This is to accommodate graphics that may
                              // be used in the menu item that need to be bigger.
}else{
	//top_ssmenu=top_menu + 38;
	top_ssmenu=top_menu +2;
	//V03: 10-15-2006. Not adding a value to top_ssmenu anymore. Further down in code, I'm adding the (TopMenuHeight2 + 2) value
                              // to top_ssmenu2. This is to allow height of top menu item to be dynamic (determined by user). This is to accommodate graphics that may
                              // be used in the menu item that need to be bigger.
} 

// onScroll for Internet Explorer, position:fixed does same job in other browsers
// which are bount to CSS norms...
window.onscroll = function()
{
	if (blnOk && suivre_le_scroll && (isIE || isIE5mac))
	{
		if (isIE5mac) document.getElementById("conteneurmenu").style.visibility="hidden";
		var cumul=0;
		for(i=1;i<=nbmenu;i++)
		{
			if (!vertical) {
				document.getElementById("menu"+i).style.top = document.body.scrollTop + top_menu + "px";
				if (document.getElementById("ssmenu"+i)){//undefined
					//10-15-2006. commented out.document.getElementById("ssmenu"+i).style.top = document.body.scrollTop + top_ssmenu + "px";
					document.getElementById("ssmenu"+i).style.top = document.body.scrollTop + top_ssmenu+TopMenuHeight+2 + "px"; //V03: 10-15-2006. Added +TopMenuHeight+2
					}
			} else {
				document.getElementById("menu"+i).style.top = document.body.scrollTop
							+(((i-1)*espace_entre_menus)+cumul+1+top_menu)+"px";
				if (document.getElementById("ssmenu"+i)){//undefined
					document.getElementById("ssmenu"+i).style.top = document.body.scrollTop
							+(((i-1)*espace_entre_menus)+cumul+1+top_menu)+"px";
				cumul += isFinite(hauteur_menu)?hauteur_menu:hauteur_menu[i-1];}
			}
		}
		if (isIE5mac) document.getElementById("conteneurmenu").style.visibility="visible";
	}
}

//Hide the menu until it is built (comment added to this existing code)- klr - 3/15/2006.
function preChargement()
{
	if (document.getElementById("conteneurmenu"))
	{
		document.getElementById("conteneurmenu").style.visibility="hidden";
		//IE5 mac has a bug : when a text is in an element with float attribute, it's not visible
		/*if (isIE5mac)
		{
			document.getElementById("conteneurmenu").style="";
		}*/
	}
}

function Chargement() {
	if (!blnOk) {
		if(document.body.style.backgroundColor!="") { blnOk=false; }
		if(document.body.style.color!="") { blnOk=false; }
		//if(document.body.style.marginTop!="") { blnOk=false; }
		if(document.getElementById) {
			with(document.getElementById("conteneurmenu").style) {
				if(position!="" || top!="" || left!=""
						|| width!="" || height!="" || zIndex!=""
						|| margin!="" || visibility!="") {
					blnOk=false;
				}
			}
		}
		else{
			blnOk=false;
		}
	}
	if(blnOk)
	{
		document.getElementById("conteneurmenu").style.visibility="hidden";
		//trimespaces();
		with(document.body.style) {
			if (!vertical){
				//marginTop=marge_en_haut_de_page+"px";  //commented out 4-12-2006
			}else{
				 //marginLeft=marge_a_gauche_de_la_page+"px";  //commented out 4-12-2006
			}
		}
		positionne();
		CacherMenus();
	}
	// as we stopped flashing, now we can make menu appear ;-)
	document.getElementById("conteneurmenu").style.visibility='';
}
window.onresize = Chargement;

/*
 * Place elements of menu correctly, on load, on scroll, on redimension
 * of window
 */
function positionne() {
	var largeur_fenetre = (isIE?document.body.clientWidth:window.innerWidth);
	var hauteur_fenetre = (isIE?document.body.clientHeight:window.innerHeight);
	//4-5-2006 - klr - commented out code that centers the menu in the window.
	//if (centrer_menu) {
	//	if (!vertical) {
	//		var largeur_totale = espace_entre_menus * (nbmenu-1);
	//		if (isFinite(largeur_menu))
	//			largeur_totale += largeur_menu * nbmenu;
	//		else {
	//			for (i = 1; i <= nbmenu; i++)
	//				largeur_totale += largeur_menu[i-1];
	//		}
	//		left_menu = (largeur_fenetre - largeur_totale)/2;
	//	} else {
	//		var hauteur_totale = espace_entre_menus * (nbmenu-1);
	//		if (isFinite(hauteur_menu))
	//			hauteur_totale += hauteur_menu * nbmenu;
	//		else {
	//			for (i = 1; i <= nbmenu; i++)
	//				hauteur_totale += hauteur_menu[i-1];
	//		}
	//		top_menu = (hauteur_fenetre - hauteur_totale)/2;
	//	}
	//}
	
	//Menus
	var cumul = 0;
	for(i=1;i<=nbmenu;i++) {
		with(document.getElementById("menu"+i).style) {
			if (vertical || isFinite(largeur_menu)){
			   if (menuID==1||menuID==2){  //V02: only have to adjust the first main menu item if UBC menu (1) and CAP menu (2) (on the UBC site) being built.
					if (i==1){
						width=largeur_menu+13+"px";  //first main menu item is wider than the rest by 17 pixels.  //4-12-2006 adjusted to 11 
						height=TopMenuHeight+"px"; //V03: 10-15-2006. Need to adjust height of top menu item.
					}else{
						width=largeur_menu+"px";
						height=TopMenuHeight+"px"; //V03: 10-15-2006. Need to adjust height of top menu item.
					}
				}else{
					width=largeur_menu+"px";
				}
			}else{
				width=largeur_menu[i-1]+"px";
			}
			if (!vertical) {
				top=top_menu+"px";
				//left=(((i-1)*(largeur_menu+espace_entre_menus))+1+left_menu)+"px";
				if (menuID==1||menuID==2){  //V02: only have to adjust the first main menu item if UBC menu (1) and CAP menu (2) (on the UBC site) being built.
					if (i==1){
						left=(((i-1)*espace_entre_menus)+cumul-11+left_menu)+"px";  //4-12-2006 worked with this line of code trying to fix left positioning.
					}else{
						left=(((i-1)*espace_entre_menus)+cumul+1+left_menu)+4+"px";}
				}else{
					left=(((i-1)*espace_entre_menus)+cumul+1+left_menu)+4+"px";
				}
			} else {
				//top=(((i-1)*(hauteur_menu+espace_entre_menus))+1+top_menu)+"px";
				top=(((i-1)*espace_entre_menus)+cumul+1+top_menu)+"px";

				left=left_menu+"px";
			}
			if (!suivre_le_scroll || isIE || isIE5mac){
				position="absolute";
			}else{ position="fixed";
			//if (vertical) height=hauteur_menu+"px";
			margin="0";
			zIndex="2";}
			//moved 4-12-2006
			if ((!vertical && isFinite(largeur_menu)) || (vertical && isFinite(hauteur_menu))) {
				cumul += (!vertical?largeur_menu:hauteur_menu);
			}
			else {
				cumul += (!vertical?largeur_menu[i-1]:hauteur_menu[i-1]);
				if (vertical) height=hauteur_menu[i-1]+"px";
			}
		}
		
			//V02:10-12-2006. Set top menu text color to color
		  document.getElementById("menu"+i).style.color=color;
		  document.getElementById("menu"+i+"a").style.color=color;
		

			//4-6-2006
			//set font-size for main menu
		   document.getElementById("menu"+i+"a").style.fontSize=MainMenuFontSize;  //moved here from function CacherMenus  4-6-2006
		   //set background image for main menu - 5-4-2006
		   document.getElementById("menu"+i+"a").style.backgroundImage="url(menu/"+backgroundImage+")";
		   document.getElementById("menu"+i+"a").style.backgroundColor=backgroundColor; //5-5-2006. Added to initially set backgroundColor.
		   document.getElementById("menu"+i).style.height=TopMenuHeight; //V03:10-15-2006.
	}
	
	//Sub-menus
	cumul = 0;
	for(i=1;i<=nbmenu;i++) {
		if (document.getElementById("ssmenu"+i))//undefined
		{
			with(document.getElementById("ssmenu"+i).style) {
				if (!suivre_le_scroll || isIE || isIE5mac){
					position="absolute";
				}else{ position="fixed";}
				if (!vertical) {
					//10-15-2006. commented out.top=top_ssmenu+"px";
					top=top_ssmenu+TopMenuHeight+2 + "px";  //V03:10-15-2006. Added +TopMenuHeight+2

					//left=(((i-1)*(largeur_menu+espace_entre_menus))+1+left_menu)+"px";
					if (i==1){
					  if (isIE){
						if (menuID==1||menuID==2){  //V02: only have to adjust the first main menu item if UBC menu (1) and CAP menu (2) (on the UBC site) being built.
							left=(((i-1)*espace_entre_menus)+cumul-17+left_menu)+"px"; //10=13-2006. Here 1st top level menu button is wider.
						}else{
							left=(((i-1)*espace_entre_menus)+cumul+4+left_menu)+"px";  //10-13-2006. Make adjustment here when top level menu buttons are the same size.
						}
					  }else{
						left=(((i-1)*espace_entre_menus)+cumul-11+left_menu)+"px";
					  }
					}else if(i > 4){  //right align the top menu items beyond 4
					  //left=(((i-1)*espace_entre_menus)+cumul-largeur_sous_menu+left_menu)+"px";
					    if (isIE){
							if (menuID==1||menuID==2){  //V02: only have to adjust the first main menu item if UBC menu (1) and CAP menu (2) (on the UBC site) being built.
					  			left=(((i-1)*espace_entre_menus)+cumul-largeur_sous_menu+left_menu + largeur_menu)+"px";
					  		}else{
					  			left=(((i-1)*espace_entre_menus)+cumul-largeur_sous_menu+left_menu + largeur_menu+5)+"px";  //10-13-2006. For Timber Roots menu. Need to find a way to style #layer (on page templates) left property value to determine this.
					  		}
					  	}else{
					  		left=(((i-1)*espace_entre_menus)+cumul-largeur_sous_menu+left_menu + largeur_menu)+4+"px";
					  	}
					}else{
					  left=(((i-1)*espace_entre_menus)+cumul+1+left_menu)+4+"px";}
				} else {
					left=left_ssmenu+"px";
					//top=(((i-1)*(hauteur_menu+espace_entre_menus))+1+top_menu)+"px";
					top=(((i-1)*espace_entre_menus)+cumul+1+top_menu)+"px";
				}
				if (isIE || isOpera || isIE5mac || !largeur_auto_ssmenu) {
					if (isFinite(largeur_sous_menu)){
						width = largeur_sous_menu+(largeur_sous_menu!="auto"?"px":"");
					}else{
						width = largeur_sous_menu[i-1]+(largeur_sous_menu[i-1]!="auto"?"px":"");}
				}
				else width = "auto";
				if (!vertical && !isIE5mac) {
					//reposition if owerflowed to right
					if ((width != "auto")
						&& ((left.replace(reg,'').valueOf()*1 + width.replace(reg,'').valueOf()*1) > largeur_fenetre))
						left = (largeur_fenetre-width.replace(reg,'').valueOf())+"px";
				}
				margin="0";
				zIndex="3";
			}
		}
		if ((!vertical && isFinite(largeur_menu)) || (vertical && isFinite(hauteur_menu))) {
			cumul += (!vertical?largeur_menu:hauteur_menu);
		}
		else {
			cumul += (!vertical?largeur_menu[i-1]:hauteur_menu[i-1]);
		}
	}
	
	//sub-Sub-Menus
	cumul = 0;
	var j; //loop through sub menus to get any subSubMenus associated with the individual elements (<li>)of the subMenus.
	var ElementWidth;
	for(i=1;i<=nbmenu;i++) {
		if (document.getElementById("ssmenu"+i))//undefined
		{
		 for (j=1;j<=nbsubMenus;j++){
		  Element=i+"-"+j;  //<li> element ID for sub menu items
		  if (document.getElementById(Element)){
		    document.getElementById(Element).style.width = largeur_sous_menu;
		    }
		  if (document.getElementById("sSsmenu" + i + "-" + j))
		  {
			with(document.getElementById("sSsmenu" + i + "-" + j).style) {
				if (!suivre_le_scroll || isIE || isIE5mac){
					position="absolute";
					///ElementWidth = document.getElementById("ssmenu"+i).clientWidth;  //4-6-2006 not working properly. IE rendering wrong.
					if (i > 4){
						//left=ElementWidth-ElementWidth-ElementWidth+2+"px";
						//left=largeur_sous_menu-largeur_sous_menu-largeur_sous_menu-2+"px";  //4-6-2006
						left=largeur_sous_menu-largeur_sous_menu-largeur_sous_menu+"px";  //9-20-2006. Modify to decrease sensitivity of flyout disappearing when mousing from sub menu to sub-sub menu item.
					}else{
						//left=ElementWidth-1+"px";
						left=largeur_sous_menu+1+"px";  //4-6-2006
					}
					if (j==1){
					  top=0;
					}else{
					  top=document.getElementById(Element).offsetTop + "px";
					  //9-20-2006. Testing for Mac./////////////////////////////////////////
						if (isMac){
							top=(document.getElementById(Element).offsetTop) + "px"; //9-20-06. Modify code here to adjust top level of sub-sub menu. The flyout is fine for Locations->Retail Centers, but too low for Contractor Services->Installed Services flyout. If I change this, it changes the top position of both throwing off the Retail Centers flyout.
						}
						//////////////////////////////////////////////////////////////////////
					}
				 }
				}
				for (n=1;n<=nbsubMenus_2;n++){
					if (document.getElementById("subMenu_3_" + i + "-" + j + "-" + n)){  //"subMenu_3_" + i + "-" + j + "-" + n is the <UL> tag.
						with(document.getElementById("subMenu_3_" + i + "-" + j + "-" + n).style) {
							if (!suivre_le_scroll || isIE || isIE5mac){
								position="absolute";
								if (document.getElementById("T"+i+"-"+j+"-"+n)){
									Element="T"+i+"-"+j+"-"+n;  //<li> element subSubMenu ID for sub menu items
								}else if (document.getElementById("F"+i+"-"+j+"-"+n)){
									Element="F"+i+"-"+j+"-"+n;  //<li> element subSubMenu ID for sub menu items
								}
								ElementWidth = document.getElementById("sSsmenu"+i+"-"+j).clientWidth;
								if (i > 4){
								   left=ElementWidth-ElementWidth-ElementWidth+"px"; //9-20-06. Modify code here to adjust top level of sub-sub menu. The flyout is fine for Locations->Retail Centers, but too low for Contractor Services->Installed Services flyout. If I change this, it changes the top position of both throwing off the Retail Centers flyout.
								}else{
									left=ElementWidth-1+"px";
								}
								if (j==1){
									top=0;
								}else{
									top=document.getElementById(Element).offsetTop + "px";
								}
							}
						}
					}
					//Set font_size for subSubMenu and subMenu_3: 4-6-2006 moved here from function CacherMenus
					if (document.getElementById("F" + i + "-" + j + "-" + n)){
						document.getElementById("F" + i + "-" + j + "-" + n).style.fontSize=SubMenuFontSize;						//5-5-2006. Added to initially set background color.
						document.getElementById("F" + i + "-" + j + "-" + n).style.backgroundColor=subMenuBackgroundColor;
						document.getElementById("F" + i + "-" + j + "-" + n).style.color=subMenuTextColor;//V02:10-12-2006. Initially set sub menu text color to color
						document.getElementById("F" + i + "-" + j + "-" + n).style.width=largeur_sous_menu+"px";//4-18-2006. Set width in sSsmenu li tag so if width is changed in database, background color will fill in.
						} 
					if (document.getElementById("T" + i + "-" + j + "-" + n)){
						document.getElementById("T" + i + "-" + j + "-" + n).style.fontSize=SubMenuFontSize;
						document.getElementById("T" + i + "-" + j + "-" + n).style.backgroundColor=subMenuBackgroundColor;
						document.getElementById("T" + i + "-" + j + "-" + n).style.color=subMenuTextColor;//V02:10-12-2006. Initially set sub menu text color to color
						document.getElementById("T" + i + "-" + j + "-" + n).style.width=largeur_sous_menu+"px";//4-18-2006. Set width in sSsmenu li tag so if width is changed in database, background color will fill in.
						}  
					if (document.getElementById("F" + i + "-" + j + "-" + n +"td")){
						document.getElementById("F" + i + "-" + j + "-" + n +"td").style.fontSize=SubMenuFontSize;
						document.getElementById("F" + i + "-" + j + "-" + n +"td").style.backgroundColor=subMenuBackgroundColor; //5-5-2006. Added to initially set background color.
						document.getElementById("F" + i + "-" + j + "-" + n +"td").style.color=subMenuTextColor;} //V02:10-12-2006. Initially set sub menu text color to color
					if (document.getElementById("T" + i + "-" + j + "-" + n +"td")){
						document.getElementById("T" + i + "-" + j + "-" + n +"td").style.fontSize=SubMenuFontSize;
						document.getElementById("T" + i + "-" + j + "-" + n +"td").style.backgroundColor=subMenuBackgroundColor;  //5-5-2006. Added to initially set background color.
						document.getElementById("T" + i + "-" + j + "-" + n +"td").style.color=subMenuTextColor;} //V02:10-12-2006. Initially set sub menu text color to color
					if (document.getElementById("F" + i + "-" + j + "-" + n +"a")){
						document.getElementById("F" + i + "-" + j + "-" + n +"a").style.fontSize=SubMenuFontSize;
						document.getElementById("F" + i + "-" + j + "-" + n +"a").style.backgroundColor=subMenuBackgroundColor;  //5-5-2006. Added to initially set background color.
						document.getElementById("F" + i + "-" + j + "-" + n +"a").style.color=subMenuTextColor;}//V02:10-12-2006. Initially set sub menu text color to color
					if (document.getElementById("T" + i + "-" + j + "-" + n +"a")){
						document.getElementById("T" + i + "-" + j + "-" + n +"a").style.fontSize=SubMenuFontSize;
						document.getElementById("T" + i + "-" + j + "-" + n +"a").style.backgroundColor=subMenuBackgroundColor;  //5-5-2006. Added to initially set background color.
						document.getElementById("T" + i + "-" + j + "-" + n +"a").style.color=subMenuTextColor;}  //V02:10-12-2006. Initially set sub menu text color to color
						for (Q=1;Q<=nbSubMenus_3;Q++){  //subMenu_3 font-size
							if (document.getElementById("FS_3_" + i + "-" + j + "-" + n + "-" + Q)){
								document.getElementById("FS_3_" + i + "-" + j + "-" + n + "-" + Q).style.fontSize=SubMenuFontSize;
								document.getElementById("FS_3_" + i + "-" + j + "-" + n + "-" + Q).style.backgroundColor=subMenuBackgroundColor; //5-5-2006. Added to initially set background color.
								document.getElementById("FS_3_" + i + "-" + j + "-" + n + "-" + Q).style.color=subMenuTextColor; //V02:10-12-2006. Initially set sub menu text color to color
								document.getElementById("FS_3_" + i + "-" + j + "-" + n + "-" + Q).style.width=largeur_sous_menu+"px";//4-18-2006. Set width in sSsmenu li tag so if width is changed in database, background color will fill in.
								}
							if (document.getElementById("TS_3_" + i + "-" + j + "-" + n + "-" + Q)){
								document.getElementById("TS_3_" + i + "-" + j + "-" + n + "-" + Q).style.fontSize=SubMenuFontSize;
								document.getElementById("TS_3_" + i + "-" + j + "-" + n + "-" + Q).style.backgroundColor=subMenuBackgroundColor; //5-5-2006. Added to initially set background color.
								document.getElementById("TS_3_" + i + "-" + j + "-" + n + "-" + Q).style.color=subMenuTextColor; //V02:10-12-2006. Initially set sub menu text color to color
								document.getElementById("TS_3_" + i + "-" + j + "-" + n + "-" + Q).style.width=largeur_sous_menu+"px";//4-18-2006. Set width in sSsmenu li tag so if width is changed in database, background color will fill in.
								}
							if (document.getElementById("FS_3_" + i + "-" + j + "-" + n + "-" + Q + "a")){
								document.getElementById("FS_3_" + i + "-" + j + "-" + n + "-" + Q + "a").style.fontSize=SubMenuFontSize;
								document.getElementById("FS_3_" + i + "-" + j + "-" + n + "-" + Q + "a").style.backgroundColor=subMenuBackgroundColor; //5-5-2006. Added to initially set background color.
								document.getElementById("FS_3_" + i + "-" + j + "-" + n + "-" + Q + "a").style.color=subMenuTextColor; //V02:10-12-2006. Initially set sub menu text color to color
								document.getElementById("FS_3_" + i + "-" + j + "-" + n + "-" + Q + "a").style.width=largeur_sous_menu+"px";//4-18-2006. Set width in sSsmenu li tag so if width is changed in database, background color will fill in.
								}
							if (document.getElementById("FS_3_" + i + "-" + j + "-" + n + "-" + Q + "td")){
								document.getElementById("FS_3_" + i + "-" + j + "-" + n + "-" + Q + "td").style.fontSize=SubMenuFontSize;
								document.getElementById("FS_3_" + i + "-" + j + "-" + n + "-" + Q + "td").style.backgroundColor=subMenuBackgroundColor; //5-5-2006. Added to initially set background color.
								document.getElementById("FS_3_" + i + "-" + j + "-" + n + "-" + Q + "td").style.color=subMenuTextColor; //V02:10-12-2006. Initially set sub menu text color to color
								document.getElementById("FS_3_" + i + "-" + j + "-" + n + "-" + Q + "td").style.width=largeur_sous_menu+"px";//4-18-2006. Set width in sSsmenu li tag so if width is changed in database, background color will fill in.
								}
							if (document.getElementById("TS_3_" + i + "-" + j + "-" + n + "-" + Q + "a")){
								document.getElementById("TS_3_" + i + "-" + j + "-" + n + "-" + Q + "a").style.fontSize=SubMenuFontSize;
								document.getElementById("TS_3_" + i + "-" + j + "-" + n + "-" + Q + "a").style.backgroundColor=subMenuBackgroundColor; //5-5-2006. Added to initially set background color.
								document.getElementById("TS_3_" + i + "-" + j + "-" + n + "-" + Q + "a").style.color=subMenuTextColor; //V02:10-12-2006. Initially set sub menu text color to color
								document.getElementById("TS_3_" + i + "-" + j + "-" + n + "-" + Q + "a").style.width=largeur_sous_menu+"px";//4-18-2006. Set width in sSsmenu li tag so if width is changed in database, background color will fill in.
								}
							if (document.getElementById("TS_3_" + i + "-" + j + "-" + n + "-" + Q + "td")){
								document.getElementById("TS_3_" + i + "-" + j + "-" + n + "-" + Q + "td").style.fontSize=SubMenuFontSize;
								document.getElementById("TS_3_" + i + "-" + j + "-" + n + "-" + Q + "td").style.backgroundColor=subMenuBackgroundColor; //5-5-2006. Added to initially set background color.
								document.getElementById("TS_3_" + i + "-" + j + "-" + n + "-" + Q + "td").style.color=subMenuTextColor; //V02:10-12-2006. Initially set sub menu text color to color
								document.getElementById("TS_3_" + i + "-" + j + "-" + n + "-" + Q + "td").style.width=largeur_sous_menu+"px";//4-18-2006. Set width in sSsmenu li tag so if width is changed in database, background color will fill in.
								}
			          }
				}
			  }
			  
			  //Set font-size for sub menus: 4-6-2006 moved here from function CacherMenus
					if (document.getElementById(i + "-" + j)){
						document.getElementById(i + "-" + j).style.fontSize=SubMenuFontSize;
						//5-5-2006. Added to initially set background color.
						document.getElementById(i + "-" + j).style.backgroundColor=subMenuBackgroundColor;
						document.getElementById(i + "-" + j).style.color=subMenuTextColor;//V02:10-12-2006. Initially set sub menu text color to color
						}
					if (document.getElementById(i + "-" + j + "a")){
						document.getElementById(i + "-" + j + "a").style.fontSize=SubMenuFontSize;
						//5-5-2006. Added to initially set background color.
						document.getElementById(i + "-" + j + "a").style.backgroundColor=subMenuBackgroundColor;
						document.getElementById(i + "-" + j + "a").style.color=subMenuTextColor; //V02:10-12-2006. Initially set sub menu text color to color
						}
					if (document.getElementById(i + "-" + j + "td")){
						document.getElementById(i + "-" + j + "td").style.fontSize=SubMenuFontSize;
						//5-5-2006. Added to initially set background color.
						document.getElementById(i + "-" + j + "td").style.backgroundColor=subMenuBackgroundColor;
						document.getElementById(i + "-" + j + "td").style.color=subMenuTextColor; //V02:10-12-2006. Initially set sub menu text color to color
						}
		 } //end for j
				//margin="10";
				//zIndex="4";
		  }
    }
			//cumul += (!vertical?largeur_menu[i-1]:hauteur_menu[i-1]);
}

function MontrerMenu(strMenu) {
   var MenuID;
   MenuID = strMenu.substring(6,7);
	if(blnOk) {
		AnnulerCacher();
		CacherMenus();
		if (document.getElementById(strMenu)){//undefined
			with (document.getElementById(strMenu).style)
				visibility="visible";
				//KLR-3/16/2006 - Loop trough subMenus. If they have subSubMenus, do not show them when hovering over main menu items.
			for (j=1;j<=nbsubMenus;j++){
				if (document.getElementById("sSsmenu" + MenuID + "-" + j)){
					document.getElementById("sSsmenu" + MenuID + "-" + j).style.visibility="hidden";
				}
				//3-30-2006.Check for subMenu_3. If there are these sub menus, hide them until hovering over the appropriate menu item.
				for (t=1;t<=nbsubMenus_2;t++){
					if (document.getElementById("subMenu_3_" + MenuID + "-" + j + "-" + t)){
						document.getElementById("subMenu_3_" + MenuID + "-" + j + "-" + t).style.visibility="hidden";}
				}
			}
		}
			//set correct backgroundImage onmouseover
				document.getElementById("menu"+MenuID+"a").style.backgroundColor=backgroundColorHover;
				document.getElementById("menu"+MenuID+"a").style.backgroundImage="url(menu/"+backgroundImageHover+")";
				document.getElementById("menu"+MenuID+"a").style.backgroundPosition="100% 100%";
				document.getElementById("menu"+MenuID+"a").style.backgroundRepeat="no-repeat";
				document.getElementById("menu"+MenuID+"a").style.color=colorHover;
				document.getElementById("menu"+MenuID+"a").style.height=TopMenuHeight+"px";  //V03:10-15-2006 added to maintain height on mouseover.
	}
	SelectVisible("hidden",document.getElementsByTagName('select'));
}

function CacherDelai(anID) {
	if (blnOk) {
	IDofMenu=anID;
		timeout = setTimeout('CacherMenus()',delai);
	}
}
function AnnulerCacher() {
	if (blnOk && timeout) {
		clearTimeout(timeout);
	}
}
function CacherMenus() {
	if(blnOk) {
		for(i=1;i<=nbmenu;i++) {
			if (document.getElementById("ssmenu"+i)){//undefined
				with(document.getElementById("ssmenu"+i).style)
					visibility="hidden";}
		}
		if(IDofMenu != "noID"){
			document.getElementById("menu"+IDofMenu+"a").style.backgroundColor=backgroundColor;
			document.getElementById("menu"+IDofMenu+"a").style.backgroundImage="url(menu/"+backgroundImage+")";
			document.getElementById("menu"+IDofMenu+"a").style.backgroundPosition="100% 100%";
			document.getElementById("menu"+IDofMenu+"a").style.backgroundRepeat="no-repeat";
			document.getElementById("menu"+IDofMenu+"a").style.color=color;}
	}
	SelectVisible("visible",document.getElementsByTagName('select'));
}

function trimespaces() {
	//Against a bug in IE5/win... it doesn't make css work fine for tags <li>, so we dismiss them !
	if(blnOk&&isIE5win) {
		for(i=1;i<=nbmenu;i++) {
			if (document.getElementById("ssmenu"+i))//undefined
				with(document.getElementById("ssmenu"+i))
					innerHTML = innerHTML.replace(/<LI>|<\/LI>/g,"");
		}
	}
}

function SelectVisible(v,elem) {
	if (blnOk && cacher_les_select && (isIE||isIE5win))
		for (var i=0;i<elem.length;i++) elem[i].style.visibility=v;
}

//KLR-show the subSubMenus when hovering on subMenu
//Accepts an argument either "nosub" or the ID of the <li> subMenu tag if there is a subSubMenu off the subMenu.
function showsubSubMenus(strsubSubMenu, mainMenuID){
	//passes into strsubSubMenu  i.e. sSmenu4-1
	//passes into mainMenuID  i.e. 4-1
	var ID;
	var mainID;
	var b;
	//get length of strsubSubMenu
	var length=strsubSubMenu.length;
	//ID = strsubSubMenu.substring(7,length);  //gets <li> tag ID from subMenu items. i.e. 4-4 //V02: Testing to see if using mainMenuID works instead of ID
	ID=mainMenuID;
	mainID = mainMenuID.substring(0,1);  //gets main menu number (single number here) i.e. 4
	AnnulerCacher();
	//Keep main menu background image and text color the same as when hovering over it directly.///////////
	document.getElementById("menu"+mainID+"a").style.backgroundColor=backgroundColorHover;
	document.getElementById("menu"+mainID+"a").style.backgroundImage="url(menu/"+backgroundImageHover+")";
	document.getElementById("menu"+mainID+"a").style.backgroundPosition="100% 100%";
	document.getElementById("menu"+mainID+"a").style.backgroundRepeat="no-repeat";
	document.getElementById("menu"+mainID+"a").style.color=colorHover;
	///////////////////////////////////////////////////////////////////////////////////////////////////////
	if (strsubSubMenu != "noSub"){
	 //document.getElementByID(strsubSubMenu).style.visibility="visible"; //this doesn't work...generates javascript error.
		document.getElementById(strsubSubMenu).style.visibility='';
		document.getElementById(ID + "a").style.color=subMenuTextColorHover;  //this references the Id of the <a> in the subMenu
		document.getElementById(ID + "a").style.backgroundColor=subMenuBackgroundColorHover;  //5-3-2006 changed from colorHover to subMenuBackgroundColorHover
		document.getElementById(ID + "td").style.color=subMenuTextColorHover;  //this references the Id of the <a> in the subMenu
		document.getElementById(ID + "td").style.backgroundColor=subMenuBackgroundColorHover;  //5-3-2006 changed from colorHover to subMenuBackgroundColorHover

	}else{
		document.getElementById(mainMenuID + "a").style.backgroundColor=subMenuBackgroundColorHover;  //5-3-2006 changed from colorHover to subMenuBackgroundColorHover
//V02:
		if (document.getElementById(ID + "a")){
			document.getElementById(ID + "a").style.color=subMenuTextColorHover;  //this references the Id of the <a> in the subMenu
			document.getElementById(ID + "a").style.backgroundColor=subMenuBackgroundColorHover;  //5-3-2006 changed from colorHover to subMenuBackgroundColorHover
		}
		if (document.getElementById(ID + "td")){
			document.getElementById(ID + "td").style.color=subMenuTextColorHover;  //this references the Id of the <a> in the subMenu
			document.getElementById(ID + "td").style.backgroundColor=subMenuBackgroundColorHover;  //5-3-2006 changed from colorHover to subMenuBackgroundColorHover
		}
//end V02:
	}
}
//KLR-hide the subSubMenus when leaving subMenu
function hidesubSubMenus(strsubSubMenu, mainMenuID){
	//passes into strsubSubMenu  i.e. sSmenu4-4 or "noSub"
	//passes into mainMenuID  i.e. 4-1
	var ID;
	var mainID;
	//get length of strsubSubMenu
	var length=strsubSubMenu.length;
	//ID = strsubSubMenu.substring(7,length);  //gets <li> tag ID from subMenu items. (i.e. "1-2" or "4-3", etc)
	ID=mainMenuID;
	mainID = mainMenuID.substring(0,1);  //gets main menu number (single number here) (i.e. 1,2,3,etc)

	if (strsubSubMenu != "noSub"){
    	 document.getElementById(strsubSubMenu).style.visibility="hidden";  //subSubMenu
    	 document.getElementById(ID + "a").style.color=subMenuTextColor;  //subMenu
	     document.getElementById(ID + "a").style.backgroundColor=subMenuBackgroundColor;
    	 document.getElementById(ID + "td").style.color=subMenuTextColor;
	     document.getElementById(ID + "td").style.backgroundColor=subMenuBackgroundColor;
	     for (b=1;b<=nbsubMenus_2;b++){
			if (document.getElementById("F"+ID +"-"+b)){  //subSubMenu
				document.getElementById("F"+ID +"-"+b).style.backgroundColor=subMenuBackgroundColor;  //5-3-2006 changed from colorHover to subMenuBackgroundColorHover
				document.getElementById("F"+ID +"-"+b+"a").style.backgroundColor=subMenuBackgroundColor;  //5-3-2006 changed from colorHover to subMenuBackgroundColorHover
				if (document.getElementById("F"+ID +"-"+b+"td")){ //10-14-2006.
					document.getElementById("F"+ID +"-"+b+"td").style.backgroundColor=subMenuBackgroundColor;
				}
			}else if (document.getElementById("T"+ID +"-"+b)){
				document.getElementById("T"+ID +"-"+b).style.backgroundColor=subMenuBackgroundColor;
				document.getElementById("T"+ID +"-"+b+"a").style.backgroundColor=subMenuBackgroundColor;
				if (document.getElementById("T"+ID +"-"+b+"td")){
					document.getElementById("T"+ID +"-"+b+"td").style.backgroundColor=subMenuBackgroundColor;
				}
			}
		 }
	}else{
		document.getElementById(mainMenuID + "a").style.backgroundColor=subMenuBackgroundColor;
		
		//V02:
		if (document.getElementById(ID + "a")){
			document.getElementById(ID + "a").style.color=subMenuTextColor;
			document.getElementById(ID + "a").style.backgroundColor=subMenuBackgroundColor;
		}
		if (document.getElementById(ID + "td")){
    	 document.getElementById(ID + "td").style.color=subMenuTextColor;
	     document.getElementById(ID + "td").style.backgroundColor=subMenuBackgroundColor;
		}
		//end V02:
	}
}

//KLR - functions to control subMenu_2
function subMenu_2Over (strMenuItem_2, hasSub){
   //passes into strMenuItem_2 i.e. T4-4-1
	var ID_3;
	var length=strMenuItem_2.length;
	//10-14-2006.Not using "var T_F" now. Should have same functionality with or without a URL link associated with this menu item.
	//var T_F = strMenuItem_2.substring(0,1);  //added T_F check 4-6-2006. Determines if there is a link assigned to this menu item or not.
	ID_3=strMenuItem_2.substring(1,length); //i.e. extract 4-4-1
	//3-31-2006. Get sSsmenu value to be sure this sub menu doesn't hide from leaving the subMenu (see hidesubSubMenus function above that tells to
	//hide subSubMenu when mouseout called hidesubSubMenus function.
	var ID_3_array = ID_3.split("-");  //need to split out menuID & menuID_2 (main menu & subMenu) value used below to make sure menuID_3 stays visible.
	var sSsmenuID="";//loop throught ID_3 and get up to the 2nd dash.
	var k = 0;
	for (var x=0;x<ID_3_array.length;x++){
		if (k<2){
		sSsmenuID=sSsmenuID + ID_3_array[x] + "-";
		k+=1;}
	}
	sSsmenuID = sSsmenuID.substring(0,(sSsmenuID.length-1))
	document.getElementById("sSsmenu"+sSsmenuID).style.visibility='';  //end 3-31-2006
	document.getElementById(strMenuItem_2+"a").style.backgroundColor=subMenuBackgroundColorHover;  //5-3-2006 changed from colorHover to subMenuBackgroundColorHover  //LIVE color is set in the <a> tag...not the <li> tag
	document.getElementById(strMenuItem_2+"a").style.color=subMenuTextColorHover;//}  //color is set in the <a> tag...not the <li> tag
	 if (document.getElementById(strMenuItem_2+"td")){
		document.getElementById(strMenuItem_2+"td").style.backgroundColor=subMenuBackgroundColorHover;  //5-3-2006 changed from colorHover to subMenuBackgroundColorHover  //color is set in the <a> tag...not the <li> tag
		document.getElementById(strMenuItem_2+"td").style.color=subMenuTextColorHover;//}
	 }  //color is set in the <a> tag...not the <li> tag
	 
	 //If there is a sub menu_3 for this menu item, show it now.
	if (hasSub=="True"){
		document.getElementById("subMenu_3_" + ID_3).style.visibility='';
	}
}
//KLR - functions to control subMenu_2
function subMenu_2Out (strMenuItem_2, hasSub){
	var ID_3;
	var length=strMenuItem_2.length;
	ID_3=strMenuItem_2.substring(1,length);
	//var Link; 10-14-2006.Not using now. Should have same functionality with or without a URL link associated with this menu item.
	//Link = strMenuItem_2.substring(0,1);
	//if (Link=="F"){
	//	  document.getElementById(strMenuItem_2).style.backgroundColor=subMenuBackgroundColorHover;  //5-3-2006 changed from colorHover to subMenuBackgroundColorHover

	//}else if (Link=="T"){
		document.getElementById(strMenuItem_2).style.backgroundColor=subMenuBackgroundColor;
	//}
	document.getElementById(strMenuItem_2+"a").style.color=subMenuTextColor;
	if (document.getElementById(strMenuItem_2+"td")){
		document.getElementById(strMenuItem_2+"td").style.color=subMenuTextColor;
		document.getElementById(strMenuItem_2+"td").style.backgroundColor=subMenuBackgroundColor;
	}
	if (hasSub!="False"){
		document.getElementById("subMenu_3_" + ID_3).style.visibility="hidden";
	}
}

function subMenu_3Over (strMenuItem_3){
//passing in i.e. '4-4-3-1': (main menu, sub menu, subSubMenu, subMenu_3)
	var subID_2_array = strMenuItem_3.split("-");  //need to split out menuID & menuID_2 (main menu & subMenu) value used below to make sure menuID_3 stays visible.
	var subID_2="";//loop throught ID_3 and get up to the 3rd dash. (i.e. 4-4-3)
	var k = 0;
	for (var x=0;x<subID_2_array.length;x++){
		if (k<3){
		subID_2=subID_2 + subID_2_array[x] + "-";
		k+=1;}
	}
	subID_2 = subID_2.substring(0,(subID_2.length-1))
	//Make sure subMenu_3 stays visible...
	document.getElementById("subMenu_3_"+subID_2).style.visibility='';  //i.e. subMenu_3_4-4-3  subMenu_3_4-28-3
	if (document.getElementById("T"+subID_2+"a")){
		document.getElementById("T"+subID_2+"a").style.color=subMenuTextColorHover;
		document.getElementById("T"+subID_2+"a").style.backgroundColor=subMenuBackgroundColorHover;  //5-3-2006 changed from colorHover to subMenuBackgroundColorHover
		document.getElementById("T"+subID_2+"td").style.color=subMenuTextColorHover;
		document.getElementById("T"+subID_2+"td").style.backgroundColor=subMenuBackgroundColorHover;  //5-3-2006 changed from colorHover to subMenuBackgroundColorHover
	}
	if (document.getElementById("F"+subID_2+"a")){ //8-25-2006. Added to keep text color changing even if there's no link when hovering in/out.
		document.getElementById("F"+subID_2+"a").style.color=subMenuTextColorHover;
		document.getElementById("F"+subID_2+"a").style.backgroundColor=subMenuBackgroundColorHover;  //5-3-2006 changed from colorHover to subMenuBackgroundColorHover
		document.getElementById("F"+subID_2+"td").style.color=subMenuTextColorHover;
		document.getElementById("F"+subID_2+"td").style.backgroundColor=subMenuBackgroundColorHover;  //5-3-2006 changed from colorHover to subMenuBackgroundColorHover
	}

	if (document.getElementById("TS_3_"+strMenuItem_3+"a")){
		document.getElementById("TS_3_"+strMenuItem_3+"a").style.color=subMenuTextColorHover;
		document.getElementById("TS_3_"+strMenuItem_3+"a").style.backgroundColor=subMenuBackgroundColorHover;  //5-3-2006 changed from colorHover to subMenuBackgroundColorHover
	}else if (document.getElementById("FS_3_"+strMenuItem_3+"a")){  //4-6-206 added this else if to keep text from changing when hovering if no link. V02:Since setting initial colors in load, this code is always needed now
		document.getElementById("FS_3_"+strMenuItem_3+"a").style.color=subMenuTextColorHover; //8-25-2006. Commented out. Want text color to change, but background to stay dark.
		document.getElementById("FS_3_"+strMenuItem_3+"a").style.backgroundColor=subMenuBackgroundColorHover; //5-3-2006 changed from colorHover to subMenuBackgroundColorHover
	}
	if (document.getElementById("TS_3_"+strMenuItem_3+"td")){
		document.getElementById("TS_3_"+strMenuItem_3+"td").style.color=subMenuTextColorHover;
		document.getElementById("TS_3_"+strMenuItem_3+"td").style.backgroundColor=subMenuBackgroundColorHover;  //5-3-2006 changed from colorHover to subMenuBackgroundColorHover
	}else if (document.getElementById("FS_3_"+strMenuItem_3+"td")){  //4-6-2006 added this else if to keep text from changing when hovering if no link.
		document.getElementById("FS_3_"+strMenuItem_3+"td").style.color=subMenuTextColorHover;
		document.getElementById("FS_3_"+strMenuItem_3+"td").style.backgroundColor=subMenuBackgroundColorHover;  //5-3-2006 changed from colorHover to subMenuBackgroundColorHover
	}
}
	
function subMenu_3Out (strMenuItem_3){
//alert (strMenuItem_3)  //passing in i.e. 4-28-3-1
//4-6-2006 - Used so subSubMenu will display correctly again after having hovered over subMenu_3 flyout.
	var subID_2_array = strMenuItem_3.split("-");  //need to split out menuID & menuID_2 (main menu & subMenu) value used below to make sure menuID_3 stays visible.
	var subID_2="";//loop throught ID_3 and get up to the 2nd dash.
	var k = 0;
	for (var x=0;x<subID_2_array.length;x++){
		if (k<3){
		subID_2=subID_2 + subID_2_array[x] + "-";
		k+=1;}
	}
	subID_2 = subID_2.substring(0,(subID_2.length-1))
	if (document.getElementById("T"+subID_2+"td")){
		document.getElementById("T"+subID_2+"td").style.color=subMenuTextColor;
		document.getElementById("T"+subID_2+"td").style.backgroundColor=subMenuBackgroundColor;} //end adding code 4-6-2006
	if (document.getElementById("T"+subID_2+"a")){
		document.getElementById("T"+subID_2+"a").style.color=subMenuTextColor;
		document.getElementById("T"+subID_2+"a").style.backgroundColor=subMenuBackgroundColor;} //end adding code 4-7-2006
	
	if (document.getElementById("F"+subID_2+"td")){ //8-25-2006. Added to keep text color changing even if there's no link when hovering in/out.
		document.getElementById("F"+subID_2+"td").style.color=subMenuTextColor;
		document.getElementById("F"+subID_2+"td").style.backgroundColor=subMenuBackgroundColor;} //end adding code 4-6-2006
	if (document.getElementById("F"+subID_2+"a")){
		document.getElementById("F"+subID_2+"a").style.color=subMenuTextColor;
		document.getElementById("F"+subID_2+"a").style.backgroundColor=subMenuBackgroundColor; //end adding code 4-7-2006
	}
		
	if (document.getElementById("FS_3_"+strMenuItem_3+"a")){
		document.getElementById("FS_3_"+strMenuItem_3+"a").style.color=subMenuTextColor;
		document.getElementById("FS_3_"+strMenuItem_3+"a").style.backgroundColor=subMenuBackgroundColor;  //5-3-2006 changed from colorHover to subMenuBackgroundColorHover.V02: changd to subMenuBackgroundColor

	}else if (document.getElementById("TS_3_"+strMenuItem_3+"a")){
		document.getElementById("TS_3_"+strMenuItem_3+"a").style.color=subMenuTextColor;
		document.getElementById("TS_3_"+strMenuItem_3+"a").style.backgroundColor=subMenuBackgroundColor;
	}
}