// JavaScript document
// Mouseover layers
var aktiv    =  true;   // helps mac-nc4 to deal with clearTimeout
var delay    =  null;   // timeout-handle
var delayDur =  50;    // delay after mouseout - you can modify here - not less then 50 ms
var navMax   =  2;      // how many menues?
var elM      =  false;  // flag - keeps open submenue

// initialize menue
// register mouseout and mousemove events
function startNavi () {
	// loop through all navi-divs until navMax
	// keep it simpel: use the same names an add "i"
	for(var i = 0; i < navMax; i++) {
		if(nc){
			dRef('subDiv' + i).captureEvents(Event.MOUSEOUT | Event.MOUSEMOVE);
			dRef('mainDiv' + i).captureEvents(Event.MOUSEOUT);
		}
		dRef('subDiv' + i).onmouseout  =  initHiding;
		dRef('subDiv' + i).onmousemove =  checkHiding;
		dRef('mainDiv' + i).onmouseout =  initHiding;
	}
}

// called when mouseout over div-layer was fired
// starting hiding-process of a submenue
function initHiding (e) {
	// in case of very slow mousemoves nc4 does not notice mousemove within the delay
	// loop throught all links of the layer to make shure not a link is the target
	if (nc && typeof document.layers[elM] != "undefined") {
		for (var i = 0; i < dRef(elM).document.links.length; i++) {
			if (e.target == dRef(elM).document.links[i]) return;
		}
	}	
	elPast      =  elM
	if(aktiv) {
		// call off - but wait for a time an check for mousemoves
		delay =  setTimeout('off()', delayDur);
		aktiv =  false;
	}
}

// called when mousemove over div-layer was fired
// clearing the hiding-process in case of mousemove within the div-layer
function checkHiding (e) {
	elM =  this.id;     
	if(!aktiv) {
		// stop hiding
		clearTimeout(delay);
		aktiv =  true;
	}
}

// hide submenue
function off (){
	if(elPast) dRefS(elPast).visibility = "hidden";       
}

// open submenue - close other open submenue
function on (num){
	if(!aktiv) {
		clearTimeout(delay);
		aktiv =  true;
	}
	if(elM && elM != "subDiv" + num) dRefS(elM).visibility =  "hidden";
	dRefS("subDiv" + num).visibility                       =  "visible";
	elM                                                    =  "subDiv" + num;
}


// some known objects
var nc   =  !!(document.captureEvents  && !document.getElementById);
var nc6  =  !!(document.captureEvents  && document.documentElement);
var op6  =  !!(document.getElementById && !document.documentElement);
var op7  =  !!(window.opera && /Opera( |\/)7/i.exec(navigator.userAgent));
var ie   =  !!document.all;
var ie4  =  !!(document.all           && !document.documentElement);
var ie5  =  !!(document.all           && document.documentElement);
var dom  =  !!document.getElementById;
var mac  =  !!(navigator.userAgent.indexOf("Mac")!=-1);

// div-layer referenzieren
function dRef(num)   {return (nc? document.layers[num]   : (ie4? document.all[num]       : document.getElementById(num)))}
function dRefS(num)  {return (nc? document.layers[num]   : (ie4? document.all[num].style : document.getElementById(num).style))}

// Onklick

function MM_openWindow(theURL,winName,features) { //v2.0
    window.open(theURL,winName,features);
}