// javascript menu builder
// tkennedy@lycos-inc.com

// 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=\"http://www.pwpix.net/images/transpixel.gif\" width=\"152\" height=\"1\"></td></tr>";
dropDownspace = "<tr><td class=\"white\" width=\"1\"><img src=\"http://www.pwpix.net/images/transpixel.gif\" width=\"1\" height=\"5\" border=\"0\"></td><td class=\"dmenu\" width=\"12\"><img src=\"http://www.pwpix.net/images/transpixel.gif\" width=\"12\" height=\"1\" border=\"0\"></td><td class=\"dmenu\"><img src=\"http://www.pwpix.net/images/transpixel.gif\" width=\"1\" height=\"5\" border=\"0\"></td><td class=\"white\" width=\"1\"><img src=\"http://www.pwpix.net/images/transpixel.gif\" width=\"1\" height=\"5\" border=\"0\"></td></tr>";
dropDowntStart = "<tr><td class=\"white\" width=\"1\"><img src=\"http://www.pwpix.net/images/transpixel.gif\" width=\"1\" height=\"1\" border=\"0\"></td><td class=\"dmenu\" width=\"12\"><img src=\"http://www.pwpix.net/images/transpixel.gif\" 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=\"http://www.pwpix.net/images/transpixel.gif\" width=\"1\" height=\"1\" border=\"0\"></td></tr>";
dropDownlStart = "<tr><td class=\"white\" width=\"1\"><img src=\"http://www.pwpix.net/images/transpixel.gif\" width=\"1\" height=\"1\" border=\"0\"></td><td class=\"dmenu\" width=\"12\"><img src=\"http://www.pwpix.net/images/transpixel.gif\" 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=\"http://www.pwpix.net/images/transpixel.gif\" width=\"1\" height=\"1\" border=\"0\"></td></tr>";
dropDownsep = "<tr><td class=\"white\" width=\"1\"><img src=\"http://www.pwpix.net/images/transpixel.gif\" width=\"1\" height=\"1\" border=\"0\"></td><td class=\"dmenu\" width=\"12\"><img src=\"http://www.pwpix.net/images/transpixel.gif\" width=\"12\" height=\"1\" border=\"0\"></td><td class=\"dmenu\"><img src=\"http://www.pwpix.net/images/transpixel.gif\" width=\"124\" height=\"1\" border=\"0\"></td><td class=\"white\" width=\"1\"><img src=\"http://www.pwpix.net/images/transpixel.gif\" width=\"1\" height=\"1\" border=\"0\"></td></tr>";
dropDownmFoot = "<tr><td colspan=\"4\"><img src=\"http://www.pwpix.net/images/transpixel.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=\"http://www.pwpix.net/images/transpixel.gif\" width=\"14\" height=\"1\"></td>	<td class=\"darkGrey\"><img src=\"http://www.pwpix.net/images/transpixel.gif\" width=\"1\" height=\"14\"></td><td class=\"darkGrey\" width=\"14\"><img src=\"http://www.pwpix.net/images/transpixel.gif\" width=\"14\" height=\"1\"></td></tr>";
leftNavtStart = "<tr><td class=\"darkGrey\"><img src=\"http://www.pwpix.net/images/transpixel.gif\" 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=\"http://www.pwpix.net/images/transpixel.gif\" width=\"1\" height=\"1\"></td></tr>";
leftNavlStart = "<tr><td class=\"darkGrey\"><img src=\"http://www.pwpix.net/images/transpixel.gif\" 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=\"http://www.pwpix.net/images/transpixel.gif\" width=\"1\" height=\"1\"></td></tr>";
leftNavspace = "<tr><td class=\"darkGrey\" colspan=\"3\"><img src=\"http://www.pwpix.net/images/transpixel.gif\" width=\"1\" height=\"19\"></td></tr>";
leftNavsep = "<tr><td class=\"darkGrey\"><img src=\"http://www.pwpix.net/images/transpixel.gif\" width=\"1\" height=\"1\"></td><td class=\"darkGrey\"><img src=\"http://www.pwpix.net/images/transpixel.gif\" width=\"124\" height=\"1\"></td><td class=\"darkGrey\"><img src=\"http://www.pwpix.net/images/transpixel.gif\" width=\"1\" height=\"1\"></td></tr>";
leftNavmFoot = "<tr><td class=\"darkGrey\" colspan=\"2\"><img src=\"http://www.pwpix.net/images/transpixel.gif\" width=\"138\" height=\"1\"></td><td width=\"14\" align=\"right\"><img src=\"http://www.pwpix.net/images/transpixel.gif\" width=\"14\" height=\"14\"></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
//build
buildmDiv = "<div id=\"build\" class=\"hiddenMenu\" onMouseOver=\"showMenu('build');\" onMouseOut=\"hideMenu('build');\">";
buildmMainLink = "<a href=\"/adm/redirect/www/build/index.html\" class=\"dmenuTitleLink\">WWF SUPERSTARS</a></td><td class=\"white\" width=\"1\" valign=\"top\" height=\"18\"><img src=\"http://www.pwpix.net/images/transpixel.gif\" width=\"1\" height=\"18\" border=\"0\"></td></tr>";
builddropDowntitleName = new Array ("<td class=\"dmenuTitle\">WWF SUPERSTARS</td>");
buildleftNavtitleName = new Array ("<td class=\"textGreenHeavy\">WWF SUPERSTARS</td>");
buildMenuItems = [["title","title"],
["Hulk Hogan","http://www.pwpix.net/RingsideWith/HulkHogan/main/"],
["Miss Elizabeth","http://www.pwpix.net/RingsideWith/MissElizabeth/main/"]];
							
