///////////////////////////////////////
// MAINMENU
///////////////////////////////////////

var mnAry = ['schwesternschaft','kontakt','pflegewohnheim','ambulante_pflege','ausbildung'];
var mnBtnAry = new Array;
var mnImgAry = new Array;

for( var i in mnAry){
	i = mnAry[i];
	mnBtnAry[i] = new Array();
	mnBtnAry[i]['o'] = new Image();
	mnBtnAry[i]['o'].src = 'images/common/menue/'+i+'_btn_o.gif';
	mnBtnAry[i]['n'] = new Image();
	mnBtnAry[i]['n'].src = 'images/common/menue/'+i+'_btn.gif';

	mnImgAry[i] = new Array();
	mnImgAry[i]['o'] = new Image();
	mnImgAry[i]['o'].src = 'images/common/menue/'+i+'_o.gif';
	mnImgAry[i]['n'] = new Image();
	mnImgAry[i]['n'].src = 'images/common/menue/'+i+'.gif';
}


function naviover(id){
	var btn = document.getElementById('btn_'+id);
	var sm = document.getElementById('sm_'+id);

	// Simply hide all Submenus and start a Timeout with autoHide
	hideAll();
	autoHide(5000);
	
	// change the button 
	if (btn) {
		btn.src = mnBtnAry[id]['o']['src'];
	}
	if (sm) {
		sm.style.display = 'block';
	}
	
}

function hideAll() {
	for (var i in mnAry) {
		i = mnAry[i];
		var btn = document.getElementById('btn_'+i);
		var sm = document.getElementById('sm_'+i);
		
		// hide submenu if present
		if (sm) {
			sm.style.display = 'none';
		}
		// switch button back to normal state
		if (btn) {
			btn.src = mnBtnAry[i]['n']['src'];
		}
	}
}

// Letting the menus hide automatically..
var timeoutID = null;
function autoHide(i) {
	i = (isNaN(i)) ? 2000 : i;
	if (timeoutID) {
		window.clearTimeout(timeoutID);
	}
	
	timeoutID = window.setTimeout('hideAll()', i);
}

