
var menuType = "V"
var arrMenu = new Array()

var menuRoot = ""
var yOffset = 0

var menuPos = new Array();
	menuPos["home"] = 5
	menuPos["about"] = 25
	menuPos["events"] = 97
	menuPos["partner"] = 195
	menuPos["occwm"] = 270
	menuPos["faith"] = 390
	menuPos["contact"] = 490

////////////////////////////////////////////
// 1st value: M or S (Menu or SubMenu)
// If M:
// 	    MenuName (used as root for the images)
//      URL (Blank if nothing happens)
//      Width in Pixels of image
//      Colspan
//
// If S:
//      MenuName (assocoates submenu with menu)
// 	    URL or function name to be called when menu is selected
// 	    Target - Blank - URL comes up in main window
// 	             Anything Else - URL comes up in a window with that name 		 
// 		Window Params - additional info (width, height, statusbar, etc.)
// 		
////////////////////////////////////////////

if (!noHome) addMenu("M","home",	"Home",	"default.asp","00","")

addMenu("M","about",	"About Us",	"about.asp","00","")

addMenu("M","events",	"Events",	"events2.asp","00","")

addMenu("M","faith", "Faith&nbsp&&nbsp;Business&nbsp;Forum", "fabf.asp","00","")

addMenu("M","contact", "Contact", "contact.asp","00","")


function addMenu(sType, sName, sCaption, sPage, iColspan, sParams)
	{
	var a = arrMenu.length;
	if (arguments.length < 3) sPage = "";
	if (arguments.length < 4) iWidth = "";
	if (arguments.length < 5) iColspan = "";
	
	arrMenu[a] = new Array(sType, sName, sCaption, sPage, iColspan, sParams)
	}


function drawImgMenu(path,yOff)
	{
	var sBuffer = "";
	menuRoot = path
	if (arguments.length > 1) yOffset = yOff
	
	for (var a=0; a<arrMenu.length;a++)
		{
		if (arrMenu[a][0] == "M")
			{
			sBuffer += drawMenuItemImg(a)
			}
		}
	return sBuffer;
	}


function drawMenuItemImg(a)
	{
	var sBuffer = ""
	var sName  = arrMenu[a][1];
	var sPage  = arrMenu[a][2];
	var iWidth = arrMenu[a][4];
	
	
	sBuffer += "<a href=\"" + menuRoot + arrMenu[a][2] + "?main=" + arrMenu[a][1] + "\" onMouseOver='imgHilite(" + a + ")' onMouseOut='imgNorm(" + a + ")'><img src='" + menuRoot + "images/btn-" + sName + ".gif' alt='' name='" + sName + "' width='" + iWidth + "' height='22' border='0' id='" + sName + "'></a>";
	return sBuffer;
	}

function drawMenu(path,yOff,height,sMain)
	{
	var sBuffer = "<table cellspacing='0' cellpadding='0' border='0' height='" + height + "'><tr>";
	menuRoot = path
	if ((arguments.length > 1) && (yOff != "")) yOffset = yOff
	
	for (var a=0; a<arrMenu.length;a++)
		{
		if (arrMenu[a][0] == "M")
			{
			sBuffer += drawMenuItem(a,sMain)
			}
		}
	sBuffer += "<td style='padding: 2px 5px 0 5px;'"
	if (String(cartActive) == "Y") sBuffer += " onMouseOver='menuHilite(this)' onMouseOut='menuNorm(this)'"
	sBuffer += ">"
	
	if (String(cartActive) == "Y")
		{
		sBuffer += "<img src='images/cart.gif' class='link' onmouseup='gotoCart()' alt='Go to Shopping Cart'>"
		}
	sBuffer += "</td></tr></table>"
	Q(sBuffer);
	QPrint("menusec");
	}


function drawMenuItem(a,sMain)
	{
	var sBuffer = ""
	var sName  = arrMenu[a][1];
	var sCap  = arrMenu[a][2];
	var sPage = arrMenu[a][3];
	var iWidth = arrMenu[a][4];
	
	var tempRoot = ""
	if (arrMenu[a][3].substr(0,11).toUpperCase() != "JAVASCRIPT:") tempRoot = menuRoot;
	if (sMain == arrMenu[a][1])
		{
		sBuffer += "<td class='menuitem' onMouseOver='menuHilite(this," + a + ")' onMouseOut='menuNorm(this)' width='" + iWidth + "' align='center'><a class='menuitem' href=\"" + tempRoot + arrMenu[a][3] + "?main=" + arrMenu[a][1] + "\"><b><nobr>" + sCap + "</nobr></b></a></td>";
		}
	else
		{
		sBuffer += "<td class='menuitem' onMouseOver='menuHilite(this," + a + ")' onMouseOut='menuNorm(this)' width='" + iWidth + "' align='center'><a class='menuitem' href=\"" + tempRoot + arrMenu[a][3] + "?main=" + arrMenu[a][1] + "\"><nobr>" + sCap + "</nobr></a></td>";
		}
	return sBuffer;
	}

// ==== Dropdown Menus

function drawSubmenu(id)
	{
	var sBuffer = "";
	for (var a=0; a<arrMenu.length;a++)
		{
		if ((arrMenu[a][0] == "S") && (arrMenu[a][1] == id))
			{
			sBuffer += drawSubItem(a)
			}
		}
	if (sBuffer != "")
		{
		sBuffer = "<div class='submenuitem' style='background-color:#F2F6D5; position: absolute; top:" + (yOffset + 72) + "px; left:" + (menuPos[id] + 120) + "px; display: block;'><table cellspacing='0' border='0' cellpadding='2'>"  + sBuffer + "</table></div>"
		}
	QPrint("submenusec",sBuffer)
	}

// ==== Dropdown Menu Item

