// javascript menu builder
// original code by tkennedy@lycos-inc.com modified

// html for drop down menu
// all these strings contain the repeatable data for each menu type, minus all linebreaks.  all quotes should be properly escaped double quotes in order to produce valid html
dropDownmHead = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"152\"><tr><td class=\"white\" colspan=\"4\"><img src=\"/gdiweb/Templates/GDTItemplate2_SR.dwt\" width=\"152\" height=\"1\"></td></tr>";
dropDownspace = "<tr><td class=\"white\" width=\"1\"><img src=\"/gdiweb/Templates/GDTItemplate2_SR.dwt\" width=\"1\" height=\"5\" border=\"0\"></td><td class=\"dmenu\" width=\"12\"><img src=\"/gdiweb/Templates/GDTItemplate2_SR.dwt\" width=\"12\" height=\"1\" border=\"0\"></td><td class=\"dmenu\"><img src=\"/gdiweb/Templates/GDTItemplate2_SR.dwt\" width=\"1\" height=\"5\" border=\"0\"></td><td class=\"white\" width=\"1\"><img src=\"/gdiweb/Templates/GDTItemplate2_SR.dwt\" width=\"1\" height=\"5\" border=\"0\"></td></tr>";
dropDowntStart = "<tr><td class=\"white\" width=\"1\"><img src=\"/gdiweb/Templates/GDTItemplate2_SR.dwt\" width=\"1\" height=\"1\" border=\"0\"></td><td class=\"dmenu\" width=\"12\"><img src=\"/gdiweb/Templates/GDTItemplate2_SR.dwt\" width=\"12\" height=\"1\" border=\"0\"></td><td class=\"dmenu\"><table cellpadding=\"2\" cellspacing=\"0\" border=\"0\"><tr>";
dropDowntEnd = "</tr></table></td><td class=\"white\" width=\"1\"><img src=\"/gdiweb/Templates/GDTItemplate2_SR.dwt\" width=\"1\" height=\"1\" border=\"0\"></td></tr>";
dropDownlStart = "<tr><td class=\"white\" width=\"1\"><img src=\"/gdiweb/Templates/GDTItemplate2_SR.dwt\" width=\"1\" height=\"1\" border=\"0\"></td><td class=\"dmenu\" width=\"12\"><img src=\"/gdiweb/Templates/GDTItemplate2_SR.dwt\" width=\"12\" height=\"1\" border=\"0\"></td><td class=\"dmenu\"><table cellpadding=\"2\" cellspacing=\"0\" border=\"0\"><tr><td class=\"dmenu\"><a href=\"";
dropDownlMid = "\" class=\"dmenuLink\">";
dropDownlEnd = "</a></td></tr></table></td><td class=\"white\" width=\"1\"><img src=\"/gdiweb/Templates/GDTItemplate2_SR.dwt\" width=\"1\" height=\"1\" border=\"0\"></td></tr>";
dropDownsep = "<tr><td class=\"white\" width=\"1\"><img src=\"/gdiweb/Templates/GDTItemplate2_SR.dwt\" width=\"1\" height=\"1\" border=\"0\"></td><td class=\"dmenu\" width=\"12\"><img src=\"/gdiweb/Templates/GDTItemplate2_SR.dwt\" width=\"12\" height=\"1\" border=\"0\"></td><td class=\"dmenu\"><img src=\"/gdiweb/Templates/GDTItemplate2_SR.dwt\" width=\"124\" height=\"1\" border=\"0\"></td><td class=\"white\" width=\"1\"><img src=\"/gdiweb/Templates/GDTItemplate2_SR.dwt\" width=\"1\" height=\"1\" border=\"0\"></td></tr>";
dropDownmFoot = "<tr><td colspan=\"4\"><img src=\"dmenu_bottom.gif\" width=\"152\" height=\"14\" border=\"0\"></td></tr></table></div>";

