// JavaScript Document menuhide.js

window.onload=initAll;
var maxheadings=7;
var links=new Array(maxheadings);
var MenuName=new Array(maxheadings);
var i;
var newstar;
var thing;


function initAll() {
 	for (i=1;i<maxheadings;i++) {
	var name='menu'+i+'hide';
	links[i]=document.getElementById(name);
	links[i].onmouseover=toggleMenu;
	MenuName[i]=links[i].id.substring(0,5);
	document.getElementById(MenuName[i]).style.display="none";
	}
	var windowWidth=document.documentElement.clientWidth || document.body.clientWidth;
	var divWidth=document.getElementById("wrapper").style.width;
	var leftPos=0.5*(windowWidth-parseInt(divWidth))-10;
//	alert("leftPos is "+leftPos);
	document.getElementById("wrapper").style.left=leftPos+'px';
}

function toggleMenu() {
	thisMenuName=this.id.substring(0,5);
	for (i=1;i<maxheadings;i++) {
	if (thisMenuName==MenuName[i]) {continue}
	document.getElementById(MenuName[i]).style.display="none";
	}
		
	var thing=document.getElementById(thisMenuName);
	thing.style.display="block";
	thing.onmouseout=toggleOff;
	thing.onmouseover=toggleOn;
	}

function toggleOn() {
	this.style.display="block";	
	}
	
function toggleOff() {	
	this.style.display="none";	
	}
