function BuildSub(name, status, url)
{
	mouseOver = 'onMouseOver = "return StatusBar(\'' + status + '\');"';
	mouseOut  = 'onMouseOut  = "return StatusBar(\'\');"';
	href      = 'href="' + url + '">';
	sub       = '<a ' + mouseOver + mouseOut + href + name + '</a>';
	return sub;
}

function BuildSub2(name, status, url)
{
	mouseOver = 'onMouseOver = "return StatusBar(\'' + status + '\');"';
	mouseOut  = 'onMouseOut  = "return StatusBar(\'\');"';
	href      = 'href="' + url + '">';
	sub       = '<a target="_blank"' + mouseOver + mouseOut + href + name + '</a>';
	return sub;
}

// -------------------------------------------------------------------------------------
//                                    M A I N   M E N U
// -------------------------------------------------------------------------------------

// -----------------------------
//Home
// -----------------------------
var menu1=new Array()
menu1[0] = BuildSub("Home", "", "/~onholdt/Community_Of_Christ/index.php");
//menu1[1] = BuildSub("Site Map", "", "SiteMap.php");

// -----------------------------
//Who we are
// -----------------------------
var menu2=new Array()
menu2[0]=BuildSub("Mission Statement",	"", "/~onholdt/Community_Of_Christ/Mission-Statement.php");
menu2[1]=BuildSub2("Our Mission",	"", "http://www.cofchrist.org/ourfaith/mission.asp");
menu2[2]=BuildSub2("Our Beliefs", "", "http://www.cofchrist.org/ourfaith/faith-beliefs.asp");
menu2[3]=BuildSub2("Our Enduring Principles", "", "http://www.cofchrist.org/ourfaith/enduring-principles.asp");
menu2[4]=BuildSub2("Our History", "", "http://www.cofchrist.org/history/default.asp");
//menu2[?]=BuildSub("Libertyville Leadership", "", "/~onholdt/Community_Of_Christ/MeetUs.php");
//menu2[?]=BuildSub2("Devotions", "", "http://groups.google.com/group/libertyville-cofc/web");
//menu2[?]=BuildSub2("Devotions", "", "http://groups.google.com/group/libertyville-cofc/web?display=list&hidedetails=1&sort=cdate");
menu2[5]=BuildSub2("World Church", "", "http://www.cofchrist.org/");

// -----------------------------
//Events
// -----------------------------
var menu3=new Array()
menu3[0]=BuildSub2("Calendar", "", "https://www.google.com/calendar/embed?src=libertyville.cofc@gmail.com&gsessionid=GheXR2OEC9FhU3FvTmlsow");
menu3[1]=BuildSub("The Vine", "", "/~onholdt/Community_Of_Christ/TheVine.php");

// -----------------------------
//Ministries
// -----------------------------
var menu4=new Array()
menu4[1]=BuildSub("Worship Services", "", "/~onholdt/Community_Of_Christ/Worship-Services.php");
menu4[2]=BuildSub2("10 Minute News", "", "http://www.cofchrist.org/news/10min/");
menu4[3]=BuildSub("Kids Only", "", "/~onholdt/Community_Of_Christ/KidsOnly.php");
menu4[4]=BuildSub2("Health Ministies Monthly Bulletins", "", "http://hmacofchrist.org/CongregationaHealthMinistry/BulletinInserts/index.htm");
menu4[5]=BuildSub2("Steve Veazey's BLOG", "", "http://steveveazeyblog.com/");

// -----------------------------
//Archives
// -----------------------------
var menu5=new Array()
menu5[0]=BuildSub("Photo Gallery", "", "/~onholdt/Community_Of_Christ/PhotoGallery/PhotoGallery.php");
menu5[1]=BuildSub2("Live and previous recordings", "", "http://www.ustream.tv/user/libertyvillecofc/videos");

// -----------------------------
//Members Only
// -----------------------------
var menu6=new Array()
menu6[0]=BuildSub("Sign-in", "", "/~onholdt/Community_Of_Christ/NewLogin.php");

// -----------------------------
//Related Links
// -----------------------------
var menu7=new Array()
menu7[0]=BuildSub2("Camp Quarryledge", "", "http://www.quarryledge.com/");
menu7[1]=BuildSub2("Chicago Mission Center", "", "http://www.chicagomissioncenter.org/");
menu7[2]=BuildSub2("Community of Christ Peace Support Network", "", "http://www.peacesupportnetwork.org/");
menu7[3]=BuildSub2("Community of Christ Historic Sites", "", "http://www.historicsitesfoundation.org/");
menu7[4]=BuildSub2("Graceland University", "", "http://www.graceland.edu/");
menu7[5]=BuildSub2("Herald House Publishing", "", "http://www.heraldhouse.org/");
menu7[6]=BuildSub2("Kirtland Temple", "", "http://www.kirtlandtemple.org/");
menu7[7]=BuildSub2("Outreach International", "", "http://www.outreach-international.org/");