//html for left nav
currentName = ""; //always blank out current name, just to be on the safe side
leftNavmHead = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\"><tr><td class=\"darkGrey\" width=\"14\"><img src=\"/gdiweb/Templates/GDTItemplate2_SR.dwt\" width=\"14\" height=\"1\"></td>	<td class=\"darkGrey\"><img src=\"/gdiweb/Templates/GDTItemplate2_SR.dwt\" width=\"1\" height=\"14\"></td><td class=\"darkGrey\" width=\"14\"><img src=\"/gdiweb/Templates/GDTItemplate2_SR.dwt\" width=\"14\" height=\"1\"></td></tr>";
leftNavtStart = "<tr><td class=\"darkGrey\"><img src=\"/gdiweb/Templates/GDTItemplate2_SR.dwt\" width=\"1\" height=\"1\"></td><td class=\"darkGrey\"><table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" width=\"100%\"><tr>";
leftNavtEnd = "</tr></table></td><td class=\"darkGrey\"><img src=\"/gdiweb/Templates/GDTItemplate2.dwt\" width=\"1\" height=\"1\"></td></tr>";
leftNavlStart = "<tr><td class=\"darkGrey\"><img src=\"/gdiweb/Templates/GDTItemplate2_SR.dwt\" width=\"1\" height=\"1\"></td><td class=\"darkGrey\"><table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" width=\"100%\"><tr><td class=\"textWhite\"><a href=\"";
leftNavlMid = "\" class=\"dmenuLink\">";
leftNavlEnd = "</a></td></tr></table></td><td class=\"darkGrey\"><img src=\"/gdiweb/Templates/GDTItemplate2_SR.dwt\" width=\"1\" height=\"1\"></td></tr>";
leftNavspace = "<tr><td class=\"darkGrey\" colspan=\"3\"><img src=\"/gdiweb/Templates/GDTItemplate2_SR.dwt\" width=\"1\" height=\"19\"></td></tr>";
leftNavsep = "<tr><td class=\"darkGrey\"><img src=\"/gdiweb/Templates/GDTItemplate2_SR.dwt\" width=\"1\" height=\"1\"></td><td class=\"darkGrey\"><img src=\"http://a4.g.akamai.net/f/4/445/12h/www.tripod.lycos.com/img/dmenu/dmenu_seperator.gif\" width=\"124\" height=\"1\"></td><td class=\"darkGrey\"><img src=\"/gdiweb/Templates/GDTItemplate2_SR.dwt\" width=\"1\" height=\"1\"></td></tr>";
leftNavmFoot = "<tr><td class=\"darkGrey\" colspan=\"2\"><img src=\"/gdiweb/Templates/GDTItemplate2_SR.dwt\" width=\"138\" height=\"1\"></td><td width=\"14\" align=\"right\"></td></tr></table>";


//menu items and specific links
//each menu requires 5 variables
//mDiv : the code to create the div tag wrapper for the dropdown
//mMainLink : this will only be used on the div tag.  currently, this is depreciated
//dropDowntitleName : this contains the table cells, with the menu sub titles wrapped in the correct css class
//leftNavtitleName: this is the same as above, but for leftNav items.  
//MenuItems : this is a mutlidimentional packed array.  Each element in the array is a new 2-element packed array consisting of the Text for the Link, and the URL for the link
// 	the keywoards space, title, sep are reserved.  
//	space : causes a vertical space defined by [menuType]space
//	title : prints out the next title as defined by the [menuType]titleName array
//	sep   : print out a vertical spacer defined by [menuType]sep

