	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();
	}	
	
	// Ein- und Ausblenden von divs auf der Aktuell-Detailseite
	function onoff (active_id) {
		elemArray = new Array('versenden', 'komm', 'komm_liste'); // Liste der IDs zwischen denen gewechselt werden kann
//		for (var elemNr in elemArray) {
		for (var elemNr = 0; elemNr <= 2; elemNr++) {
			elem = elemArray[elemNr];
			if(active_id == elem) { // einblenden
				document.getElementById(elem).style.display = 'block';
				document.getElementById('a_' + elem).className = elem + '_active';
//				if(elem == 'komm_liste') {
//					document.getElementById('a_komm_liste_close').className = 'funktion_aktiv';
//				}
			} else {	// ausblenen
				document.getElementById(elem).style.display = 'none';
				document.getElementById('a_' + elem).className = elem;
			}
		}
		switchKommentar();
	}
	
	// Schalter für Kommentare ein- und ausblenden
	function switchKommentar() {
		obj = document.getElementById('komm_liste');
		if(obj.style.display == 'block') { // Sonderfall Kommentare: Schalter zum schließen
			document.getElementById('a_komm_liste').style.display = 'none';	// Kommentar öffnen ausblenden
			document.getElementById('a_komm_liste_close').style.display = 'inline';	// Kommentar schließen einblenden
		} else {
			document.getElementById('a_komm_liste').style.display = 'inline';	// Kommentar öffnen einblenden
			document.getElementById('a_komm_liste_close').style.display = 'none';	// Kommentar schließen ausblenden
		}
	}