function drawSubItem(a)
	{
	var sBuffer = ""
	var tempRoot = ""
	if (arrMenu[a][3].substr(0,11).toUpperCase() != "JAVASCRIPT:") tempRoot = menuRoot;
	if (arrMenu[a][3] == "")
		{
		sBuffer += "<tr><td class='submenuitem' onMouseOver='subHilite(this)' onMouseOut='subNorm(this)'><nobr>&nbsp;" + arrMenu[a][2] + "</nobr></td></tr>";
		}
	else if (arrMenu[a][4] == "")
		{
		if (arrMenu[a][3].substr(0,11).toUpperCase() != "JAVASCRIPT:")
			sBuffer += "<tr><td class='submenuitem' onMouseOver='subHilite(this)' onMouseOut='subNorm(this)'><nobr><a class='submenuitem' href=\"" + tempRoot + arrMenu[a][3] + "?main=" + arrMenu[a][1] + "\">" + arrMenu[a][2] + "</a></nobr></td></tr>";
		else
			sBuffer += "<tr><td class='submenuitem' onMouseOver='subHilite(this)' onMouseOut='subNorm(this)'><nobr><a class='submenuitem' href=\"" + tempRoot + arrMenu[a][3] + "\">" + arrMenu[a][2] + "</a></nobr></td></tr>";
		}
	else
		{
		if (arrMenu[a][5] == "")
			{
			sBuffer += "<tr><td class='submenuitem' onMouseOver='subHilite(this)' onMouseOut='subNorm(this)'><nobr><a class='submenuitem' href=\"" + tempRoot + arrMenu[a][3] + "\" target='" + arrMenu[a][4] + "'>" + arrMenu[a][2] + "</a></nobr></td></tr>";
			}
		else
			{
			sBuffer += "<tr><td class='submenuitem' onMouseOver='subHilite(this)' onMouseOut='subNorm(this)'><nobr><a class='submenuitem' href=\"JavaScript:popup('" + tempRoot + arrMenu[a][3] + "','win" + arrMenu[a][4] + "','" + arrMenu[a][5] + "')\">" + arrMenu[a][2] + "</a></nobr></td></tr>";
			}
		}
	return sBuffer;
	}


// ====== Horizontal Menu

function drawSubmenuH(id)
	{
	var sBuffer = "";
	for (var a=0; a<arrMenu.length;a++)
		{
		if ((arrMenu[a][0] == "S") && (arrMenu[a][1] == id))
			{
			sBuffer += drawSubItemH(a)
			}
		}
	QPrint("submenuhorizsec",sBuffer)
	}

// ====== Horizontal Menu Item

function drawSubItemH(a)
	{
	var sBuffer = ""
	var tempRoot = ""
	var sMainMarker = ""
	if (arrMenu[a][3].substr(0,11).toUpperCase() != "JAVASCRIPT:") 
		{
		tempRoot = menuRoot;
		sMainMarker = "?main=" + arrMenu[a][1]
		}
	if (arrMenu[a][3] == "")
		{
		sBuffer += "<nobr><a href='" + arrMenu[a][3] + "' class='submenuitemh'>" + arrMenu[a][2] + "</a>&nbsp;&nbsp;&nbsp;</nobr></td></tr>";
		}
	else if (arrMenu[a][4] == "")
		{
		sBuffer += "<nobr><a href=\"" + tempRoot + arrMenu[a][3] + sMainMarker + "\" class='submenuitemh'>" + arrMenu[a][2] + "</a>&nbsp;&nbsp;&nbsp;</nobr></td></tr>";
		}
	else
		{
		if (arrMenu[a][5] == "")
			{
			sBuffer += "<nobr><a href=\"" + tempRoot + arrMenu[a][3] + sMainMarker + "\" class='submenuitemh' target='" + arrMenu[a][4] + "'>" + arrMenu[a][2] + "</a>&nbsp;&nbsp;&nbsp;</nobr></td></tr>";
			}
		else
			{
			sBuffer += "<nobr><a class='submenuitemh' href=\"JavaScript:popup('" + tempRoot + arrMenu[a][3] + "','win" + arrMenu[a][4] + "','" + arrMenu[a][5] + "')\">" + arrMenu[a][2] + "</a>&nbsp;&nbsp;&nbsp;</nobr></td></tr>";
			}
		}
	return sBuffer;
	}




function clearSubmenu()
	{
	if (menuType == "V") QPrint("submenusec","")
	}

function imgHilite(a)
	{
	var sName = arrMenu[a][1]
	document[sName].src =  menuRoot + "images/overbtns/btn-" + sName + "-over.gif"
	if (menuType == "V") drawSubmenu(sName)
	}
	
function imgNorm(a)
	{
	var sName = arrMenu[a][1]
	document[sName].src = menuRoot + "images/btn-" + sName + ".gif"
	}
	
function menuHilite(obj,a)
	{
	var sName = ""
	if (arguments > 1) sName = arrMenu[a][1]
	obj.style.backgroundColor = "#F8FAE8"
	obj.style.color = "#8AD8E2"
	// if (menuType == "V") drawSubmenu(sName)
	}
	
function menuNorm(obj)
	{
	obj.style.backgroundColor = ""
	obj.style.color = ""
	}
	


function subHilite(obj)
	{
	obj.style.backgroundColor = "#F8FAE8"
	obj.style.color = "#8AD8E2"
	}
	
function subNorm(obj)
	{
	obj.style.backgroundColor = "#F2F6D5"
	obj.style.color = "#6A695E"
	}
	
function getPage(a)
	{
	self.location = arrMenu[a][2] + "?main=" + arrMenu[a][1];
	}	

function popup(url,name,params)
	{
	window.open(url,name,params);
	}

function gotoCart()
	{
	self.location = "cart.asp"
	}
