// main item of the menu
var categories = new Array ('menu_aktuelles', 'menu_restaurant', 'menu_kontakt');

// line height from the subitems
var line_height = 15;

var number_of_submenues = new Array ();
var in_obj;
var out_obj;

number_of_submenues ['menu_aktuelles'] = 2;
number_of_submenues ['menu_restaurant'] = 2;
number_of_submenues ['menu_kontakt'] = 4;



function setInHeight (height) {
	var act_height = in_obj.style.height.substring (0, in_obj.style.height.length - 2);
	if (act_height < height) {
		in_obj.style.height = (parseInt (act_height) + 5) + 'px';
		window.setTimeout ("setInHeight (" + height + ")", 50);
	}
}


function setOutHeight (height) {
	var act_height = out_obj.style.height.substring (0, out_obj.style.height.length - 2);
	if (act_height > height) {
		out_obj.style.height = (parseInt (act_height) - 5) + 'px';
		window.setTimeout ("setOutHeight (" + height + ")", 10);
	} else {
		out_obj.style.visibility = 'hidden';
	}
}


function showMenue (new_cat, link) {
	link.href = '#';
	
	var dropOuts = new Array ();
	var dropIn;
	for (i = 0; i < categories.length; i++) {
		if (categories [i] == new_cat) {
			dropIn = categories [i];
		} else {
			dropOuts.push (categories [i]);
		}
	}
	var img_id;
	var div_id;
	for (i = 0; i < dropOuts.length; i++) {
		img_id = dropOuts [i];
		div_id = 'submenu_' + dropOuts [i];
		document.getElementById (img_id).src = 'images/' + dropOuts [i] + '.gif';
		out_obj = document.getElementById (div_id);
		//setOutHeight (0);
		out_obj.style.height = 0 + 'px';
		out_obj.style.visibility = 'hidden';
	}
	document.getElementById (dropIn).src = 'images/' + dropIn + '_active.gif';
	div_id = 'submenu_' + dropIn;
	in_obj = document.getElementById (div_id);
	in_obj.style.visibility = 'visible';
	setInHeight (number_of_submenues [dropIn] * line_height);
}