/*
To Add a button and associated dropdown menu:
(1) Place a button in the page
	Ex: <img  name="ebooks_img" id="ebooks_img"></td>

(2) Include this file in the page
	Ex:	<script language="JavaScript" src="http://www.lsro.org/ddm.js" type="text/javascript"></script>

(3)	define the button object in the [initialize()] function
	Ex: obj_ebooks_button=document.getElementById? document.getElementById("ebooks_img") : ebooks_img

(4) Register the button object so that mouse events are captured
		- also done in the [initialize()] function
	Ex:	register_object (obj_ebooks_button)

(5) Enter the image id in the buttonList[] array
	Ex:	buttonList[6] = "ebooks_img"
	
(6) Enter the image local name id in the buttonImgList[] array
		Note: this is the name that will have '_hi' or '_lo' 
			appended to it to create an image object for controlling hilighting
	buttonImgList[6] = "btn_ebooks"

(7) Create an array that defines the topmenu for the button;
		the array entry is a list containing:
		- an id for the topmenu item
		- the link for the topmenu item
		- the topmenu item label
	Ex:		var menu6=new Array()
			menu6[0]='<a id="mediaPressReleases" href="http://www.lsro.org/media_press_releases.html">Press Releases</a>'
			menu6[1]='<a id="mediaContact" href="http://www.lsro.org/media_contact.html">Media Contact</a>'

(8) Enter a topmenu definition for the button in the allMenus[] array
		consisting of a list:
		- button id
		- keyword 'topMenuName'
		- name of array defining the topmenu
		- menuwidth in pixels
	Ex: allMenus[52] = "ebooks_img,topMenuName,menu6,110"		// topmenu definintion

*/


/*
mouse events as interpreted by different browsers
ie4
	srcElement
	fromElement
	toElement

ns6
	target
	relatedTarget
	currentTarget
	originalTarget
*/


var version = 59

// To debug
//	(1) set debug_switch = 1
var debug_switch = 0


/************************************************************************
* AnyLink Drop Down Menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
* Code at: http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm
************************************************************************/

/************************************************************************

* Annotated version at:
*	[C:\als_documents\Computer_programming\dropdown_menus_new\nouvelle_image_development]

************************************************************************/

/*
//	*****************  LIST OF FUNCTIONS *************************************
function hiliteOneButton(btnToLite)
function initialize()
function register_object (obj)
function manage_action (e)
function do_hilite(identifier)
function un_hilite(hiObj)
function dropdownmenu(obj, dropmenuobj, e, menucontents, menuwidth, item_seq, level, caller)
function populatemenu(dropmenuobj, what, caller)
function showhide(dropmenuobj, e, visible, hidden, menuwidth, caller)
function clearbrowseredge(obj,dropmenuobj, whichedge, caller)
function getposOffset (what, offsettype, caller)
function iecompattest(caller)
function clickreturnvalue(caller)
function delayhidemenu(which_menu, caller)
function hidemenu()
function stopTopMenuTimer(caller){
function stopSubMenuTimer(caller){
*/


var dummy = 0

var menu1=new Array()
menu1[0]='<a id="who_we_are" href="http://www.lsro.org/about/who.html">Who We Are</a>'
menu1[1]='<a id="why_use" href="http://www.lsro.org/about/why.html">Why Use LSRO?</a>'
menu1[2]='<a id="history" href="http://www.lsro.org/about/history.html">Our History</a>'
menu1[3]='<a id="anniversary" href="http://www.lsro.org/about/anniversary.html">Our 47th Anniversary</a>'
menu1[4]='<a id="sci_expertise" href="http://www.lsro.org/about/expertise.html">Scientific Expertise</a>'
menu1[5]='<a id="staff_bios" href="http://www.lsro.org/about/staff_bios.html">Staff Bios</a>'
menu1[6]='<a id="panels" name="panels" href="http://www.lsro.org/about/expert_panels.html">Expert Panels</a>'
menu1[7]='<a id="bod" href="http://www.lsro.org/about/bod.html">Our Board of Directors</a>'
menu1[8]='<a id="clients" href="http://www.lsro.org/about/clients.html">Partial Client List</a>'
menu1[9]='<a id="directions" href="http://www.lsro.org/about/directions.html">Directions to LSRO</a>'

