	function hepltext_on(text,id){
		td = document.getElementById(id);
		if(td.className=="navmain")
			td.className='navmain_on';
		else
			td.className='navsub_on';
	}
	function hepltext_off(id){
		td = document.getElementById(id);
		if(td.className=="navmain_on")
			td.className='navmain';
		else
			td.className='navsub';
	}
	
	var topmenr_prefix = "img/topmen_r";
	var topmenicon_prefix = "img/topmen_icon";
	function topmenhandleon(ele,id,pic) {
		ele.className = "topmenon";
		window.document.images["topmen"+id].src = str_replace(".png","_on.png",pic);
		window.document.images["menr"+id].src = topmenr_prefix+"_on.png";
		window.document.images["topmenicon"+id].src = topmenicon_prefix+id+"_on.png";
		window.document.images["topmen"+id].className = "topmenbgon";
	}
	function topmenhandleoff(ele,id,pic) {
		ele.className = "topmenoff";
		window.document.images["topmen"+id].src = str_replace("_on.png",".png",pic);
		window.document.images["menr"+id].src = topmenr_prefix+".png";
		window.document.images["topmenicon"+id].src = topmenicon_prefix+id+".png";
		window.document.images["topmen"+id].className = "topmenbgoff";
	}
	
	function str_replace(search, replace, subject) {
	    return subject.split(search).join(replace);
	}

	function handleClick(id) {
    var obj = "";
  	// Check browser compatibility
  	if(document.getElementById)
  		obj = document.getElementById(id);
  	else if(document.all)
  		obj = document.all[id];
  	else if(document.layers)
  		obj = document.layers[id];
  	else
  		return 1;

  	if (!obj) {
  		return 1;
  	} else if (obj.style) {
  		//obj.style.display = ( obj.style.display != "none" ) ? "none" : "";
  		if (obj.style.display != "none") {
	      obj.style.display = "none";
			  document.images['img'+id].src = "/img/plus.jpg";
			} else {
	      obj.style.display = "";
	      document.images['img'+id].src = "/img/minus.jpg";
			}
		} else {
  		obj.visibility = "show";
  		document.images['img'+id].src = "/img/minus.jpg";
  	}
  }

	function handleClicks(id,imax) {
		var myshow = false;
	
		//für das dummypic - um zu checken, ob alle ausgeklappt sind, oder nicht
		var obj = "";
  	// Check browser compatibility
  	if(document.getElementById)
  		obj = document.getElementById(id+imax);
  	else if(document.all)
  		obj = document.all[id+imax];
  	else if(document.layers)
  		obj = document.layers[id+imax];
  	else
  		return 1;

		if (!obj) {
  		return 1;
		} else if (obj.style) {
  		//obj.style.display = ( obj.style.display != "none" ) ? "none" : "";
  		if (obj.style.display != "none") {
	      myshow = false;
			} else {
				myshow = true;
			}
		} else {
  		myshow = false;
  	}  	
  	
  	imax++;
    for (var i=0; i<imax; i++) {
      var obj = "";
    	// Check browser compatibility
    	if(document.getElementById)
    		obj = document.getElementById(id+i);
    	else if(document.all)
    		obj = document.all[id+i];
    	else if(document.layers)
    		obj = document.layers[id+i];
    	else
    		return 1;
 
      if (!obj) {
    		return 1;
    	} else if (obj.style) {
    		obj.style.display = ( myshow == false ) ? "none" : "";
    	} else {
    		if (myshow == true) {
    			obj.visibility = "show";
    		}
    	}
    }
    
    if (myshow == false) {
			einaus(id+"einaus","aus");
		} else {
			einaus(id+"einaus","ein");
		}
	}


	function handleClicksOrig(id,imax) {
		var showaus = false;
    for (var i=0; i<imax; i++) {
      var obj = "";
    	// Check browser compatibility
    	if(document.getElementById)
    		obj = document.getElementById(id+i);
    	else if(document.all)
    		obj = document.all[id+i];
    	else if(document.layers)
    		obj = document.layers[id+i];
    	else
    		return 1;
 
      if (!obj) {
    		return 1;
    	} else if (obj.style) {
    		obj.style.display = ( obj.style.display != "none" ) ? "none" : "";
    		if (obj.style.display != "none") {
					showaus = true
				}
    	} else {
    		obj.visibility = "show";
    		showaus = false;
    	}
    }
    if (showaus == false) {
			einaus(id+"einaus","aus");
		} else {
			einaus(id+"einaus","ein");
		}
  }

	function einaus(id,text) {
	  var div = document.getElementById(id);
	  div.innerHTML = text;
	}

