// JavaScript Document

window.addEvent('domready', function() {
	// Auto-size the menu to take up the whole screen
	
	var listOfULs = $$('#menu ul')
	var totalWidth = 0;
	var maxWidth = 730;
	
	for(var i = 0; i < listOfULs.length; ++i)
	{
		//if (i == 0) {
		//alert(listOfULs[i].style.marginLeft); }
		totalWidth += parseInt(listOfULs[i].style.width) + 2;
	}
	
	for(var i = 0; i < listOfULs.length; ++i)
	{
		listOfULs[i].style.width = Math.round(parseInt(listOfULs[i].style.width) * (maxWidth / totalWidth)) + "px";
	}
 
});

function showsubs(start, finish) {
hidesubs(3,22);
for (; start <= finish; start++){
	document.getElementById("sub" + start).style.display = "block";
}
}
function hidesubs(start, finish) {
for (; start <= finish; start++){
	document.getElementById("sub" + start).style.display = "none";
}
}

function showpic(pic)
{
	//Show a picture
	//document.getElementById("menubox").style.background = 'url("images/menu/' + pic + '.png") no-repeat center bottom';
	//document.getElementById("navpic").src = "images/menu/" + pic + ".png";
}

function hidepic()
{
	//hide the picture
	//document.getElementById("menubox").style.background = "";
}

function lightUpButton(buttonID)
{
	if ($(buttonID) != null)
	{
		$(buttonID).style.background = "#ffd0a1";
	}
}