function changeStyle(element, strClass) {
	element.className = strClass;
}
// original source borrowed from wz_tooltip.js by walterzorn.com
function newReplace(t_str, t_x, t_y) {
	var t_ret = "",
	t_str = String(t_str), 
	t_xI;
	while((t_xI = t_str.indexOf(t_x)) != -1) {
		t_ret += t_str.substring(0, t_xI) + t_y;
		t_str = t_str.substring(t_xI + t_x.length);
	}
	return t_ret+t_str;
}

menuLayers = ["nav-level2a", "nav-level2b", "nav-level2c", "nav-level2d", "empty-menu"];

// taken and modified from http://www.quirksmode.org/js/blockinvi.html
function blocking(nr) {
	if (document.layers) {
		current = (document.layers[nr].display == 'none') ? 'block' : 'none';
		document.layers[nr].display = current;
	} else if (document.all) {
		current = (document.all[nr].style.display == 'none') ? 'block' : 'none';
		document.all[nr].style.display = current;
	} else if (document.getElementById) {
		vista = (document.getElementById(nr).style.display == 'none') ? 'block' : 'none';
		document.getElementById(nr).style.display = vista;
	}
}
function showMenu(menuID) {
	// switch all the second level menu's off
	for (i=0; i<menuLayers.length; i++) {
		turnMenuOff(menuLayers[i]);
	}
	// switch the selected menu back on
	turnMenuOn(menuID);
}
function turnMenuOn(menuID) {
	// switch the selected menu back on
	if (document.getElementById) {
		vista = document.getElementById(menuID);
		vista.style.display = "block";
	} else {
		// alert("can't switch on menu!");
	}
}
function turnMenuOff(menuID) {
	// switch the selected menu back on
	if (document.getElementById) {
		vista = document.getElementById(menuID);
		vista.style.display = "none";
	} else {
		// alert("can't switch off menu!");
	}
}
var the2ndLevelMenuForThisPage = null;
function initialise(menuID) {
		showMenu(menuID);
		the2ndLevelMenuForThisPage = menuID;
}
function reset() {
	showMenu(the2ndLevelMenuForThisPage);
}

/* timer functions, used to hide menu after short interval */
/* not used */
var secs;
var timerID = null;
var timerRunning = false;
var delay = 1000;

function InitializeTimer() {
    secs = 1;
    StopTheClock();
    StartTheTimer();
}
function StopTheClock() {
    if (timerRunning) {
        clearTimeout(timerID);
	}
    timerRunning = false;
}
function StartTheTimer() {
    if (secs == 0) {
        StopTheClock();
		showMenu(the2ndLevelMenuForThisPage);
    } else {
        secs--;
        timerRunning = true;
        timerID = self.setTimeout("StartTheTimer()", delay);
    }
}

function utMouseOver(theImage) {
	theImage.src = newReplace(theImage.src, ".png", "-over.png");
}
function utMouseOut(theImage) {
	theImage.src = newReplace(theImage.src, "-over.png", ".png");
}