var menu1a=new Array()
menu1a[0]='<a id="allison" href="http://www.lsro.org/about/bios_allison.html">Richard G. Allison, Ph.D.</a>'
menu1a[1]='<a id="bernhard" href="http://www.lsro.org/about/bios_bernhard.html">MaryBeth Bernhard, B.S.</a>'
menu1a[2]='<a id="brownawell" href="http://www.lsro.org/about/bios_brownawell.html">Amy M. Brownawell, Ph.D.</a>'
menu1a[3]='<a id="byrd" href="http://www.lsro.org/about/bios_byrd.html">Daniel M. Byrd, III, Ph.D., DABT</a>'
// menu1a[4]='<a id="demoura" href="http://www.lsro.org/about/bios_demoura.html">Fabiana De Moura, Ph.D.</a>'
menu1a[4]='<a id="falk" href="http://www.lsro.org/about/bios_falk.html">Michael Falk, Ph.D.</a>'
menu1a[5]='<a id="feldman" href="http://www.lsro.org/about/bios_feldman.html">Robin S. Feldman, M.B.A.</a>'
menu1a[6]='<a id="frumkin" href="http://www.lsro.org/about/bios_frumkin.html">David A. Frumkin</a>'
menu1a[7]='<a id="frumkin" href="http://www.lsro.org/about/bios_gorby.html">Heather Gorby, Ph.D.</a>'
menu1a[8]='<a id="johnson" href="http://www.lsro.org/about/bios_johnson.html">Rebecca L. Johnson, Ph.D.</a>'
menu1a[9]='<a id="klein" href="http://www.lsro.org/about/bios_klein.html">Catherine J. Klein, Ph.D., R.D., C.N.S.D.</a>'
menu1a[10]='<a id="lewis" href="http://www.lsro.org/about/bios_lewis.html">Kara D. Lewis, Ph.D.</a>'
menu1a[11]='<a id="looney" href="http://www.lsro.org/about/bios_looney.html">Ramona Looney</a>'
menu1a[12]='<a id="smith" href="http://www.lsro.org/about/bios_smith.html">James C. Smith, Jr., Ph.D.</a>'
// menu1a[14]='<a id="sthilaire" href="http://www.lsro.org/about/bios_sthilaire.html">Catherine St. Hilaire, Ph.D.</a>'


var menu2=new Array()
menu2[0]='<a id="nutrition" href="http://www.lsro.org/nutrition_gen.html">Nutrition</a>'
menu2[1]='<a id="gras" href="http://www.lsro.org/gras.html">GRAS</a>'
menu2[2]='<a id="riskAnalysis" href="http://www.lsro.org/risk_analysis/home.html">Risk Analysis</a>'
menu2[3]='<a id="emergingIssues" href="http://www.lsro.org/emerging_issues.html">Emerging Issues</a>'

var menu2a=new Array()
menu2a[0]='<a id="nutrition_res" href="http://www.lsro.org/nutrition_res.html">Nutrition Research</a>'
menu2a[1]='<a id="food_labeling" href="http://www.lsro.org/food_labeling.html">Food Labeling and Health Claims</a>'
menu2a[2]='<a id="food_safety" href="http://www.lsro.org/food_safety.html">Food Safety</a>'
// menu2a[3]='<a id="gras_01" href="http://www.lsro.org/gras_sub.html">GRAS</a>'

var menu3=new Array()
menu3[0]='<a id="serviceCompStudies" href="http://www.lsro.org/services_compstudies.html">Comprehensive Studies</a>'
menu3[1]='<a id="serviceCompStudies" href="http://www.lsro.org/services_reports.html">Authoritative Reports</a>'
menu3[2]='<a id="serviceWorkshops" href="http://www.lsro.org/services_workshops.html">Workshops and Symposia</a>'
menu3[3]='<a id="servicePeerReview" href="http://www.lsro.org/services_peer_review.html">Peer Review</a>'
menu3[4]='<a id="serviceRIC" href="http://www.lsro.org/ric/ric.html">Regulatory Information</a>'
// menu3[4]='<a id="serviceNeeds" href="http://www.lsro.org/services_needs.html">Identifying Research Needs</a>'
// menu3[5]='<a id="serviceBidGrant" href="http://www.lsro.org/services_bid_grant.html">Analysis of Bid & Grant Proposals</a>'
// menu3[6]='<a id="serviceEarlyStage" href="http://www.lsro.org/services_earlystage.html">Evaluating Early Stage Products</a>'
// menu3[7]='<a id="serviceCompStudies" href="http://www.lsro.org/services_support.html">Support Services</a>'


var menu4=new Array()
menu4[0]='<a id="mediaPressReleases" href="http://www.lsro.org/media_press_releases.html">Press Releases</a>'
menu4[1]='<a id="mediaContact" href="http://www.lsro.org/media_contact.html">Media Contact</a>'

var menu5=new Array()
menu5[0]='<a id="pendingReports" href="http://www.lsro.org/articles_pending_reports.html">Pending Reports</a>'
menu5[1]='<a id="recentReports" href="http://www.lsro.org/articles_recent_reports.html">Recent Reports</a>'
// menu5[2]='<a id="searchByTopic" href="http://www.lsro.org/articles_topicsearch.html">Search By Topic</a>'

var menuwidth='165px' //default menu width
var submenuWidth='225px' //default menu width
var lineheight = 18

var menubgcolor='#A2C8A9'
var secondHiLiteColor = '#EBF5ED' // color of first level menu item when submenu is displayed
var disappeardelay=400
var timer_index_top = 0
var timer_index_sub = 0
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

var buttonList = new Array()
var buttonImgList = new Array()
var allMenus = new Array()

