// The addLoadEvent function takes as an argument another function which should be executed once the page has loaded.

// Unlike assigning directly to window.onload, the function adds the event in such a way that any previously added onload

// functions will be executed first.

function addLoadEvent(func)
{
	var oldonload = window.onload;
	if (typeof window.onload != 'function')
	{
		window.onload = func;
	}
	else
	{
		window.onload = function()
		{
			if (oldonload)
			{
				oldonload();
			}
			func();
		}
	}
}

function rollover(id,classname)
{
	$(id).className = classname;
}

function expandMenu(id)
{
	// var menu = $(id);
	
	Effect.toggle(id, 'slide');
	
	if($(id).style.display == 'none')
	{
		$(id).parentNode.className = 'expanded';
		for (i=0;i < $(id).parentNode.getElementsByTagName('img').length; i++)
		{
			$(id).parentNode.getElementsByTagName('img')[i].setAttribute('src','/~elliott/assets/images/icon-colapse.gif');
		}
	}
	else
	{
		for (i=0;i < $(id).parentNode.getElementsByTagName('img').length; i++)
		{
			$(id).parentNode.getElementsByTagName('img')[i].setAttribute('src','/~elliott/assets/images/icon-expand.gif');
		}
		$(id).parentNode.className = 'submenu';
	}
}

// When the page loads, set up the rollovers

addLoadEvent(function() {
});