//about
aboutmDiv = "<div id=\"about\" class=\"hiddenMenu\" onMouseOver=\"showMenu('about');\" onMouseOut=\"hideMenu('about');\">";
aboutmMainLink = "<a href=\"/about.htm\" class=\"dmenuTitleLink\">ABOUT</a></td><td class=\"white\" width=\"1\" valign=\"top\" height=\"18\"><img src=\"/gdiweb/Templates/GDTItemplate2_SR.dwt\" width=\"1\" height=\"18\" border=\"0\"></td></tr>";
aboutdropDowntitleName = new Array ("<td class=\"dmenuTitle\">ABOUT&nbsp;US</td>","<a href=work.htm class=\"dmenuTLink\">AREAS&nbsp;OF&nbsp;WORK</a></td>","<a href=news.htm class=\"dmenuTLink\">GDI&nbsp;IN&nbsp;THE&nbsp;NEWS</a></td>","<a href=contact.htm class=\"dmenuTLink\">CONTACT&nbsp;US</td>","<a href=privacy_policy.htm class=\"dmenuTLink\">PRIVACY&nbsp;POLICY</td>");
aboutleftNavtitleName = new Array ("<a href=about.htm title=About&nbsp;GDI class=\"textGreenHeavyLink\">ABOUT&nbsp;US</a></td>","<a href=work.htm title=Our&nbsp;Work class=\"textGreenHeavyLink\">AREAS OF WORK</a></td>","<a href=news.htm class=\"textGreenHeavyLink\">GDI&nbsp;IN&nbsp;THE&nbsp;NEWS</a></td>","<a href=contact.htm class=\"textGreenHeavyLink\">CONTACT&nbsp;US</a></td>","<a href=privacy_policy.htm class=\"textGreenHeavyLink\">PRIVACY&nbsp;POLICY</a></td>");
aboutMenuItems = [["title","title"],
							["Mission","mission.htm"],
							["Staff","staff.htm"],
							["sep","sep"],
							["space","space"],
							["title","title"],
							["Technology","work.htm#technology"],
							["Education Reform","work.htm#education"],
							["Gendered Violence","work.htm#violence"],
							["Work & Economy","work.htm#work"],
							["sep","sep"],
							["space","space"],
							["title","title"],
							["Promising Practices","impact.htm"],
							["sep","sep"],
							["space","space"],
							["title","title"],
							["sep","sep"],
							["space","space"],
							["title","title"]];
							
//projects						
projectsmDiv = "<div id=\"projects\" class=\"hiddenMenu\" onMouseOver=\"showMenu('projects');\" onMouseOut=\"hideMenu('projects');\">";
projectsmMainLink = "<a href=\"/projectoverview.htm\" class=\"dmenuTitleLink\">PROJECTS</a></td><td class=\"white\" width=\"1\" valign=\"top\" height=\"18\"><img src=\"/gdiweb/Templates/GDTItemplate2_SR.dwt\" width=\"1\" height=\"18\" border=\"0\"></td></tr>";
projectsdropDowntitleName = new Array ("<a href=CaREN.htm  class=\"dmenuTLink\">CaREN</td>","<a href=ITEST.htm  class=\"dmenuTLink\">ITEST</td>","<a href=SLC.htm class=\"dmenuTLink\">SCIENCE&nbsp;OF&nbsp;LEARNING CENTER</td>","<a href=effectiveaccess.htm class=\"dmenuTLink\">EFFECTIVE&nbsp;ACCESS</a></td>","<a href=breakingbarriers.htm class=\"dmenuTLink\">BREAKING&nbsp;BARRIERS</a></td>","<a href=GSDL.htm  class=\"dmenuTLink\">GSDL</td>","<a href=GEMS.htm  class=\"dmenuTLink\">GEMS</td>","<a href=ghrs.htm  class=\"dmenuTLink\">GHRS</td>","<a href=WEEA.htm  class=\"dmenuTLink\">WEEA</td>","<a href=DancingForward/index.htm  class=\"dmenuTLink\">Dancing Forward for a Change</td>");
projectsleftNavtitleName = new Array ("<a href=CaREN.htm  class=\"textGreenHeavyLink\">CaREN</td>","<a href=ITEST.htm  class=\"textGreenHeavyLink\">ITEST</td>","<a href=SLC.htm  class=\"textGreenHeavyLink\">SCIENCE OF LEARNING CENTER</td>","<a href=effectiveaccess.htm class=\"textGreenHeavyLink\">EFFECTIVE&nbsp;ACCESS</td>","<a href=breakingbarriers.htm class=\"textGreenHeavyLink\">BREAKING&nbsp;BARRIERS</td>","<a href=GSDL.htm  class=\"textGreenHeavyLink\">GSDL</td>","<a href=GEMS.htm  class=\"textGreenHeavyLink\">GEMS</td>","<a href=ghrs.htm  class=\"textGreenHeavyLink\">GHRS</td>","<a href=WEEA.htm  class=\"textGreenHeavyLink\">WEEA</td>","<a href=DancingForward/index.htm  class=\"textGreenHeavyLink\">WEEA</td>");
projectsMenuItems =  [["title","title"],
							["sep","sep"],
							["space","space"],
							["title","title"],
							["sep","sep"],
							["space","space"],
							["title","title"],
							["sep","sep"],
							["space","space"],
							["title","title"],
							["Literature Review","javascript:litPop();"],
							["sep","sep"],
							["space","space"],
							["title","title"],
							["Data","breaking_data.htm"],
							["sep","sep"],
							["space","space"],
							["title","title"],
							["GSDL Website","javascript:gsdlPop();"],
							["sep","sep"],
							["space","space"],
							["title","title"],
							["Advisors","GEMS_advisors.htm"],
							["Research","GEMS_research.htm"],
							["sep","sep"],
							["space","space"],
							["title","title"],
							["Projects","ghrs_projects.htm"],
							["Gender Notes","ghrs_gendernotes.htm"],
							["Resources","ghrs_resources.htm"],
							["News", "ghrs_news.htm"],
							["sep","sep"],
							["space","space"],
							["title","title"],
							["WEEA Website","javascript:weeaPop();"]];