var where_i_am = ""
var hilite_obj // a menu item object that has a hilite when its submenu appears
var buttonHasMenu = 0
var isTopMenuItem = 0
var isSubMenuItem = 0
var submenuExists = 0
var submenuName = ""
var submenuOffset = 0

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)	{
	document.write("<div id=\"dropmenudiv\" style=\"visibility:hidden;width:"+menuwidth+";background-color:"+menubgcolor+"\"></div>\n")
	document.write("<div id=\"dropmenudiv_sub1\" style=\"visibility:hidden;width:"+submenuWidth+";background-color:"+menubgcolor+"\"></div>\n")

	buttonList[0] = "home_button_img"
	buttonList[1] = "about_button_img"
	buttonList[2] = "expertise_img"
	buttonList[3] = "services_img"
	buttonList[4] = "media_img"
	buttonList[5] = "articles_img"
	buttonList[6] = "ebooks_img"
	buttonList[7] = "career_img"
	buttonList[8] = "ric_img"
	buttonList[9] = "faqs_img"
//	buttonList[9] = "directions_img"
	
	buttonImgList[0] = "btn_home"
	buttonImgList[1] = "btn_about"
	buttonImgList[2] = "btn_exper"
	buttonImgList[3] = "btn_services"
	buttonImgList[4] = "btn_media"
	buttonImgList[5] = "btn_articles"
	buttonImgList[6] = "btn_ebooks"
	buttonImgList[7] = "btn_career"
	buttonImgList[8] = "btn_ric"
	buttonImgList[9] = "btn_faqs"
//	buttonImgList[9] = "btn_directions"

// [allMenus] array structure:
//		o each entry is a list composed of a comma-delimited string
//		o entries with an empty string are ignored

//		o for buttons with no associated topmenus:
//			- there is one 'definition' entry that contains:
//				# button name
//				# keyword "none"
//					Ex:	allMenus[0] = "home_button_img,none"
//			Note: in these cases, add a conditional statement in
//				the [manage_action()] function that indicates the click
//				link for the button.
//				Ex: else if (e.type == "click") {
//				...
//					else if (where_i_am == "ebooks_img"){window.location.href = "http://www.lsro.org/bookstore/new_session.asp"}
//				...
//				}
//


//		o for buttons with topmenus, whether or not there are submenus:
//			- there is a 'topmenu definition' entry that contains:
//				# button id
//				# keyword 'topMenuName'
//				# name of array defining the topmenu
//				# menuwidth in pixels
//					Ex: allMenus[36] = "about_button_img,topMenuName,menu1,165"

//			- in addition, for each of the button's topmenu items...
//				# if the topmenu item does NOT have a submenu, there is
//					an entry that contains:
//						## button name
//						## id name of the topmenu item
//						## keyword "none", indicating that there is no submenu
//					Ex: allMenus[3] = "about_button_img,history,none"

//				# if the topmenu item DOES have a submenu there are two
//					classes of entries:
//					
//					A. One 'submenu definition' entry for the topmenu item
//					consisting of
//					## button name 
//					## id name of the topmenu item
//					## keyword 'subMenuName'
//					## name of array defining the submenu
//					## menuwidth in pixels
//					## index of the topmenu item in its array
//					Ex: allMenus[38] = "about_button_img,staff_bios,subMenuName,menu1a,4"

//				 	B. An entry for each submenu item that contains:
//					## button name
//					## id name of the topmenu item
//					## id name of the submenu item
//					Ex: allMenus[5] = "about_button_img,staff_bios,brownawell"


	allMenus[0] = "home_button_img,none"								// button entry

	allMenus[1] = "about_button_img,topMenuName,menu1,165"				// topmenu definintion
//	allMenus[1] = "about_button_img,topMenuName,menu1,300"				// topmenu definintion
	allMenus[2] = "about_button_img,staff_bios,subMenuName,menu1a,275,5"	// submenu definintion
	allMenus[3] = "about_button_img,who_we_are,none"					// topmenu entry
	allMenus[4] = "about_button_img,why_use,none"						// topmenu entry
	allMenus[5] = "about_button_img,history,none"						// topmenu entry

	allMenus[6] = "about_button_img,sci_expertise,none"					// topmenu entry
	allMenus[7] = "about_button_img,staff_bios,allison"					// submenu entry
	allMenus[8] = "about_button_img,staff_bios,brownawell"				// submenu entry
	allMenus[9] = "about_button_img,staff_bios,byrd"					// submenu entry
	allMenus[10] = "about_button_img,staff_bios,falk"					// submenu entry

	allMenus[11] = "about_button_img,staff_bios,feldman"				// submenu entry
	allMenus[12] = "about_button_img,staff_bios,frumkin"				// submenu entry
	allMenus[13] = "about_button_img,staff_bios,johnson"				// submenu entry
	allMenus[14] = "about_button_img,staff_bios,klein"					// submenu entry
	allMenus[15] = "about_button_img,staff_bios,demoura"				// submenu entry

	allMenus[16] = "about_button_img,staff_bios,lewis"					// submenu entry
	allMenus[17] = "about_button_img,staff_bios,looney"					// submenu entry
	allMenus[18] = ""													// submenu entry
	allMenus[19] = "about_button_img,staff_bios,smith"					// submenu entry
//	allMenus[20] = "about_button_img,staff_bios,sthilaire"				// submenu entry
	allMenus[20] = "about_button_img,panels,none"						// topmenu entry

	allMenus[21] = "about_button_img,bod,none"							// topmenu entry
	allMenus[22] = "about_button_img,clients,none"						// topmenu entry
	allMenus[23] = "expertise_img,topMenuName,menu2,165"				// topmenu definintion
	allMenus[24] = "expertise_img,nutrition,subMenuName,menu2a,225,0"		// submenu definintion
	allMenus[25] = "expertise_img,nutrition,nutrition_res"				// submenu entry

	allMenus[26] = "expertise_img,nutrition,food_labeling"				// submenu entry
	allMenus[27] = "expertise_img,nutrition,food_safety"				// submenu entry
	allMenus[28] = "expertise_img,nutrition,gras_01"					// submenu entry
	allMenus[29] = "expertise_img,gras,none"							// topmenu entry
	allMenus[30] = "expertise_img,riskAnalysis,none"					// topmenu entry

	allMenus[31] = "expertise_img,emergingIssues,none"					// topmenu entry
	allMenus[32] = "ebooks_img,none"									// button entry
	allMenus[33] = "career_img,none"									// button entry
	allMenus[34] = "faqs_img,none"										// button entry
	allMenus[35] = "directions_img,none"								// button entry

	allMenus[36] = "services_img,topMenuName,menu3,225"					// topmenu definintion
	allMenus[37] = "services_img,serviceNeeds,none"						// topmenu entry
	allMenus[38] = "services_img,serviceBidGrant,none"					// topmenu entry
	allMenus[39] = "services_img,serviceEarlyStage,none"				// topmenu entry
	allMenus[40] = "services_img,serviceCompStudies,none"				// topmenu entry

	allMenus[41] = "services_img,servicePeerReview,none"				// topmenu entry
	allMenus[42] = "services_img,serviceWorkshops,none"					// topmenu entry
	allMenus[43] = "media_img,topMenuName,menu4,110"					// topmenu definintion
	allMenus[44] = "media_img,mediaPressReleases,none"					// topmenu entry
	allMenus[45] = "media_img,mediaContact,none"						// topmenu entry
	
	allMenus[46] = "articles_img,topMenuName,menu5,110"					// topmenu definintion
	allMenus[47] = "articles_img,pendingReports,none"					// topmenu entry
	allMenus[48] = "articles_img,recentReports,none"					// topmenu entry
	allMenus[49] = "articles_img,searchByTopic,none"					// topmenu entry
	allMenus[50] = "about_button_img,staff_bios,colwell"				// submenu entry

	allMenus[51] = "about_button_img,staff_bios,williams"				// submenu entry
	allMenus[52] = "about_button_img,directions,none"					// topmenu entry
	allMenus[53] = "about_button_img,anniversary,none"					// topmenu entry
	allMenus[54] = "ric_img,none"										// topmenu entry
	allMenus[55] = "services_img,serviceRIC,none"						// topmenu entry

	allMenus[56] = "about_button_img,staff_bios,bernhard"				// submenu entry

	
}	
	
	for (i=0; i < buttonList.length; i++)	{
		cmd = "var " + buttonList[i] + "_lo = new Image()"
		eval (cmd)
		cmd = "var " + buttonList[i] + "_hi = new Image()"
		eval (cmd)
		cmd = buttonList[i]
		cmd += "_lo.src = 'http://www.lsro.org/images/"
		cmd += 	buttonImgList[i]
		cmd +=	"_1.gif'"
		eval (cmd)
		cmd = buttonList[i]
		cmd += "_hi.src = 'http://www.lsro.org/images/"
		cmd += 	buttonImgList[i]
		cmd +=	"_2.gif'"
		eval (cmd)
	}