function IsIE()	{
	var majorVersion=99;
	if ((verOffset=navigator.userAgent.indexOf("MSIE"))!=-1) {
		var fullVersion  = parseFloat(navigator.userAgent.substring(verOffset+5));
		majorVersion = parseInt(''+fullVersion);
	}
	return ( majorVersion<7 && navigator.appName=="Microsoft Internet Explorer" );
}

var info=''; // infobox
var g_PopupIFrame; // IE <7 iFrame

function getPageSize(){

	var xScroll, yScroll;

	if (window.innerHeight && window.scrollMaxY) {
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}

	var windowWidth, windowHeight;

//	console.log(self.innerWidth);
//	console.log(document.documentElement.clientWidth);

	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth;
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}

	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else {
		pageHeight = yScroll;
	}

//	console.log("xScroll " + xScroll)
//	console.log("windowWidth " + windowWidth)

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){
		pageWidth = xScroll;
	} else {
		pageWidth = windowWidth;
	}
//	console.log("pageWidth " + pageWidth)

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
	return arrayPageSize;
}

// -----------------------------------------------------------------------------------

function hide_infos(){
	if (IsIE()&&g_PopupIFrame){
		document.body.removeChild(g_PopupIFrame);
		g_PopupIFrame=null;
	}
	info.className= 'hide';
	var objBody = document.getElementsByTagName("body").item(0);
	var objOverlay = document.getElementById("overlay");
	objBody.removeChild(objOverlay);
}
function hide_info(feld){
	if (IsIE()&&g_PopupIFrame){
		document.body.removeChild(g_PopupIFrame);
		g_PopupIFrame=null;
	}
	feld.className= 'hide';
	var objBody = document.getElementsByTagName("body").item(0);
	var objOverlay = document.getElementById("overlay");
	objBody.removeChild(objOverlay);
}
function hide_info_byId(id){
  feld=document.getElementById(id);
	if (IsIE()&&g_PopupIFrame){
		document.body.removeChild(g_PopupIFrame);
		g_PopupIFrame=null;
	}
	feld.className= 'hide';
	var objBody = document.getElementsByTagName("body").item(0);
	var objOverlay = document.getElementById("overlay");
	if(objOverlay)objBody.removeChild(objOverlay);
}
function show_info(feld,ohneoverlay){
	new_info = document.getElementById(feld);
	if(new_info!=info){
		info.className= 'hide';
		if (IsIE()&&g_PopupIFrame){
			document.body.removeChild(g_PopupIFrame);
			g_PopupIFrame=null;
		}
		var objBody = document.getElementsByTagName("body").item(0);
		var objOverlay = document.getElementById("overlay");
		if(objOverlay)objBody.removeChild(objOverlay);
	}
	info=new_info;	
	if(info.className == 'infobox'){
		info.className= 'hide';
		if (IsIE()){
			document.body.removeChild(g_PopupIFrame);
			g_PopupIFrame=null;
		}
	}
	else{
		info.className= 'infobox';
		var objBody = document.getElementsByTagName("body").item(0);
		if(ohneoverlay!=1){
  		var objOverlay = document.createElement("div");
  		var arrayPageSize = getPageSize();
  		objOverlay.setAttribute('id','overlay');
      objOverlay.style.width = arrayPageSize[0] +"px";
      objOverlay.style.height = arrayPageSize[1] +"px";
  		objOverlay.onclick = function() { hide_infos(); }
      objBody.appendChild(objOverlay);
    }
		if (IsIE()){
			//Increase default zIndex of div by 1, so that DIV appears before IFrame
			info.style.zIndex=info.style.zIndex+1;
			var iFrame = document.createElement("IFRAME");
			iFrame.setAttribute("src", "../blank.html");
			iFrame.setAttribute("frameBorder","0");
			//Match IFrame position with divPopup
			iFrame.style.position="absolute";
			iFrame.style.left =info.offsetLeft+5 + 'px';
			iFrame.style.top =info.offsetTop+5 + 'px';
			iFrame.style.width =info.offsetWidth-10 + 'px';
			iFrame.style.height =info.offsetHeight-10 + 'px';
			iFrame.style.border = "0px";
			document.body.appendChild(iFrame);
			//Store iFrame in global variable, so it can get removed when divPopup is hidden
			g_PopupIFrame=iFrame;
		}
	}
}