//pd
pdmDiv = "<div id=\"pd\" class=\"hiddenMenu\" onMouseOver=\"showMenu('pd');\" onMouseOut=\"hideMenu('pd');\">";
pdmMainLink = "<a href=\"/ProfessionalDevelopment.htm\" class=\"dmenuTitleLink\">PROFESSIONAL&nbsp;DEVELOPMENT</a></td><td class=\"white\" width=\"1\" valign=\"top\" height=\"18\"><img src=\"/gdiweb/Templates/GDTItemplate2_SR.dwt\" width=\"1\" height=\"18\" border=\"0\"></td></tr>";
pddropDowntitleName = new Array ("<a href=workshops.asp class=\"dmenuTLink\">WORKSHOPS</td>","<a href=courses.htm class=\"dmenuTLink\">ONLINE&nbsp;COURSES</td>");
pdleftNavtitleName = new Array ("<a href=workshops.asp class=\"textGreenHeavyLink\">WORKSHOPS</td>","<a href=courses.htm class=\"textGreenHeavyLink\">ONLINE&nbsp;COURSES</td>");
pdMenuItems = [	["title","title"],
							["sep","sep"],
							["space","space"],
							["title","title"],
							["Engaging Girls in Math and Science","engaging_girls.htm"],
							["Raising and Educating Boys","raising_boys.htm"],
							["Infusing Equity into Practice","infusing_equity.htm"]];

//pub
pubmDiv = "<div id=\"pub\" class=\"hiddenMenu\" onMouseOver=\"showMenu('pub');\" onMouseOut=\"hideMenu('pub');\">";
pubmMainLink = "<a href=\"/publications.htm\"  class=\"dmenuTitleLink\">PUBLICATIONS</a></td><td class=\"white\" width=\"1\" valign=\"top\" height=\"18\"><img src=\"/gdiweb/Templates/GDTItemplate2_SR.dwt\" width=\"1\" height=\"18\" border=\"0\"></td></tr>";
pubdropDowntitleName = new Array ("<td class=\"dmenuTitle\">PUBLICATIONS</td>","<a href=newsletters.htm class=\"dmenuTLink\">NEWSLETTERS</td>");
publeftNavtitleName = new Array ("<td class=\"textGreenHeavy\">PUBLICATIONS</td>","<a href=newsletters.htm class=\"textGreenHeavyLink\">NEWSLETTERS</td>");
pubMenuItems =  [	["title","title"],
							["Technology","technology_publications.htm"],
							["Education Reform","educational_reform_publications.htm"],
							["Gendered Violence","gendered_violence_publications.htm"],
							["Work & Economy","work_economy_masculinities_publications.htm"],
							["",""],
							["sep","sep"],
							["space","space"],
							["title","title"]];