function hiliteOneButton(btnToLite){
	var hiliteType = ""
	for (i=0; i < buttonList.length; i++)	{
		if (buttonList[i] == this_page_name) {hiliteType = "_hi"}
		else if (buttonList[i] == btnToLite) {hiliteType = "_hi"}
		else	{hiliteType = "_lo"}
		cmd = "document." + buttonList[i] + ".src = " + buttonList[i] + hiliteType + ".src"
		eval (cmd)
	}
	// mouse would no longer be over a button
	if (btnToLite == this_page_name)	{
		mouseOverButton = 0
	}
}


function initialize(){

	hiliteOneButton(this_page_name)
	
	//	button objects
	obj_home_button=document.getElementById? document.getElementById("home_button_img") : home_button_img
	obj_about_button=document.getElementById? document.getElementById("about_button_img") : about_button_img
	obj_expertise_button=document.getElementById? document.getElementById("expertise_img") : expertise_img
	obj_services_button=document.getElementById? document.getElementById("services_img") : services_img
	obj_media_button=document.getElementById? document.getElementById("media_img") : media_img
	obj_articles_button=document.getElementById? document.getElementById("articles_img") : articles_img
	obj_ebooks_button=document.getElementById? document.getElementById("ebooks_img") : ebooks_img
	obj_career_button=document.getElementById? document.getElementById("career_img") : career_img
	obj_ric_button=document.getElementById? document.getElementById("ric_img") : ric_img
	obj_faqs_button=document.getElementById? document.getElementById("faqs_img") : faqs_img
//	obj_directions_button=document.getElementById? document.getElementById("directions_img") : directions_img

	//	dropdownmenu objects
	obj_dropmenudiv=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
	obj_dropmenudiv_sub1=document.getElementById? document.getElementById("dropmenudiv_sub1") : dropmenudiv_sub1

	// other objects
	obj_google_logo=document.getElementById? document.getElementById("google_logo") : google_logo

	register_object (obj_home_button)
	register_object (obj_about_button)
	register_object (obj_expertise_button)
	register_object (obj_services_button)
	register_object (obj_media_button)
	register_object (obj_articles_button)
	register_object (obj_ebooks_button)
	register_object (obj_career_button)
	register_object (obj_ric_button)
	register_object (obj_faqs_button)
//	register_object (obj_directions_button)
	register_object (obj_dropmenudiv)
	register_object (obj_dropmenudiv_sub1)



var ie4=document.all
var ns6=document.getElementById&&!document.all
	
// position google logo and search button
	obj_google_logo.style.position = "absolute"
	obj_google_logo.style.left = "736px"
	if (ie4)	{
		obj_google_logo.style.top = "124px"
	}
	else if (ns6)	{
		obj_google_logo.style.top = "114px"
	}
	obj_google_logo.style.zIndex = "200"
	obj_google_logo.style.visibility = "visible"
	
	if (debug_switch){
		tstWin = open("debugger_window.html", "HtstWin", "toolbar=no,width=460,height=600,scrollbars,resizable")
	}	

}


