var lists = Array('top-z', 'top-h', 'top-hs', 'top-w');
var timeout = 1;
var timeoutPointer = undefined;

function on(element) {
	if (element!=null) element.src = 'images/' + element.id + '-on.png';
}

function off(element) {
	if (element!=null) element.src = 'images/' + element.id + '-off.png';
}

function menu_roll_down(name) {
	clearTimeout(timeoutPointer);
	menu_roll_up_all();
	on(document.getElementById('menu-'+name));
	var element = document.getElementById(name);
	element.style.display = "block";
}

function menu_roll_up(name) {
	off(document.getElementById('menu-'+name));
	var element = document.getElementById(name);
	element.style.display = "none";
}

function menu_roll_up_all() {
	for (i=0; i<lists.length; i++) {
		menu_roll_up(lists[i]);
	}
}

function timeout_roll_up() {
	clearTimeout(timeoutPointer);
	timeoutPointer = setTimeout("menu_roll_up_all();", timeout*1000);
}

function timeout_clear() {
	clearTimeout(timeoutPointer);
}

function $(name) {
	return document.getElementById(name);
}
