// JavaScript Document

var root = "http://www.acorn5aside.co.uk";
//var root = "http://localhost/acorn5aside2/";

//var root = "http://www.aminocom.com";

function popupMenu(mName, state) // state = visible or hidden
{
	if (document.getElementById)
	{
		document.getElementById(mName).style.visibility = state;
	}
	else
	{
		document.box.visibility = state;
	}
}
function highlightMenuItem(mItem, state, this_in)
{
	if (state == 1)
	{
	    if (document.layers)
        	window.document.layers[mItem].bgColor = "#dddddd";
    	else if (document.all) // IE
        	window.document.all[mItem].style.backgroundColor = "#dddddd";
			
		this_in.style.backgroundColor = "#dddddd";
	}
	else
	{
	    if (document.layers)
        	window.document.layers[mItem].bgColor = "#ffffff";
    	else if (document.all) // IE
        	window.document.all[mItem].style.backgroundColor = "#ffffff";
			
		this_in.style.backgroundColor = "#ffffff";
	}
}

function outputMenuItem(itemID, itemLink, itemText)
{
	//document.write("<td id='"+ itemID +"' class='popuptext' onMouseOver='javascript:highlightMenuItem('"+ itemID +"', 1)' onMouseOut='javascript:highlightMenuItem('"+ itemID +"', 0)'><a href='"+ itemLink +"'>"+ itemText +"</a></td>");
	document.write("<td id='"+ itemID +"' class='popuptext' ");
	document.write("onMouseOver='highlightMenuItem(\""+ itemID +"\", 1, this)' ");
	document.write("onMouseOut='highlightMenuItem(\""+ itemID +"\", 0, this)' ");
	document.write("onClick='document.location.href =\""+ root + itemLink +"\"'>");
	//document.write("<ilayer>");
	//document.write("<layer id='layer_"+ itemID +"' bgColor='lightblue' ");
	//document.write("onMouseOver='this.bgColor=\"yellow\"' ");
	//document.write("onMouseOut='this.bgColor=\"lightblue\"'>");
	//document.write("</layer>");
	//document.write("</ilayer>");
	document.write("<a href='"+root+""+ itemLink +"' class='popuptext'>"+ itemText +"</a>");
	document.write("</td>");
}

function changeSectionHeading(itemID, graphicName, folderLevel)
{
	var prefix = '';
	
	if (folderLevel == 1) // first level down into the structure
	{
		prefix = '../';
	}

	if (folderLevel == 2) // second level down into the structure
	{
		prefix = '../../';
	}

// MAKE THIS /graphics/menu_items/ WHEN IT'S ON THEIR SERVER!
	document.images[itemID].src = prefix+'graphics/menu_items/'+graphicName;
}