// -----------------------------
//Contact Us
// -----------------------------
var menu8=new Array()
menu8[0]=BuildSub("Contact Information", "", "/~onholdt/Community_Of_Christ/ContactUs.php");
menu8[1]=BuildSub("Directions", "", "/~onholdt/Community_Of_Christ/Directions.php");


// -------------------------------------------------------------------------------------
//                                 M E M B E R S   M E N U
// -------------------------------------------------------------------------------------

// -----------------------------
// Logout
// -----------------------------
var MembersMenu_1=new Array()
MembersMenu_1[0] = BuildSub("Logout", "", "/~onholdt/Community_Of_Christ/_private/Logout.php");

// -----------------------------
// Forms
// -----------------------------
var MembersMenu_2=new Array()
MembersMenu_2[0] = BuildSub("Forms", "", "");

// -----------------------------
// Schedules
// -----------------------------
var MembersMenu_3=new Array()
MembersMenu_3[0] = BuildSub("2008 Greeter Schedule", "", "");

// -----------------------------
// Resources
// -----------------------------
var MembersMenu_4=new Array()
MembersMenu_4[0] = BuildSub("Hymns of the Saints CD", "", "/~onholdt/Community_Of_Christ/_private/HymnsOfTheSaintsCD.php");
MembersMenu_4[1] = BuildSub("iWorship DVD", "", "/~onholdt/Community_Of_Christ/_private/iWorshipList.php");

// -------------------------------------------------------------------------------------
//                                 A D M I N    M E N U
// -------------------------------------------------------------------------------------

// -----------------------------
// Logout
// -----------------------------
var AdminMenu_1=new Array()
AdminMenu_1[0] = BuildSub("Logout", "", "/_private/Logout.php");


// -------------------------------------------------------------------------------------
//                             I M P L E M E N T A T I O N
// -------------------------------------------------------------------------------------

var menuwidth='165px' //default menu width
var menubgcolor='lightyellow'  //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?
var tdVar=null;

/////No further editting needed

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+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')
}

function getposOffset(what, offsettype)
{
	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 showhide(obj, e, visible, hidden, menuwidth)
{
	if (ie4||ns6)
	{
		dropmenuobj.style.left=dropmenuobj.style.top=-500
	}

	if (menuwidth!="")
	{
		dropmenuobj.widthobj=dropmenuobj.style
		dropmenuobj.widthobj.width=menuwidth
	}
	
	if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
	{
		obj.visibility = visible
	}
	else if (e.type=="click")
	{
		obj.visibility=hidden
	}
}

function iecompattest()
{
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge)
{
	var edgeoffset=0
	if (whichedge=="rightedge")
	{
		var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
		dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
		if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
		{
			edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
		}
	}
	
	else
	{
		var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
		var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
		dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
		if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
		{ //move up?
			edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
			if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
			{
				edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
			}
		}
	}
	
	return edgeoffset
}

function populatemenu(what)
{
	if (ie4||ns6)
	{
		dropmenuobj.innerHTML=what.join("")
	}
}


function dropdownmenu(obj, e, menucontents, menuwidth)
{
	if (tdVar != null)
	{
		tdVar.style.backgroundColor = "#336699";
		tdVar.style.color = "#ffffff";
		tdVar = null;
	}

	if (window.event) 
	{
		event.cancelBubble=true
	}
	else if (e.stopPropagation)
	{
		e.stopPropagation()
	}

	clearhidemenu()
	dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
	populatemenu(menucontents)

	if (ie4||ns6)
	{
		showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
		dropmenuobj.x=getposOffset(obj, "left") - 1;
		dropmenuobj.y=getposOffset(obj, "top") + 1;
		dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
		dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
	}

	tdVar = obj;
	if (tdVar != null)
	{
		tdVar.style.backgroundColor = "white";
		tdVar.style.color = "#336699";
		tdVar.style.textColor = "#336699";
	}

	return clickreturnvalue()
}

function clickreturnvalue()
{
	if (ie4||ns6) 
	{
		return false
	}
	else 
	{
		return true
	}
}

function contains_ns6(a, b) 
{
	while (b.parentNode)
	{
		if ((b = b.parentNode) == a)
		{
			return true;
		}
	}
	return false;
}

function dynamichide(e)
{
	if (ie4&&!dropmenuobj.contains(e.toElement))
	{
		delayhidemenu()
	}
	else 
	{
		if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
			delayhidemenu()
	}
}

function hidemenu(e)
{
	if (typeof dropmenuobj!="undefined")
	{
		if (ie4||ns6)
		{
			dropmenuobj.style.visibility="hidden"
			if( tdVar != null)
			{
				tdVar.style.backgroundColor = "#336699";
				tdVar.style.color = "#ffffff";
				tdVar = null;
			}
		}
	}
}

function delayhidemenu()
{
	if (ie4||ns6)
	{
		delayhide=setTimeout("hidemenu()",disappeardelay)
	}
}

function clearhidemenu()
{
	if (typeof delayhide!="undefined")
	{
		clearTimeout(delayhide)
	}
}

if (hidemenu_onclick=="yes")
{
	document.onclick=hidemenu
}
