var submenu = new Array();
submenu[0] = '';
submenu[1] = '';
submenu[2] = '\
	<ul id="menu2" class="submenu">\
		<li><a href="/Services/Organization.php">Organization</a></li>\
		<li><a href="/Services/Move-Oversight.php">Move Oversight</a></li>\
		<li><a href="/Services/Life-Space-Design.php">Life Space Design</a></li>\
		<li><a href="/Services/Other-Services.php">Other Services</a></li>\
	</ul>\
';

// All scripts that execute on page load should be in here somewhere.
function setup() {
	// This function forces outbound links to open in a new window, unless told otherwise (rel="self" in anchor)
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var URL = anchors[i].href;
		if (URL.search('tomorrowstransitions')===-1 && URL.search('http')!==-1 && anchors[i].rel !== 'self') anchors[i].target = "_blank";
	}
}

// This function opens the requested submenu and styles the top-level nav item.
function menu(foo) {
	menuReset();
	document.getElementById('subnavInner').innerHTML = submenu[foo];
	document.getElementById('menu'+foo).style.display = 'block';
	document.getElementById('nav1_'+foo).style.background = '#FFEE00';
	if (viewportwidth < 1024) document.getElementById('menu2').style.marginLeft = '70px';
}

// This function resets all submenus and switches top-level nav item style back to normal.
function menuReset() {
	document.getElementById('subnavInner').innerHTML = '';
	nav1Links = document.getElementsByTagName('a');
	for (i=0 ; i<nav1Links.length ; i++) {
		if (nav1Links[i].id) {
			nav1Links[i].style.background = 'none';
		}
	}
}

// This function activates contact scripts
function activate(brillig) {
	document.getElementById('config').name = "config";
	document.getElementById('config').value = brillig;
}

window.onload = setup;