function debugg (t)	{
	if (debug_switch && tstWin){
		tstWin.document.frm_debug.ta_debug.value += t + "\n"
	}	
}

function register_object (obj)	{
	obj.onclick = manage_action
	obj.onmouseover = manage_action
	obj.onmouseout = manage_action
	if (obj.captureEvents) obj.captureEvents(Event.click)
	if (obj.captureEvents) obj.captureEvents(Event.mouseover)
	if (obj.captureEvents) obj.captureEvents(Event.mouseout)
}


function manage_action (e)	{

	// initialize variables
	buttonHasMenu = 0
	isTopMenuItem = 0
	isSubMenuItem = 0
	submenuExists = 0
	submenuName = ""
	submenuOffset = 0
	mouseOverButton = 0
	
	if (!e) {var e = window.event}
	e.cancelBubble = true;
	if (e.stopPropagation) e.stopPropagation();

	debugg ("Event: [" + e.type + "]")

	if (e.type == "mouseout") {
		delayhidemenu ('topmenu')
		delayhidemenu ('submenu')
		where_i_am = ""
		
		// if no menus are displayed, restore highlighting to original
		if (obj_dropmenudiv.style.visibility=="hidden"){
			hiliteOneButton(this_page_name)
		}
	}

	else if (e.type == "click") {
		if (ns6)	{where_i_am = e.target.id}
		if (ie4)	{where_i_am = e.srcElement.id}

		if (where_i_am == "home_button_img"){window.location.href = "http://www.lsro.org/home.html"}
		else if (where_i_am == "about_button_img"){window.location.href = "http://www.lsro.org/about/about_us_gen.html"}
		else if (where_i_am == "expertise_img"){window.location.href = "http://www.lsro.org/about/about_us_expertise.html"}
		else if (where_i_am == "services_img"){window.location.href = "http://www.lsro.org/services_gen.html"}
		else if (where_i_am == "media_img"){window.location.href = "http://www.lsro.org/media_gen.html"}
		else if (where_i_am == "articles_img"){window.location.href = "http://www.lsro.org/articles_gen.html"}
		else if (where_i_am == "ebooks_img"){window.location.href = "https://www.lsro.org/bookstore/new_session.asp"}
		else if (where_i_am == "career_img"){window.location.href = "http://www.lsro.org/career.html"}
		else if (where_i_am == "faqs_img"){window.location.href = "http://www.lsro.org/faq.html"}
		else if (where_i_am == "ric_img"){window.location.href = "http://www.lsro.org/ric/ric.html"}
		else if (where_i_am == "directions_img"){window.location.href = "http://www.lsro.org/directions.html"}
	}

	else if (e.type == "mouseover") {
// e.g.: mouse is over "About Us" button
// the id of this button is defined in the html page as "home_button_img"

		if (ns6)	{where_i_am = e.target.id}
		if (ie4)	{where_i_am = e.toElement.id}
// where_i_am = the id of the target (the 'About Us' button = "home_button_img"
		
		debugg ("\nwhere_i_am (at 'mouseover'): [" + where_i_am + "]")


// sift through all the allMenus entries to see if the first element is the
//		same as where_i_am, i.e., "home_button_image"
// if it matches, it means the mouse is over the button itself

		for (i=0; i<allMenus.length; i++)	{
			arrTemp = allMenus[i].split(",")
			if(arrTemp[0] == where_i_am){ // mouse is over button [where_i_am]
				mouseOverButton = 1
				i = allMenus.length
			}
		}

		debugg ("mouseOverButton: [" + mouseOverButton + "]")

		if (mouseOverButton)	{	// mouse is over button [where_i_am]
			// highlight the button
			// lowlight all other buttons except for page button
			// if the button has a top menu
			//		(it will appear as a first item somewhere in array [allMenus]	
			//		if the menu is already open
			//			cancel Top Menu timer
			//		if the menu is not open
			//			open the menu
			//				(even if a different menu is open this one will replace it?)
			
			// highlight selected button
			hiliteOneButton(where_i_am)

			// find out if this button has a menu
			buttonHasMenu = 0
			for (i=0; i<allMenus.length; i++)	{
				arrTemp = allMenus[i].split(",")
				if( arrTemp[0]==where_i_am && arrTemp[1] != "none"){
					buttonHasMenu = 1
					i = allMenus.length
				}
			}
			debugg ("buttonHasMenu value: [" + buttonHasMenu + "]")

			if (!(buttonHasMenu)){
				// stopTopMenuTimer('buttonHasMenu')
			}

			if (buttonHasMenu){
				// stop the timer
				// open the menu

				//	get the name of the menu array for the button's menu
				stopTopMenuTimer('buttonHasMenu')
				menuArray = "nothing"
				for (i=0; i<allMenus.length; i++)	{
					arrTemp = allMenus[i].split(",")
					if( arrTemp[0]==where_i_am && arrTemp[1] == "topMenuName"){
						menuArray = arrTemp[2]
						menuwidth = "" + arrTemp[3] + "px"
						i = allMenus.length
					}
				}
				// ... and open it
				cmd = "dropdownmenu(document.getElementById(where_i_am),obj_dropmenudiv, e, " + menuArray + ", menuwidth, 0, 'parent', 'manage_action_2A')"
//				cmd = "dropdownmenu(document.getElementById(where_i_am),obj_dropmenudiv, e, " + menuArray + ", menuwidth, 0, 'parent', 'manage_action_2A')"
				
				
				eval (cmd)
			}	// END: if (buttonHasMenu)
		}	// END: if (mouseOverButton)
			
		else	{		// [where_i_am] is not a button;
						//	mouse is over either a top menu item, a submenu item,
						//		or a container
						//
						// first find out if it's over a top menu item or submenu item
						// if it's not then ignore it and wait for the next mouseover event
						// 								
						//	Use the [allMenus] array for this
						//  [allMenus] elements contains the name of
						//		a button, a top menu item if the button has a menu,
						//		and the name of a submenu item if the top menu
						//		has a submenu;
						//		there is an allMenu array item for each submenu
						//			item;
						//		where a topmenu has no submenu, the array entry
						//			contains the button name, the topmenu name
						//			and "none" as the entry for the submenu
						//			Examples:
						//				allMenus[2] = "about_button_img,why_use,none"
						//				allMenus[5] = "about_button_img,staff_bios,brownawell"

			debugg ("mouseOverButton was 0; now at [else]:")

			// here we find out if mouse is over a top menu item,
			//	a submenu item, or something else
			arrTemp = new Array()
			for (i=0; i<allMenus.length; i++)	{
				arrTemp = allMenus[i].split(",")
				if (where_i_am == arrTemp[1])	{
					isTopMenuItem = 1
					i = allMenus.length
				}
				else if (where_i_am == arrTemp[2])	{
					isSubMenuItem = 1
					i = allMenus.length
				}
			}	// END: for (i=0; i<allMenus.length; i++)

			if(isTopMenuItem){debugg ("mouse is over a top menu item")}
			if(isSubMenuItem){debugg ("mouse is over a submenu item")}
			
			
			// if it's over a topmenu item:
			//		stop timer that hides the top menu
			//		find out whether the topmenu item has a submenu
			//			by searching the [allMenus] array:
			//			o find the first instance of the top menu as the
			//				first value in an array entry
			//			o if the second value in that array entry is "none"
			//				then the top menu item does not have a submenu
			//		if a submenu exists, open it
			//			O get the name of the submenu from the special entry
			//				versions of the [allMenus] array which contain
			//				the topmenu name as the first item of the entry,
			//				the keyword 'menuname' as the second item of the
			//				entry, and (unlike all other entries) a third item
			//				which is the submenu name
			//					Ex: allMenus[38] = "about_button_img,staff_bios,'subMenuName',menu1a,4"



//	allMenus[1] = "about_button_img,topMenuName,menu1,300"				// topmenu definintion
//	allMenus[2] = "about_button_img,staff_bios,subMenuName,menu1a,5"	// submenu definintion
//	allMenus[3] = "about_button_img,who_we_are,none"					// topmenu entry
//  ...
//  ...
//  ...
//	allMenus[7] = "about_button_img,staff_bios,allison"					// submenu entry


			// MOUSE IS OVER AN ITEM IN A TOPMENU
			if(isTopMenuItem){
				// stop timer
				stopTopMenuTimer('isTopMenuItem')

				// does topmenu item have a submenu?
				for (i=0; i<allMenus.length; i++)	{
					arrTemp = allMenus[i].split(",")
					if (where_i_am == arrTemp[1])	{
						if (arrTemp[2] != "none")	{
							submenuExists = 1
						}
						i = allMenus.length
					}
				}	//END: for (i=0; i<allMenus.length; i++)

				debugg ("where_i_am: [" + where_i_am + "]")

				if(submenuExists){debugg ("a submenu exists")}
				else{debugg ("a submenu DOES NOT exist")}
				
				// if it has a submenu, find out if the submenu is already open
				//		if it's open, stop the timer that would close it
				//		if it's not open, 
				//			- find out which submenu array to open
				//			- open the submenu
				if (submenuExists)	{
					stopSubMenuTimer('submenuExists')
					// submenu is not open, so open it
					for (i=0; i<allMenus.length; i++)	{
						arrTemp = allMenus[i].split(",")
						
//	e.g.:
//	allMenus[2] = "about_button_img,staff_bios,subMenuName,menu1a,5"	// submenu definintion
						
						if (where_i_am == arrTemp[1] && arrTemp[2] == "subMenuName")	{
								submenuName = arrTemp[3]
								submenuWidth = arrTemp[4]
								submenuOffset = arrTemp[5]
								i = allMenus.length
						}
					}	// END: for (i=0; i<allMenus.length; i++)
					debugg ("the submenu array is [" + submenuName + "]")
					debugg ("the submenu width is [" + submenuWidth + "]")
					debugg ("the submenu offset is [" + submenuOffset + "]")

					// now open the submenu
					cmd = "dropdownmenu(obj_dropmenudiv, obj_dropmenudiv_sub1, e, " + submenuName + ", submenuWidth, " + submenuOffset + ", 'sub1', 'submenuExists')"
					debugg ("the command for creating the submenu is\n" + cmd)
					eval (cmd)
				}	// END: if (submenuExists)
			}	// END: if(isTopMenuItem)
			// END: MOUSE IS OVER AN ITEM IN A TOPMENU


			// MOUSE IS OVER AN ITEM IN A SUBMENU
			else if(isSubMenuItem){
	debugg ("mouse is over a submenu item - Again")	
		
			// stop both topmenu & submenu timers 
				stopTopMenuTimer('overSubmenuItem')
				stopSubMenuTimer('overSubmenuItem')
			// highlight the topmenu item associated with the submenu
	debugg ("highlighting: where_i_am: [" + where_i_am + "]")
			// find the topmenu item associated with the submenu
			//	by searching allMenus array
			// e.g. allMenus[23] = "expertise_img,nutrition,nutrition_res"

			for (i=0; i<allMenus.length; i++)	{
				arrTemp = allMenus[i].split(",")
				if(arrTemp[2] == where_i_am){ // mouse is over button [where_i_am]
					objIdToHilite = arrTemp[1]
					i = allMenus.length
				}
			}
		debugg ("topmenu item to highlight: [" + objIdToHilite + "]")
			do_hilite(objIdToHilite)
			}	// END: else if(isSubMenuItem)
			// END: MOUSE IS OVER AN ITEM IN A SUBMENU



		}	// END: if (idxButton != -1)/else
	}	// END: else if (e.type == "mouseover")
}	// END: function manage_action (e)	{