//tools						
toolsmDiv = "<div id=\"tools\" class=\"hiddenMenu\" onMouseOver=\"showMenu('tools');\" onMouseOut=\"hideMenu('tools');\">";
toolsmMainLink = "<a href=\"/adm/redirect/www/tools/index.html\" class=\"dmenuTitleLink\">WWF SUPERSTARS</a></td><td class=\"white\" width=\"1\" valign=\"top\" height=\"18\"><img src=\"http://www.pwpix.net/images/transpixel.gif\" width=\"1\" height=\"18\" border=\"0\"></td></tr>";
toolsdropDowntitleName = new Array ("<td class=\"dmenuTitle\">WWF SUPERSTARS</td>");
toolsleftNavtitleName = new Array ("<td class=\"textGreenHeavy\">WWF SUPERSTARS</td>");
toolsMenuItems =  [["title","title"],
["Alundra Blayze","http://www.pwpix.net/RingsideWith/Madusa/main/"]];

//host
hostmDiv = "<div id=\"host\" class=\"hiddenMenu\" onMouseOver=\"showMenu('host');\" onMouseOut=\"hideMenu('host');\">";
hostmMainLink = "<a href=\"/adm/redirect/www/service/manage/hosting\" class=\"dmenuTitleLink\">WWF SUPERSTARS</a></td><td class=\"white\" width=\"1\" valign=\"top\" height=\"18\"><img src=\"http://www.pwpix.net/images/transpixel.gif\" width=\"1\" height=\"18\" border=\"0\"></td></tr>";
hostdropDowntitleName = new Array ("<td class=\"dmenuTitle\">WWF SUPERSTARS</td>");
hostleftNavtitleName = new Array ("<td class=\"textGreenHeavy\">WWF SUPERSTARS</td>");
hostMenuItems = [	["title","title"],
["Debra","http://www.pwpix.net/RingsideWith/Debra/main/"],
["Molly Holly","http://www.pwpix.net/RingsideWith/MollyHolly/main"],
["Stacy Keibler","http://www.pwpix.net/RingsideWith/StacyKeibler/main/"],
["Stephanie McMahon","http://www.pwpix.net/RingsideWith/StephanieMcMahon/main/"],
["Torrie Wilson","http://www.pwpix.net/RingsideWith/TorrieWilson/main/"],
["Trish Stratus","http://www.pwpix.net/RingsideWith/TrishStratus/main/"]];

