	function openPopup(link, name, width, height) {
		var maxWidth = screen.availWidth-20;
		var maxHeight = screen.availHeight-20;
		i = link.indexOf('?')+1;
		link = link.substring(0, i)+'p=true&'+link.substring(i);
		if(width == '')
			width = 500;
		if(height == '')	
			height = 600;
		if(width > maxWidth)
			width = maxWidth;
		if(height > maxHeight)
			width = maxHeight;
	    leftpos = (screen.width/2)-(width/2);
	    obenpos = (screen.height/2)-(height/2);	
		newwin = window.open(link, name, "scrollbars=yes,resizable=yes,width="+width+",height="+height+",top="+obenpos+",left="+leftpos);
		newwin.focus();
	}		
	
	function submitForm(form, name, value) {
		document.forms[form][name].value = value;
		document.forms[form].submit();
	}

	function submitWithScroll(form, name, value){
	// Haengt die aktuellen (x,y)-Koordinaten an die action
	// des Formulars sForm
		if (document.all) {
			x = document.documentElement.scrollLeft;
			y = document.documentElement.scrollTop;
		} else {
			x = window.pageXOffset;
			y = window.pageYOffset;
		}
		if(document.forms[form]['action'].indexOf('?') < 0)
			document.forms[form]['action'] = document.forms[form]['action'] + '?';
	
		document.forms[form][name].value = value;
		document.forms[form]['action'] = document.forms[form]['action']+'&scrollX='+x+'&scrollY='+y;
		document.forms[form].submit();
	}

	function scrollWindow(x, y) {
		window.scrollTo(x,y);
	}		
	
	function printpage() {
		window.print();
	}
	
	function initClearSearchField(field, defaultValue){
		var val = new String(field.value);
		if(val == defaultValue){
			field.value = '';
		}
	}
	
	function checkCheckbox(checkId, hiddenId) {
		if(document.getElementById(checkId).checked)
			document.getElementById(hiddenId).value = 'on';
		else	
			document.getElementById(hiddenId).value = '';
	}	
	
	// Bestimmt die Position eines Elementes
	function getPosition(obj) {
	  var pos = { x:0, y:0 };
	
	  do {
	    pos.x += obj.offsetLeft;
	    pos.y += obj.offsetTop;
	  } while (obj = obj.offsetParent);
	
	  return pos;
	}	
	
	// Aendert aus einem Popup heraus den
	// Wert eines Formularelements im Hauptfensters 
	function setElemValueFromPopup(elemId, value) {
		window.opener.document.getElementById(elemId).value = value;
		window.close();
	}	
	
	
/**
	* Variabeln fur die Verwaltung der Divs
	*/
	var divVisibilityState;
	var divMouseOverState;
	
   /**
	* Zeigt ein Div mit der Id divId an.
	* Positioniert wird es an der Mausposition, an der geklickt
	* wurde.
	* PARAMETER:
	* divId: Die Id des Divs.
	* e: Das Event, das durch den Klick ausgeloest wurde.
	*/
	function showDiv(divId, e){
		if(divVisibilityState != null && divVisibilityState[divId] > 0){
			return;
		}
		var div = document.getElementById(divId);
		var width = parseInt(div.style.width);
		var height = parseInt(div.style.height);
		var ww,wh;
		if (self.innerHeight) {// all except Explorer
			ww = self.innerWidth;
			wh = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) {// Explorer 6 Strict Mode
			ww = document.documentElement.clientWidth;
			wh = document.documentElement.clientHeight;
		} else if (document.body) { // other Explorers
			ww = document.body.clientWidth;
			wh = document.body.clientHeight;
		}
		var x = (document.all) ? e.clientX + document.body.scrollLeft : e.pageX;
		var y = (document.all) ? e.clientY + document.body.scrollTop  : e.pageY;
		var dx = x;
		var dy = y;
		if((dx + width + 30) > ww){
			dx = ww - width - 30;
		}
		if((dy + height) > wh){
			dy = wh - height;
		}
		if(div != null){
			div.style.left = dx+ "px";
			div.style.top 	= dy + "px";

			div.style.display = "block";			
			div.style.position = "absolute";
			if(div.style.background == ''){
				div.style.background = "#FFFFFF";
			}
			if(div.style.border == ''){
				div.style.border = "1px solid gray";
			}
			addVisibleDiv(divId);
		}
		document.onclick = checkDivVisibility;
	}
	
   /**
	* Fuegt ein Div hinzu, das gerade neu angezeigt wird
	* PARAMTER:
	* divId: Die Id des Divs
	* WOKI/02.08.2006
	*/
	function addVisibleDiv(divId){
		if(divVisibilityState == null){
			divVisibilityState = new Object();
		}
		divVisibilityState[divId] = 1;
	}
	
   /**
	* Markiert setzt ein Div in den Zustand MouseOver
	* PARAMTER:
	* divId: Die Id des Divs
	* WOKI/02.08.2006
	*/
	function mouseOverDiv(divId){
		if(divMouseOverState == null){
			divMouseOverState = new Object();
		}
		divMouseOverState[divId] = true;			
	}
   /**
	* Markiert setzt ein Div in den Zustand MouseOut
	* PARAMTER:
	* divId: Die Id des Divs
	* WOKI/02.08.2006
	*/
	function mouseReleasedDiv(divId){
		if(divMouseOverState == null){
			divMouseOverState = new Object();
		}
		divMouseOverState[divId] = false;			
	}
	
   /**
	* Blendet ein Div wieder aus.
	* PARAMTER:
	* divId: Die Id des Divs
	* WOKI/02.08.2006	
	*/
	function hideDiv(divId){
		var div = document.getElementById(divId);
		if(div != null){
			div.style.display = "none";
			divVisibilityState[divId] = 0;				
		}			
	}
	
   /**
	* Wird aufgerufen, wenn mit der Maus irgendwo geklickt wird.
	* Dabei wird geregelt, welches Div weiter eingebelndet bleibt
	* und welches ausgeblendet wird.
	* WOKI/02.08.2006
	*/
	function checkDivVisibility(){
		if(divVisibilityState != null){
			for (var divId in divVisibilityState){
				if(divMouseOverState != null && divMouseOverState[divId] == true){
					continue;
				}
				if(divVisibilityState[divId] >= 1){
					hideDiv(divId);
				}
				//divVisibilityState[divId] = 2;
			}
		}
	}