/*
Menus are created with an array for each.
The first 3 elements are the name+level, the name and the width for the menu
The next 6 are:
The URL
The Link Text
The Prefix that preceeds all menus in the same family
The Level which is how far down the tree a menu is starting with 0 for the parent
Blankwindow which should be an 'x' if you want the link to open in a new window

They are in the following order:
url,text,prefix,childMenu,level,blankWindow
*/


var programItems = new Array('programItems_0','programItems','160'
,baseURL+'featured_speakers.asp','Featured Speakers','program','','1',''
,baseURL+'tracks.asp','Tracks','program','','1',''
,baseURL+'pre-registration.asp','Pre-Registration','program','','1','' 	
,baseURL+'','Breakout Schedule','program','','1',''
)

var highlightsItems = new Array('highlightsItems_0','highlightsItems','160'
,baseURL+'highlights_registration_specials.asp','Registration Specials','highlights','','1',''
,baseURL+'highlights_technology.asp','Technology Center','highlights','','1',''
,baseURL+'highlights_special.asp','Special Events','highlights','','1',''
,baseURL+'highlights_eucharist.asp','Eucharistic Celebrations','highlights','','1',''
)

var exhibitorsItems = new Array('exhibitorsItems_0','exhibitorsItems','180'
,baseURL+'exhibitor_become.asp','Become an Exhibitor','exhibitors','','1',''
,baseURL+'ExhibitorListandBoothMap.pdf','Current Exhibitors (PDF)','exhibitors','','1','x'
,baseURL+'exhibitor_sponsor.asp','Sponsorship and Advertising','exhibitors','','1',''
)

//list of the above menu arrays. A menu array must be in this list in order to be written to the page
var menuList = new Array(
programItems
,highlightsItems
,exhibitorsItems
);

//temporary storage space for each menu item
var menuListHolder = new Array();
var linkClicked = false;

function findURL(cell){
	if(!linkClicked){
		URL = cell.childNodes[0].href
		URLTarget = cell.childNodes[0].target
		if(URLTarget==""){
			location.href = URL;
		}else{
			window.open(URL);
		}
	}
	linkClicked = false;
}

//Writes the menus to the page
for(i=0;i<menuList.length;i++){
	menusArray.push(menuList[i].shift());
	divWriter = "<div id=\"" + menuList[i].shift() + "\" class=\"addItemItems\" style=\"width:"+ menuList[i].shift() +"px;\">";
	tempLength = menuList[i].length/6;
	for(n=0;n<tempLength;n++){
		menuListHolder = menuList[i].splice(0,6);
			divWriter = divWriter + "<div id=\"itemMenuItem\" onMouseOver=\"showMenu(this,'";
			if(menuListHolder[3] != ""){
				divWriter = divWriter + "show";
			}else{
				divWriter = divWriter + "hold";
			}
			divWriter = divWriter + "','";
			if(menuListHolder[3] != ""){
				divWriter = divWriter + menuListHolder[3]
			}
				divWriter = divWriter + "','" + menuListHolder[4];
				divWriter = divWriter + "','" + menuListHolder[2] + "'"; 
			
			divWriter = divWriter + ")\" onMouseOut=\"showMenu(this,'hide')\"><div id=\"itemSpace\">";
			divWriter = divWriter + "<table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr><td align=left nowrap onClick=\"findURL(this)\">";		
			divWriter = divWriter + "<a onClick=\"linkClicked=true;\" href=\""+menuListHolder[0]+"\"";
			if(menuListHolder[5] != ""){
				divWriter = divWriter + " target=\"_blank\"";
			}
			divWriter = divWriter + ">"+menuListHolder[1]+"</a></td><td align=right>";
			if(menuListHolder[3] != ""){
				divWriter = divWriter + "<img src=\"images/menu_arrow.gif\" width=\"7\" height=\"15\" border=\"0\">";
			}
			divWriter = divWriter + "</td></tr></table></div></div>";
	}
	divWriter = divWriter + "</div>";
	document.write(divWriter);
	
}