//resources
resourcesmDiv = "<div id=\"resources\" class=\"hiddenMenu\" onMouseOver=\"showMenu('resources');\" onMouseOut=\"hideMenu('resources');\">";
resourcesmMainLink = "<a href=\"/resources.htm\"  class=\"dmenuTitleLink\">RESOURCES</a></td><td class=\"white\" width=\"1\" valign=\"top\" height=\"18\"><img src=\"/gdiweb/Templates/GDTItemplate2_SR.dwt\" width=\"1\" height=\"18\" border=\"0\"></td></tr>";
resourcesdropDowntitleName = new Array ("<a href=request_form.asp class=\"dmenuTLink\">INFORMATION&nbsp;REQUEST</td>","<a href=links.htm class=\"dmenuTLink\">LINKS</td>","<td class=\"dmenuTitle\">ELECTRONIC&nbsp;MAILINGS</td>","<a href=link_to_us.htm title=Instructions class=\"dmenuTLink\">LINK&nbsp;TO&nbsp;US</td>","<a href=events.htm class=\"dmenuTLink\">EVENTS&nbsp;CALENDAR</td>","<td class=\"dmenuTitle\">FACTS</td>","<a href=Site_Map.htm class=\"dmenuTLink\">SITE&nbsp;MAP</td>");
resourcesleftNavtitleName = new Array ("<a href=request_form.asp class=\"textGreenHeavyLink\">INFORMATION REQUEST</td>","<a href=links.htm class=\"textGreenHeavyLink\">LINKS</td>","<td class=\"textGreenHeavy\">ELECTRONIC MAILINGS</td>","<a href=link_to_us.htm  class=\"textGreenHeavyLink\">LINK&nbsp;TO&nbsp;US</td>","<a href=events.htm class=\"textGreenHeavyLink\">EVENTS&nbsp;CALENDAR</td>","<td class=\"textGreenHeavy\">FACTS</td>","<a href=Site_Map.htm class=\"textGreenHeavyLink\">SITE&nbsp;MAP</td>");
resourcesMenuItems =  [	["title","title"],
							["sep","sep"],
							["space","space"],
							["title","title"],
							["sep","sep"],
							["space","space"],
							["title","title"],
							["Sign Up","mailinglist.htm"],
							["sep","sep"],
							["space","space"],
							["title","title"],
							["sep","sep"],
							["space","space"],
							["title","title"],
							["sep","sep"],
							["space","space"],
							["title","title"],
							["Technology","http://www2.edc.org/GDI/Technology_Facts.htm"],
							["Education Reform","http://www2.edc.org/GDI/Educational_Reform_Facts.htm"],
							["Gendered Violence","http://www2.edc.org/GDI/Gendered_Violence_Facts.htm"],
							["Work & Economy","http://www2.edc.org/GDI/Work_Economy_Facts.htm"],
							["sep","sep"],
							["space","space"],
							["title","title"]];

//login
loginmDiv = "<div id=\"login\" class=\"hiddenMenu\" onMouseOver=\"showMenu('login');\" onMouseOut=\"hideMenu('login');\">";
loginmMainLink = "<a href=\"/loginHome.htm\" class=\"dmenuTitleLink\">LOG-IN</a></td><td class=\"white\" width=\"1\" valign=\"top\" height=\"18\"><img src=\"/gdiweb/Templates/GDTItemplate2_SR.dwt\" width=\"1\" height=\"18\" border=\"0\"></td></tr>";
logindropDowntitleName = new Array ("<td class=\"dmenuTitle\">MEMBERS</td>","<td class=\"dmenuTitle\">REGISTER</td>");
loginleftNavtitleName = new Array ("<td class=\"textGreenHeavy\">MEMBERS</td>","<td class=\"textGreenHeavy\">REGISTER</td>");
loginMenuItems =  [	["title","title"],
							["Log-in",""],
							["sep","sep"],
							["space","space"],
							["title","title"],
							["Benefits",""],
							["Create an account",""]];
							
//home
homemDiv = "<div id=\"home\" class=\"hiddenMenu\" onMouseOver=\"showMenu('home');\" onMouseOut=\"hideMenu('home');\">";
homemMainLink = "<a href=\"/work.htm\"  class=\"dmenuTitleLink\">AREAS&nbsp;OF&nbsp;WORK</a></td><td class=\"white\" width=\"1\" valign=\"top\" height=\"18\"><img src=\"/gdiweb/Templates/GDTItemplate2_SR.dwt\" width=\"1\" height=\"18\" border=\"0\"></td></tr>";
homeleftNavtitleName = new Array ("<a href=work.htm class=\"textRedHeavyLink\">AREAS&nbsp;OF&nbsp;WORK</td>","<a href=work.htm#technology class=\"dmenuHLink\">Technology</td>","<a href=work.htm#education class=\"dmenuHLink\">Education Reform</td>","<a href=work.htm#violence class=\"dmenuHLink\">Gendered Violence</td>","<a href=work.htm#work class=\"dmenuHLink\">Work &amp; Economy</td>");
homeMenuItems =  [	["title","title"],
							["space","space"],
							["title","title"],
							["space","space"],
							["title","title"],
							["space","space"],
							["title","title"],
							["space","space"],
							["title","title"],
							["space","space"]];							