//small business
smallbizmDiv = "<div id=\"smallbiz\" class=\"hiddenMenu\" onMouseOver=\"showMenu('smallbiz');\" onMouseOut=\"hideMenu('smallbiz');\">";
smallbizmMainLink = "<a href=\"/adm/redirect/www/smallbiz/index.html\" class=\"dmenuTitleLink\">WWE RAW SUPERSTARS</a></td><td class=\"white\" width=\"1\" valign=\"top\" height=\"18\"><img src=\"http://www.pwpix.net/images/transpixel.gif\" width=\"1\" height=\"18\" border=\"0\"></td></tr>";
smallbizdropDowntitleName = new Array ("<td class=\"dmenuTitle\">WWE RAW SUPERSTARS</td>");
smallbizleftNavtitleName = new Array ("<td class=\"textGreenHeavy\">WWE RAW SUPERSTARS</td>");
smallbizMenuItems =  [	["title","title"],
["Molly Holly","http://www.pwpix.net/RingsideWith/MollyHolly/main"],
["Stacy Keibler","http://www.pwpix.net/RingsideWith/StacyKeibler/main/"],
["Trish Stratus","http://www.pwpix.net/RingsideWith/TrishStratus/main/"]];
//members
membersmDiv = "<div id=\"members\" class=\"hiddenMenu\" onMouseOver=\"showMenu('members');\" onMouseOut=\"hideMenu('members');\">";
membersmMainLink = "<a href=\"/adm/redirect/www/members/index.html\" class=\"dmenuTitleLink\">WWE SMACKDOWN! SUPERSTARS</a></td><td class=\"white\" width=\"1\" valign=\"top\" height=\"18\"><img src=\"http://www.pwpix.net/images/transpixel.gif\" width=\"1\" height=\"18\" border=\"0\"></td></tr>";
membersdropDowntitleName = new Array ("<td class=\"dmenuTitle\">SMACKDOWN! STARS</td>");
membersleftNavtitleName = new Array ("<td class=\"textGreenHeavy\">SMACKDOWN! STARS</td>");
membersMenuItems =  [	["title","title"],
["Dawn Marie","http://www.pwpix.net/RingsideWith/DawnMarie/main"],
["Sable","http://www.pwpix.net/RingsideWith/Sable/main/"],
["Stephanie McMahon","http://www.pwpix.net/RingsideWith/StephanieMcMahon/main/"],
["Torrie Wilson","http://www.pwpix.net/RingsideWith/TorrieWilson/main/"]];


//my account
myaccountmDiv = "<div id=\"myaccount\" class=\"hiddenMenu\" onMouseOver=\"showMenu('myaccount');\" onMouseOut=\"hideMenu('myaccount');\">";
myaccountmMainLink = "<a href=\"/adm/redirect/www/service/manage/preferences\" class=\"dmenuTitleLink\">WCW SUPERSTARS</a></td><td class=\"white\" width=\"1\" valign=\"top\" height=\"18\"><img src=\"http://www.pwpix.net/images/transpixel.gif\" width=\"1\" height=\"18\" border=\"0\"></td></tr>";
myaccountdropDowntitleName = new Array ("<td class=\"dmenuTitle\">WCW SUPERSTARS</td>");
myaccountleftNavtitleName = new Array ("<td class=\"textGreenHeavy\">WCW SUPERSTARS</td>");
myaccountMenuItems =  [	["title","title"],
["Debra McMichael","http://www.pwpix.net/RingsideWith/Debra/main/"],
["Elizabeth","http://www.pwpix.net/RingsideWith/MissElizabeth/main/"],
["Hollywood Hogan","http://www.pwpix.net/RingsideWith/HulkHogan/main/"],
["Kimberly Page","http://www.pwpix.net/RingsideWith/KimberlyPage/main/"],
["Madusa","http://www.pwpix.net/RingsideWith/Madusa/main/"],
["Miss Hancock","http://www.pwpix.net/RingsideWith/StacyKeibler/main/"],
["Mona","http://www.pwpix.net/RingsideWith/MollyHolly/main/"],
["Torrie Wilson","http://www.pwpix.net/RingsideWith/TorrieWilson/main/"]];


//domains -- no drop down, only left nav.  uses my account drop down
domainsmDiv = "<div id=\"domains\" class=\"hiddenMenu\" onMouseOver=\"showMenu('domains');\" onMouseOut=\"hideMenu('domains');\">";
domainsmMainLink = "<a href=\"/adm/redirect/www/service/manage/preferences\" class=\"dmenuTitleLink\">NWA-TNA SUPERSTARS</a></td><td class=\"white\" width=\"1\" valign=\"top\" height=\"18\"><img src=\"http://www.pwpix.net/images/transpixel.gif\" width=\"1\" height=\"18\" border=\"0\"></td></tr>";
domainsdropDowntitleName = new Array ("<td class=\"dmenuTitle\">TNA SUPERSTARS</td>");
domainsleftNavtitleName = new Array ("<td class=\"textGreenHeavy\">TNA SUPERSTARS</td>");
domainsMenuItems =  [	["title","title"],
							["Goldylocks","http://www.pwpix.net/RingsideWith/Goldylocks/main/"]];





// 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);
}