	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 = '';
	}		
	
   /**
	* Zeigt ein Div mit einer bestimmten Id an.
	* PARAMETER:
	* divId: Die Id des Divs.
	* visible: Wenn true, dann wird das Div angezeigt, 
	* sonst ausgeblendet.
	* WOKI/10.07.2007
	*/
	function showDiv(divId, visible){
		var d = document.getElementById(divId);
		if(d != null){
			if(visible == true){
				d.style.visibility = 'visible';
			} else {
				d.style.visibility = 'hidden';
			}
		}
	}
	
	// Aendert aus einem Popup heraus den
	// Wert eines Formularelements im Hauptfensters 
	function setElemValueFromPopup(elemId, value) {
		window.opener.document.getElementById(elemId).value = value;
		window.close();
	}	
	
	/**
	 * Zur Verschlüsselung von E-Mail-Adressen per JS
	 * MASC, 23.05.2008
	 */
	function encrypt_string(crypt, offset, classString, linkName) {
		var data = unescape(crypt);
		var len = data.length;
		var out;
		var mail = '';
		var classString = '';
		for(var i=0; i < len; i++) {
			var n = data.charCodeAt(i);	
			if(n > 90)
				mail = mail + String.fromCharCode(n-offset);
			else 
				mail = mail + String.fromCharCode(n+offset);
		}
		if(linkName == '')
			linkName = mail;
		out = '<a href="mailto:'+mail+'" '+classString+'>'+linkName+'</a>';
		document.write(out);
	}	