//domains -- no drop down, only left nav.  uses my account drop down
domainsmDiv = "<div id=\"domains\" class=\"hiddenMenu\" onMouseOver=\"showMenu('myaccount');\" onMouseOut=\"hideMenu('myaccount');\">";
domainsmMainLink = "<a href=\"/adm/redirect/www/service/manage/preferences\" class=\"dmenuTitleLink\">MY&nbsp;ACCOUNT</a></td><td class=\"white\" width=\"1\" valign=\"top\" height=\"18\"><img src=\"/Templates/GDTItemplate2.dwt\" width=\"1\" height=\"18\" border=\"0\"></td></tr>";
domainsdropDowntitleName = new Array ("<td class=\"dmenuTitle\">MY&nbsp;ACCOUNT</td>");
domainsleftNavtitleName = new Array ("<td class=\"textGreenHeavy\">MY&nbsp;ACCOUNT</td>");
domainsMenuItems =  [	["title","title"],
							["Tripod","/adm/redirect/www/service/manage/preferences"],
							["Hosting","/adm/redirect/www/service/manage/hosting"],
							["Domains","/adm/redirect/domains/service/select"],
							["E-Mail","/adm/redirect/domains/service/email/overview"]];




// buildMenu(menuName, menuType);
// menuName - the unique identifier of the array set of data for this menu (ie, members)
// menuType - either leftNav or dropDown
// this is the second parameter to the function call.
// the leftnav type will print in place, and the code will create a 
// fully enclosed table.  the dropdown type will create a div
// whose css class should have visibility: hidden; set.  dmenu.js contains
// the code to hide and show the menu correctly, based on page position


function buildMenu(menuName,menuType) {
	//set up some information and find the arrays we'll need based on the menuName
	var titleNum = 0; 
	var titleStart = eval(menuType+"tStart");
	var titleEnd = eval(menuType+"tEnd");
	var lineStart = eval(menuType+"lStart");
	var lineMid = eval(menuType+"lMid");
	var lineEnd = eval(menuType+"lEnd");
	var menuDiv = eval(menuName+"mDiv");
	var menuHead = eval(menuType+"mHead");
	var menuFoot = eval(menuType+"mFoot");
	var menuMainLink = eval(menuName+"mMainLink");
	var seperator = eval(menuType+"sep");
	var spacer = eval(menuType+"space");
	var menuItemArray = eval(menuName+"MenuItems");
	var menuTitlesArray = eval(menuName+menuType+"titleName");
	var arrayLength = menuItemArray.length;
	
	//print out menu header, beginning of table
	//if we're doing a dropDown, we'll need the extra information about the surrounding div that makes the table positioning absolute and hides it from view on laod
	if(menuType == "dropDown"){
		document.write(menuDiv+menuHead+"\n"); //+menuMainLink+
	} else {
		document.write(menuHead+"\n");
	}
	
	// print out each row of the table.  note the special keywords, sep, space, title
	for(i=0; i < arrayLength; i++) {
    	var name = menuItemArray[i][0];
    	var currentURL = menuItemArray[i][1];
	
		if(name == "sep") {
			document.write(seperator);
		} else if (name == "space") {
			document.write(spacer);
		} else {
			if(name == "title"){
				var title = menuTitlesArray[titleNum];
				document.write(titleStart+title+titleEnd);
				titleNum = titleNum + 1;
			} else {
				if ((menuType == "leftNav") && (currentName == name)){
					document.write(lineStart+currentURL+lineMid+"<b>"+name+"</b>"+lineEnd);
				} else {
					document.write(lineStart+currentURL+lineMid+name+lineEnd);
				}
			}
		}
	}
	//close tables and menu.
	document.write(menuFoot);
}