var timerID = null;
var timerIDpictureoff = null;
var timerIDpictureon = null;
var showArray = new Array("show", "visible", "visible");
var hideArray = new Array("hidden", "hidden", "hidden");
var numberOfObjects = 4;
var active = -1;
function isModernBrowser() {
	var dom = document.getElementById ? true: false;
	//var layers = document.layers ? true : false;
	return dom;// && !layers;
}

function numberOfOb (number) {
	numberOfObjects = number;
}




function show(id) {
	if (timerID) {
		clearTimeout(timerID);
		timerID = null;
	}
	if (timerIDpictureoff) {
		clearTimeout(timerIDpictureoff);
		timerIDpictureoff = null;
	}
	
	IDpictureon();	
	
	if (document.getElementById) { // W3C
		document.getElementById("menue" + id).style.visibility = showArray[2];
	} else {
		if (document.layers) { // Netscape
			//document.layers["menue_" + id].visibility = showArray[0];
		} else { // IE
			document.all["menue" + id].style.visibility = showArray[1];
		}
	}
	
	for (i = 0; i < numberOfObjects; i++) {
		if (i == id) {
			continue;
		}
		hide(i);
	}
}

function hide(id) {	
	
	if (document.getElementById) { // W3C
		if (active != id) {
			document.getElementById('menue' + id).style.visibility = hideArray[2];
			/*if (active != -1) {
				document.getElementById("menue_" + active).style.visibility = showArray[2];
			}*/
		}
	} else {
		if (document.layers) { // Netscape
			/*if (active != id) {
				document.layers["menue_" + id].visibility = hideArray[0];
			}*/
			/*if (active != -1) {
				document.layers["menu_" + active].visibility = showArray[0];
			}*/
		} else { // IE
			if (document.all) {
				document.all['menue' + id].style.visibility = hideArray[1];
				if (active != -1) {
					document.all['menue' + active].style.visibility = showArray[1];
				}
			}
		}
	}
}

function hold(id) {
	if (timerID) {
		clearTimeout(timerID);
		timerID = null;
	}
	// timerID = setTimeout("opacity('head_navigation_up_background_pic',0,100, 500)", 4000);
	IDpictureoff();
	timerID = setTimeout("hide('"+id+"')", 3000);
}

function IDpictureoff() {
	if (timerIDpictureoff) {
		clearTimeout(timerIDpictureoff);
		timerIDpictureoff = null;
	}
	timerIDpictureoff = setTimeout("opacity('head_navigation_up_background_pic',0,100, 500)", 3000);
}

function IDpictureon() {
	if (timerIDpictureon) {
		clearTimeout(timerIDpictureon);
		timerIDpictureon = null;
	}
	timerIDpictureon = setTimeout("opacity('head_navigation_up_background_pic',1,0, 500)", 100);
}


function opacity(id, opacStart, opacEnd, millisec) {
	
		//speed for each frame
		var speed = Math.round(millisec / 100);
		var timer = 0;
		
		//determine the direction for the blending, if start and end are the same nothing happens
		if(opacStart > opacEnd) {
				for(i = opacStart; i >= opacEnd; i--) {
				   setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
				 timer++;
				 warten=1;
			  }
				} else if(opacStart < opacEnd) {
					for(i = opacStart; i <= opacEnd; i++)
					{
						setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
						timer++;
					}
		}
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
} 