function do_hilite(identifier){
			debugg("In do_hilite")
			obj_hilite = document.getElementById(identifier)
//			obj_hilite.style.backgroundColor="yellow"
			obj_hilite.style.backgroundColor=secondHiLiteColor
			hilite_obj = obj_hilite
}

function un_hilite(hiObj){
			debugg("In un_hilite")
			if (hiObj){
				debugg("un_hiliting " + hiObj.id)
				hiObj.style.backgroundColor=menubgcolor
			}
			else{
				debugg("no object to unhilite")
			}
}

function dropdownmenu(obj, dropmenuobj, e, menucontents, menuwidth, item_seq, level, caller){
	if (window.event) event.cancelBubble=true
	else if (e.stopPropagation) e.stopPropagation()
	debugg("dropdown menu; level is [" + level + "]")
	populatemenu(dropmenuobj, menucontents, "dropdownmenu()")

	if (ie4||ns6){
		showhide(dropmenuobj, e, "visible", "hidden", menuwidth, "dropdownmenu()")
		dropmenuobj.x=getposOffset(obj, "left", "dropdownmenu")
		dropmenuobj.y=getposOffset(obj, "top", "dropdownmenu")

		if (level == "parent"){
			stopTopMenuTimer("dropdownmenu_parent")
			dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, dropmenuobj, "rightedge", "dropdownmenu()")+"px"
			dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, dropmenuobj, "bottomedge", "dropdownmenu()")+obj.offsetHeight+"px"
		}

		else if (level == "sub1"){
			stopSubMenuTimer("dropdownmenu_sub")
			dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, dropmenuobj, "rightedge", "dropdownmenu()")
			temp_left=parseInt(dropmenuobj.style.left)
			dropmenuobj.style.left = temp_left + parseInt(obj.style.width) + "px"
			temp_top=parseInt(obj_dropmenudiv.style.top)
			debugg("temp_top object [" + obj_dropmenudiv.id + "]")
			debugg("temp_top [" + temp_top + "]")
			var offset = item_seq *lineheight
			debugg("offset [" + offset + "]")
			dropmenuobj.style.top= temp_top + (item_seq *lineheight) + "px"
		}
	}

	crv = clickreturnvalue('dropdownmenu()')
	return crv
}

