function delay (action, id) {

	if (action == 'open') {
	
		activ1 = window.setTimeout(function () {ToggleMenu(action, id);}, 150);
		activ2 = window.setTimeout("", 1);
		if (activ2 != null) {
			window.clearTimeout(activ2); }
	
	}

	else if (action == 'close') {
	
		activ2 = window.setTimeout(function () {ToggleMenu(action, id);}, 150);
		if (activ1 != null) {
			window.clearTimeout(activ1); }
	
	}

}

function ToggleMenu (action, id) {
	
	var colors = new Array('dau', '#ffff1b', '#0160fd', '#db2f0b', '#5ac306', '#fe8a03', '#2ca508');
	
	if (action == 'open') {
		
		for (var i = 1; i < id; i++) {
			document.getElementById("menu_" + i).style.display = "none";
		}
		for (var i = 10; i > id; i--) {
			if (document.getElementById("menu_" + i) != null) {
				document.getElementById("menu_" + i).style.display = "none";
			}
		}
		document.getElementById("menu_" + id).style.display = "inline";
		document.body.style.backgroundImage = "url(themes/erasmus/images/bg_" + id + ".jpg)";
		document.body.style.backgroundColor = colors[id];
		
	}
	else {
		
		document.getElementById("menu_" + id).style.display = "none";
		document.body.style.backgroundImage = "url(themes/erasmus/images/bg_2.jpg)";
		document.getElementById("menu_2").style.display = "inline";
		document.body.style.backgroundColor = colors[2];
	}
	
}

