/*
 * nav_is.js, mb, 2009-06-03, 2010-07-14
 * 2010-07-14, mb: subunavX Problem. Partly refactored.
 * 2009-06-03, mb: PICDIR nicht mehr '/'
 */

/*
	var hnav = new Array();
	
	hnav[0]=new Object();
	hnav[0]['o']='unternehmen-o.gif';
	hnav[0]['n']='unternehmen-n.gif';
	hnav[0]['l']='unternehmen-l.gif';
	
	hnav[1]=new Object();
	hnav[1]['o']='kompetenzen-o.gif';
	hnav[1]['n']='kompetenzen-n.gif';
	hnav[1]['l']='kompetenzen-l.gif';
	
	hnav[2]=new Object();
	hnav[2]['o']='info-center-o.gif';
	hnav[2]['n']='info-center-n.gif';
	hnav[2]['l']='info-center-l.gif';
	
	hnav[3]=new Object();
	hnav[3]['o']='standorte-o.gif';
	hnav[3]['n']='standorte-n.gif';
	hnav[3]['l']='standorte-l.gif';
	
	hnav[4]=new Object();
	hnav[4]['o']='kontakt-o.gif';
	hnav[4]['n']='kontakt-n.gif';
	hnav[4]['l']='kontakt-l.gif';

	var subnav = new Array();
	var navindex=4;
*/
	
var PICDIR = '/';
var LVL;  //fuer Startseite
if (LVL==0) {  //fuer Startseite
	PICDIR = 'images/hnav/';
} else {
	PICDIR = ''; // mb, 2009-06-03
}
var MSEC=500; 		//Verzoegerung in Millisekunden
var warte;
var aktivindex=-1;
var aktivsubindex=-1;

function omover(thisindex) {
	if (aktivindex != thisindex) {
		if(typeof(warte) != "undefined") {
			window.clearTimeout(warte);
		}
		if(aktivindex != -1) {
			hide(aktivindex);
		}
		aktivindex = thisindex;
		show(thisindex);
	}
}

function subomover(thisindex) {
	if (aktivsubindex != thisindex) {
		if(typeof(warte) != "undefined") {
			window.clearTimeout(warte);
		}
		if(aktivsubindex != -1) {
			hidesub(aktivsubindex);
		}
		aktivsubindex = thisindex;
		showsub(thisindex);
	}
}

function omout(thisindex) {
	warte = window.setTimeout("hide("+thisindex+")",MSEC);
}
function subomout(thisindex) {
	warte = window.setTimeout("hidesub("+thisindex+")",MSEC);
}

function stopout(thisindex) {
	window.clearTimeout(warte);
}

function show(thisindex) {
	for (i=0; i<hnav.length; i++) {
		eval("document.getElementById('hnav"+i+"').src = '"+PICDIR+hnav[i]['n']+"'");
		eval("document.getElementById('unav"+i+"').style.display = 'none'");
	}
	eval("document.getElementById('hnav"+thisindex+"').src = '"+PICDIR+hnav[thisindex]['o']+"'");
	if ( (thisindex+1) < hnav.length ) {
		eval("document.getElementById('hnav"+(thisindex+1)+"').src = '"+PICDIR+hnav[thisindex+1]['l']+"'");
	}
	eval("document.getElementById('unav"+thisindex+"').style.display = 'block'");
}

function hide(thisindex) {
	eval("document.getElementById('hnav"+thisindex+"').src = '"+PICDIR+hnav[thisindex]['n']+"'");
	if ( (thisindex+1) < hnav.length ) {
		eval("document.getElementById('hnav"+(thisindex+1)+"').src = '"+PICDIR+hnav[thisindex+1]['n']+"'");
	}
	eval("document.getElementById('unav"+thisindex+"').style.display = 'none'");	
	if (LVL!=0) {
		eval("document.getElementById('hnav"+navindex+"').src = '"+PICDIR+hnav[navindex]['o']+"'");
		if ( (navindex+1) < hnav.length ) {
			eval("document.getElementById('hnav"+(navindex+1)+"').src = '"+PICDIR+hnav[navindex+1]['l']+"'");
		}
	}
	aktivindex=-1;
}

function showsub(thisindex) {
	var o;
	for (i=0; i<subnav.length; i++) {
		o = document.getElementById('subnav'+i);
		o.src = PICDIR+subnav[i]['n'];
		o = document.getElementById('subunav'+i);
		if (o) {
			o.style.display = 'none';
		}
	}
	o = document.getElementById('subnav'+thisindex);
	o.src = PICDIR+subnav[thisindex]['o'];
	if ( (thisindex+1) < subnav.length ) {
		o = document.getElementById('subnav'+(thisindex+1));
		o.src = PICDIR+subnav[thisindex+1]['l'];
	}
	o = document.getElementById('subunav'+thisindex);
	if (o) {
		o.style.display = 'block';
	}
}

function hidesub(thisindex) {
	var o;
	o = document.getElementById('subnav' + thisindex);
	if (o) {
		o.src = PICDIR + subnav[thisindex]['n'];
	}
	if ( (thisindex+1) < subnav.length ) {
		o = document.getElementById('subnav' +(thisindex+1));
		if (o) {
			o.src = PICDIR + subnav[thisindex+1]['n'];
		}
	}
	o = document.getElementById('subunav' + thisindex);
	if (o) {
		o.style.display = 'none';
	}
	if (LVL!=0) {
		o = document.getElementById('subnav' + subindex);
		if (o) {
			o.src = PICDIR + subnav[subindex]['o'];
		}
		if ( (subindex+1) < subnav.length ) {
			o = document.getElementById('subnav' + (subindex+1));
			if (o) {
				o.src = PICDIR + subnav[subindex+1]['l'];
			}
		}
	}
	aktivsubindex=-1;
}