function populatemenu(dropmenuobj, what, caller){
	if (ie4||ns6){dropmenuobj.innerHTML=what.join("")}
}

function showhide(dropmenuobj, e, visible, hidden, menuwidth, caller){
	if (ie4||ns6)
	dropmenuobj.style.left=dropmenuobj.style.top=-500
	if (menuwidth!=""){
	dropmenuobj.widthobj=dropmenuobj.style
	dropmenuobj.widthobj.width=menuwidth
	}
	debugg ("in showhide;")
	debugg ("e.type: " + e.type)
	debugg ("dropmenuobj.visibility: " + dropmenuobj.visibility)
//	if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")	{
	if (e.type=="click" && dropmenuobj.visibility==hidden || e.type=="mouseover")	{
//		debugg ("obj.visibility: " + obj.visibility)
		dropmenuobj.style.visibility=visible
	}
	else if (e.type=="click")	{
		dropmenuobj.visibility=hidden
	}
}

function clearbrowseredge(obj,dropmenuobj, whichedge, caller){
	var edgeoffset=0
	if (whichedge=="rightedge"){
		var windowedge=ie4 && !window.opera? iecompattest("clearbrowseredge()").scrollLeft+iecompattest("clearbrowseredge()").clientWidth-15 : window.pageXOffset+window.innerWidth-15
		dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
		if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
			edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
	}
	else{
		var windowedge=ie4 && !window.opera? iecompattest("clearbrowseredge()").scrollTop+iecompattest("clearbrowseredge()").clientHeight-15 : window.pageYOffset+window.innerHeight-18
		dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
		if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
		edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
	}
	return edgeoffset
}

