/* generated by digitalhoch3.de */
// ---------------------------
//  Menu Actions
function showTab(myID){
	// hide all tabs
	var counter = 1;
	while(document.getElementById("menu" + counter) != null){
		for(i=0; i < document.getElementById("menu" + counter).childNodes.length; i++){
			if(document.getElementById("menu" + counter).childNodes[i].nodeName == "UL"){
				var menuRef = document.getElementById("menu" + counter).childNodes[i];
			}
		}
		menuRef.style.display = "none";
		counter++;
	}
	menuRef = "";
	for(i=0; i < document.getElementById(myID).childNodes.length; i++){
		if(document.getElementById(myID).childNodes[i].nodeName == "UL"){
			var menuRef = document.getElementById(myID).childNodes[i];
			menuRef.style.display = "";
		}
	}
	clearTimeout(delayhide);
}
// ---------------------------
// 
function hideTab(myID){
	if(tempY > 255){
		hideAllTabs();
	}
}
// ---------------------------
// 
function hideTab2(myID){
	delayhide = setTimeout("hideAllTabs()",1000)
}
// ---------------------------
// 
function hideAllTabs(){
	var counter = 1;
	while(document.getElementById("menu" + counter) != null){
		for(i=0; i < document.getElementById("menu" + counter).childNodes.length; i++){
			if(document.getElementById("menu" + counter).childNodes[i].nodeName == "UL"){
				var menuRef = document.getElementById("menu" + counter).childNodes[i];
			}
		}
		menuRef.style.display = "none";
		counter++;
	}
	clearTimeout(delayhide);
}
// ---------------------------
// 
function settingTabs(){
	var counter = 1;
	var mainElemRef;
	var subMenuRef;
	var mainElemWidth = 0;
	//
	hideAllTabs();
	//
	while(document.getElementById("menu" + counter) != null){
		mainElemRef = document.getElementById("menu" + counter);
		mainElemWidth = mainElemRef.firstChild.offsetWidth;
		for(i=0; i < mainElemRef.childNodes.length; i++){
			if(mainElemRef.childNodes[i].nodeName == "UL" && mainElemRef.childNodes[i].className != "subNav autoWidth"){
				subMenuRef = mainElemRef.childNodes[i];
				for(j=0; j < subMenuRef.childNodes.length; j++){
					if(subMenuRef.childNodes[j].nodeName == "LI"){
						subMenuRef.childNodes[j].firstChild.style.width = mainElemWidth - 12 + "px";
					}
				}
			}
		}
		counter++;
	}
}
// ---------------------------
// 
function debug(myValue){
	var myField = document.getElementById("debuggerField");
	myField.value += "\n" + myValue;
}
// ---------------------------
//  Main function to retrieve mouse x-y pos.s
function getMouseXY(e) {
	var topEdge = 170;
	var bottomEdge = 340;
	//
	if (IE) { // grab the x-y pos.s if browser is IE
		tempX = event.clientX  + document.body.scrollLeft + document.documentElement.scrollLeft;
		tempY = event.clientY  + document.body.scrollTop + document.documentElement.scrollTop;
	} else {  // grab the x-y pos.s if browser is NS
		tempX = e.pageX
		tempY = e.pageY
	}  
	// catch possible negative values in NS4
	if (tempX < 0){tempX = 0}
	if (tempY < 0){tempY = 0}  
	// show the position values in the form named Show
	// in the text fields named MouseX and MouseY
	if(tempY > bottomEdge || tempY < topEdge){
		//hideAllTabs();
	}
	//window.status = "tempY: " + tempY;
	//window.status = "tempY: " + document.documentElement.scrollTop;
	return true;
}
// ---------------------------
// 

// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false

// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE)

// Set-up to use getMouseXY function onMouseMove
document.onmousemove = getMouseXY;

// Temporary variables to hold mouse x-y pos.s
var tempX = 0
var tempY = 0
var delayhide;

// settings for tabs on load of document
window.onload = settingTabs;
