function thanks(id)
{
	if (location.search && (location.search.indexOf("thankyou=true") != -1) && (elem = document.getElementById(id)))
	{
		elem.innerHTML = "Thank you for your email. We'll respond as soon as we can!"
	}
}

function show(id)
{
	if (elem = document.getElementById(id))
		elem.style.display = "block"
}

function hide(id)
{
	if (elem = document.getElementById(id))
		elem.style.display = "none"
}

function menuOver(id)
{
	var elem = document.getElementById(id)
	if (elem)
	{
		elem.style.backgroundColor = "#9d61a1"
		show("sub"+id)
	}
}

function menuOut(id)
{
	var elem = document.getElementById(id)
	if (elem && id != docClass)
	{
		elem.style.backgroundColor = "#bd81c1"
		hide("sub"+id)
	}
}

docClass = "home"

setup = function()
{
	var body = document.getElementsByTagName('body')
	if (body)
	{
		for (i=0; i<body.length; i++)
		{
			docClass = body[i].className
		}
	}
	
	if (docClass == "cont")
		thanks('emailus')
	
	var elem = document.getElementById(docClass)
	if (elem)
	{
		elem.style.backgroundColor = "#9d61a1"
		show("sub"+docClass)
	}
	
	var menuItems = document.getElementsByTagName('span')
	if (menuItems)
	{
		for (i=0; i<menuItems.length; i++)
		{
			if (menuItems[i].className == "menuoption" || menuItems[i].className == "submenuoption")
			{
				menuItems[i].onclick = function(event) {if (event) event.stopPropagation();else window.event.cancelBubble = true;links = this.getElementsByTagName('a');location.href = links[0].href;}
				menuItems[i].onmouseover = function() {menuOver(this.id)}
				menuItems[i].onmouseout = function() {menuOut(this.id)}
			}
		}
	}
}

if (window.attachEvent)
{
	window.attachEvent("onload", setup)
}
else
	window.onload = setup;