function getposOffset (what, offsettype, caller) {
	dropmenuobj = document.getElementById("dropmenudiv")
	var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
	var parentEl=what.offsetParent;
	while (parentEl!=null){
		totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		parentEl=parentEl.offsetParent;
	}
	return totaloffset;
}

function iecompattest(caller){
	ret_val = (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
	return ret_val
}

function clickreturnvalue(caller){
	var rtnval = true
	if (ie4||ns6)	{
		rtnval = false
	}
	return rtnval
}

function delayhidemenu(which_menu, caller){
	debugg ("in [delayhidemenu]")
	if (ie4||ns6){
		if (which_menu == 'topmenu')	{
			if (!timer_index_top){
				timer_index_top=setTimeout("hidemenu(obj_dropmenudiv)", disappeardelay )
			}
		}
		
		else if (which_menu == 'submenu')	{
			if (!timer_index_sub){
				timer_index_sub=setTimeout("hidemenu(obj_dropmenudiv_sub1)", disappeardelay )
			}
		}
	}
}

function hidemenu(obj){
	if (obj)	{
		debugg_msg = "in [hidemenu]: [" + obj.id + "]"
	}
	else	{
		debugg_msg = "in [hidemenu]: [object not defined]"
	}	
	debugg (debugg_msg)
	if (obj && obj.style && typeof obj!="undefined"){
		if (ie4||ns6){
			obj.style.visibility="hidden"
			un_hilite(hilite_obj)
		}
	}

	// reset the highlighted buttons unless the mouse is over another button
	if (obj == obj_dropmenudiv){
		debugg ("hidemenu: obj = [" + obj.id + "]")
		timer_index_top = 0
		hiliteOneButton(this_page_name)

		mouseOverButton = 0
		for (i=0; i<allMenus.length; i++)	{
			arrTemp = allMenus[i].split(",")
			if(arrTemp[0] == where_i_am){ // mouse is over button [where_i_am]
				mouseOverButton = 1
				i = allMenus.length
			}
		}
		debugg ("hidemenu: mouseOverButton = [" + mouseOverButton + "]")
		if 	(mouseOverButton) { 
			hiliteOneButton(where_i_am) 
			debugg ("hidemenu: highliting = [" + where_i_am + "]")
		}
	}

	else if (obj == obj_dropmenudiv_sub1){
		timer_index_sub = 0
	}
}

function stopTopMenuTimer(caller){
	if (typeof timer_index_top!="undefined"){
		clearTimeout(timer_index_top)
		timer_index_top = 0
	}
}

function stopSubMenuTimer(caller){
	if (typeof timer_index_sub!="undefined"){
		clearTimeout(timer_index_sub)
		timer_index_sub = 0
	}
}



function reg4updates ()
{
	reg_win = open("", "reg_win2", "toolbar=no,width=650,height=600,scrollbars,resizable")
	document.frm_reg4updates.submit()		
}



if (hidemenu_onclick=="yes")	{
document.onclick=hidemenu
}



