/**
*	Frontend-Script
*
*	enthält viele Funktionen für das Frontend
*	(c) 2002-2003, sethora.de
*/
var menuoffset_y=null;
var aktuellesbild=0;
var timer=null;
var htimer=null;
var s_activelayer=0;
var h_obj;
var HexChars="0123456789ABCDEF";

/**
*	bildhervorheben
*/
function bildhervorheben(b,m) {
	if (b.parentElement) {
		e=b.parentElement.parentElement;
		}
	if (b.parentNode) {
		e=b.parentNode.parentNode;
		}
	if (e.className=="singleImage") {
		switch(m) {
			case 1:
				if (document.all) {
					b.style.filter="alpha(opacity=100)";
					}
				else {
					b.style.opacity=1;
					}
			break;
			default:
				if (document.all) {
					b.style.filter="alpha(opacity=40)";
					}
				else {
					b.style.opacity=0.4;
					}
			break;
			}
		}
	}

/**
*	checkMouseLeave
*/
function checkMouseLeave (element, evt) {
	if (element.contains && evt.toElement) {
		if (evt.toElement.tagName=="AREA") {
			return false;
			}
		return !element.contains(evt.toElement);
		}
	else if (evt.relatedTarget) {
		if (evt.relatedTarget.tagName=="AREA") {
			return false;
			}
		return !containsDOM(element, evt.relatedTarget);
		}
	}

/**
*	checkPassword
*/
function checkPassword() {
	var alarm="";
	var fields=document.forms['anmeldung'].elements;
	if ((fields['pw'].value==""||fields['pwconfirm'].value=="")) {
		alarm="Bitte geben Sie ein Passwort ein.";
		}
	if (fields['pw'].value!=fields['pwconfirm'].value) {
		alarm="Die von Ihnen eingegebene Passwortbestätigung unterscheidet sich von Ihrem gewünschten Passwort. Bitte überprüfen Sie Ihre Eingaben.";
		}
	for (i=0;i<fields.length;i++) {
		if (fields[i].value==null||fields[i].value=="") {
			if (fields[i].options||fields[i].type=="hidden") {
				}
			else {
				alarm="Bitte füllen Sie alle Felder aus.";
				}
			}
		}
	if (alarm=="") {
		document.forms['anmeldung'].submit();
		}
	else {
		alert(alarm);
		}
	}

/**
*	containsDOM
*/
function containsDOM (container, containee) {
	var isParent = false;
	do {
		if ((isParent = container == containee))
			break;
		containee = containee.parentNode;
		}
	while (containee != null);
	return isParent;
	}

/**
*	diashowmove
*/
function diashowmove(m) {
	var b=document.getElementById("allebilder").childNodes;
	var n=b.length;
	switch(m) {
		case 0:
			aktuellesbild--;
		break;
		case 1:
			aktuellesbild++;
		break;
		}
	if (aktuellesbild>n) {
		aktuellesbild=aktuellesbild-n;
		}
	if (aktuellesbild<0) {
		aktuellesbild=n+aktuellesbild;
		}
	if (b[aktuellesbild]) {
		var t=b[aktuellesbild].childNodes[0].href.replace("javascript:","");
		eval(t);
		}
	else {
		switch(m) {
			case 0:
				aktuellesbild=n;
			break;
			case 1:
				aktuellesbild=0;
			break;
			}
		var t=b[aktuellesbild].childNodes[0].href.replace("javascript:","");
		eval(t);
		}
	fotoshowstart();
	}

/**
*	diashowrun
*/
function diashowrun(v) {
	if (timer!=null) {
		window.clearInterval(timer);
		timer=null;
		}
	switch (v) {
		case 2:
			timer=window.setInterval("diashowmove(1)", 3000);
		break;
		case 1:
			timer=window.setInterval("diashowmove(1)", 5000);
		break;
		default:
			if (timer!=null) {
				window.clearInterval(timer);
				timer=null;
				}
		break;
		}
	}

/**
*	emailCheck
*
*	überprüft eine E-Mail-Adresse auf Ihr Gültigkeit
*/
function emailCheck (emailStr) {

	/**
	*	Sollen TLDs überprüft werden?
	*	0=nein, 1=ja
	*/
	var checkTLD=1;

	/**
	*	Liste gültiger TLDs mit mehr als 2 Buchstaben
	*/
	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
	var emailPat=/^(.+)@(.+)$/;
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
	var validChars="\[^\\s" + specialChars + "\]";
	var quotedUser="(\"[^\"]*\")";
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	var atom=validChars + '+';
	var word="(" + atom + "|" + quotedUser + ")";
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
	var matchArray=emailStr.match(emailPat);
	if (matchArray==null) {
		alert("Ungültige Email-Adresse (prüfen Sie @ und .'s)");
		return false;
		}
	var user=matchArray[1];
	var domain=matchArray[2];
	for (i=0; i<user.length; i++) {
		if (user.charCodeAt(i)>127) {
			alert("Ungültige Zeichen im Usernamen.");
			return false;
			}
		}
	for (i=0; i<domain.length; i++) {
		if (domain.charCodeAt(i)>127) {
			alert("Ungültige Zeichen im Domainnamen.");
			return false;
			}
		}
	if (user.match(userPat)==null) {
		alert("Name ungültig.");
		return false;
		}
	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null) {
		for (var i=1;i<=4;i++) {
			if (IPArray[i]>255) {
				alert("IP Addresse ungültig!");
				return false;
				}
			}
		return true;
		}
	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	for (i=0;i<len;i++) {
		if (domArr[i].search(atomPat)==-1) {
			alert("Ungültige Domain.");
			return false;
			}
		}
	if (checkTLD && domArr[domArr.length-1].length!=2 && 
		domArr[domArr.length-1].search(knownDomsPat)==-1) {
		alert("Ungültige Top-Level-Domain oder Land.");
		return false;
		}
	if (len<2) {
		alert("Kein Host angegeben!");
		return false;
		}
	return true;
	}

/**
*	fotoshowStart
*/
function fotoshowstart() {
	if (document.all) {
		var width=685;
		var height=686;
		}
	else {
		var width=676;
		var height=681;
		}
	var x = Math.round((screen.availWidth - width) / 2);
	var y = Math.round((screen.availHeight - height) / 2);
	window.moveTo(x,y);
	window.resizeTo(width,height);
	document.getElementById("vorhang").style.display="none";
	document.getElementById("allebilder").style.display="none";
	var p=document.getElementById("previewbox");
	p.innerHTML="";
	if (document.getElementById("allebilder").innerHTML=="") {
		document.getElementById("imageframe_knopfbox").style.visibility="hidden";
		}
	var b=document.getElementById("allebilder").childNodes;
	var n=b.length;
	if (aktuellesbild>n) {
		aktuellesbild=aktuellesbild-n;
		}
	if (aktuellesbild<0) {
		aktuellesbild=n+aktuellesbild;
		}
	if(n>5) {
		var startpos	= aktuellesbild-2;
		var endpos		= (parseInt(aktuellesbild)+3);
		}
	if(n>=1&&n<=5) {
		var startpos	= 0;
		var endpos		= 5;
		}
	if(n<5) {
		var startpos	= 0;
		var endpos		= n;
		}
	for (i=startpos;i<endpos;i++) {
		var pos				= i;
		if (pos<0) {
			pos=n+pos;
			}
		if (pos>=n) {
			pos=pos-n;
			}
		var newbild 			= document.createElement("DIV");
		newbild.innerHTML		= b[pos].innerHTML;
		if (pos==aktuellesbild) {
			newbild.className	= "singleImageAktiv";
			}
		else {
			newbild.className	= "singleImage";
			}
		p.appendChild(newbild);
		}
	}

/**
*	getDim
*
*	findet die Koordinaten des Elements heraus,
*	auf welches geklickt wurde.
*
*	@el:	pointer auf das HTML-Element, welches untersucht wird
*/
function getDim(elem){
	var ua = navigator.userAgent.toLowerCase();
    var isSafari = (ua.indexOf('safari') > -1);
	if (document.getElementById) {
		var x = 0;
		var y = 0;
		while (elem.offsetParent) {	
			x += elem.offsetLeft + (elem.clientLeft || 0);
			y += elem.offsetTop + (elem.clientTop || 0);
			elem = elem.offsetParent;
			}
		if (isSafari) {
			x -= document.body.offsetLeft;
			y -= document.body.offsetTop;
			}
		return {x: x, y: y};
		}
	if (document.layers) {
		return {
			x:elem.x,y:elem.y
			}
		}
	}

/**
*	stellt fest, ob ein Objekt des Typs obj in der Objekthierarchie nach oben enthalten ist
*/
function getDiv(obj,name) {
	while (obj.parentNode) {	
		if (obj.parentNode.tagName==name) {
			return true;
			}
		obj = obj.parentNode;
		}
	return false;
	}

/**
*	stellt fest, ob ein Objekt des Typs obj in der Objekthierarchie nach oben enthalten ist
*/
function getId(obj,name) {
	while (obj.parentNode) {	
		if (obj.parentNode.id==name) {
			return true;
			}
		obj = obj.parentNode;
		}
	return false;
	}

/**
*	stellt fest, ob ein Objekt des Typs obj in der Objekthierarchie nach oben enthalten ist
*/
function getDivHeight(obj,name) {
	var height=0;
	while (obj.parentNode) {	
		if (obj.parentNode.tagName==name&&obj.parentNode.offsetTop>0) {
			height+=parseInt(obj.parentNode.offsetTop);
			break;
			}
		obj = obj.parentNode;
		}
	return height;
	}

/**
*	getElementsByClassName
*/
function getElementsByClassName(findClass) {
	var aElm=document.body.getElementsByTagName('*');
	var val=[];
	for(var i=0; i<aElm.length; i++) {
		if(aElm[i].className==findClass) {
			val.push(aElm[i]);
			}
		}
	return val;
	}

/**
*	getGalleryHeight
*
*	ermittelt die Höhe des Bildergalerie-Fensters
*
*	@param	integer	anzahl	Anzahl Bilder
*/
function getGaleryHeight(anzahl) {
	var spalten=7;
	var hoehe=140;
	var anzahlZeilen=Math.ceil(anzahl/spalten)-1;
	hoehe=hoehe+(anzahlZeilen*116);
	if (hoehe>380) {
		hoehe=372;
		}
	return hoehe;
	}

/**
*	getGalleryWidth
*
*	ermittelt die Breite des Bildergalerie-Fensters
*
*	@param	integer	anzahl	Anzahl Bilder
*/
function getGaleryWidth(anzahl) {
	var spalten=6;
	var breite=0;
	if (anzahl>spalten) {
		breite=spalten*133+13;
		}
	else {
		breite=anzahl*133+13;
		}
	if (getGaleryHeight(anzahl)==372) {
		breite=breite+16;
		}
	return breite;
	}

/**
*	GetXmlHttpObject
*	AJAX Funktionen können hiermit initialisiert werden.
*/
function GetXmlHttpObject() { 
	var objXMLHttp=null;
	if (window.XMLHttpRequest) {
		objXMLHttp=new XMLHttpRequest();
		}
	else if (window.ActiveXObject) {
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	return objXMLHttp;
	}

/**
*	headlineMenuShow
*
*	zeigt ein untergeordnetes Menü eines Headlinemenüs an
*/
function headlineMenuShow(obj,id) {
	if (htimer!=null) {
		clearTimeout(htimer);
		}
	var tag=obj;
	while (obj.parentNode.tagName!="BODY") {
		obj=obj.parentNode;
		if (obj.tagName=="DIV") {
			break;
			}
		}
	var pos=getDim(tag);
	var cpos=getDim(obj);
	headlineMenuHide(obj);
	var moveY=24;
	if (obj.currentStyle) {
		if (obj.currentStyle.height&&parseInt(obj.currentStyle.height.replace("px",""))>0) {
			moveY=parseInt(obj.currentStyle.height.replace("px",""))+4;
			}
		}
	if (menuoffset_y!=null) {
		moveY=menuoffset_y;
		}
	if (document.getElementById("headlineSubmenu_"+id)) {
		if (obj.className=="headlineSubmenu_upper") {
			document.getElementById("headlineSubmenu_"+id).style.top=(pos.y-cpos.y+moveY)+"px";
			document.getElementById("headlineSubmenu_"+id).style.left=(pos.x-cpos.x)+"px";
			}
		else {
			document.getElementById("headlineSubmenu_"+id).style.top=(pos.y-cpos.y-1)+"px";
			if(obj.clientWidth) {
				document.getElementById("headlineSubmenu_"+id).style.left=(pos.x-cpos.x+obj.clientWidth-1)+"px";
				}
			else {
				document.getElementById("headlineSubmenu_"+id).style.left=(pos.x-cpos.x+115)+"px";
				}
			}
		document.getElementById("headlineSubmenu_"+id).style.display="block";
		}
	}

/**
*	headlineMenuHide
*
*	blendet ein Headlinemenü wieder aus
*/
function headlineMenuHide(obj) {
	for (i=0;i<obj.childNodes.length;i++) {
		if (obj.childNodes[i].tagName=="DIV") {
			obj.childNodes[i].style.display="none";
			}
		}
	}

/**
*	headlinemenuhideall
*/
function headlinemenuhideall(o) {
	h_obj=o;
	htimer=setTimeout("headlineMenuShow(h_obj,-10)",2000);
	}

/**
*	Hexadezimalumrechnung
*/
function Hex(dec) {
	return HexChars.charAt((dec>>4)&0xf)+HexChars.charAt(dec&0xf)
	}
function Dec(hex) {
	return parseInt(hex.toUpperCase(),16)
	}

/**
*	kalenderSwitch
*
*	geht zur Seite, auf der ein neues Kalenderdatum angezeigt wird
*
*	@param	integer		tag		Tagesdatum
*	@param	integer		monat	Monatsdatum
*	@param	integer		jahr	Jahresdatum
*	@param	integer		mid		Menüpunkt-ID
*	@param	integer		tid		Text-ID
*/
function kalenderSwitch(tag,monat,jahr,mid,tid) {
	location.href="index.php3?ACTION=MENUEPUNKT&ID="+mid+"&displayText="+tid+"&KALENDERDATUM="+jahr+"-"+monat+"-"+tag;
	}

/**
*	loadGalerieBild
*/
function loadGalerieBild(i,t,a) {
	document.getElementById("mainbild").innerHTML="<img alt=\""+a+"\" src=\"index.php3?ACTION=imageShow&ID="+i+"&width=640&height=480&method=cut&textid="+t+"\" border=\"0\">";
	if (document.all) {
		document.getElementById("kommentar").innerHTML=unescape(a);
		}
	else {
		document.getElementById("kommentar").innerHTML=decode_utf8(unescape(a));
		}
	document.getElementById("kommentar").href="index.php3?ACTION=imageShow&ID=index.php3?ACTION=imageShow&ID="+i+"&textid="+t+"&download=yes";
	document.title=a;
	aktuellesbild=t;
	fotoshowstart();
	}

/**
*	mccode
*
*	blendet den Flash Video Player ein.
*/
function mccode(videotarget,fpFileURL,fpPreviewImageURL) {
	vt=document.getElementById(videotarget);
	if (typeof playerFile == 'undefined') { playerFile = '/cms/images/flash/mcmp.swf'; }
	if (typeof fpFileURL != 'undefined') { mcflashvars = 'fpFileURL='+fpFileURL; }
	playerSize = vt.clientWidth+'x'+vt.clientHeight;
	var psep = playerSize.indexOf("x");
	var playerWidth = playerSize.substring(0,psep);
	var playerHeight = playerSize.substring(psep+1);
	if (typeof streamingServerURL != 'undefined') { mcflashvars += '&streamingServerURL='+streamingServerURL; }
	if (typeof fpAction != 'undefined') { mcflashvars += '&fpAction='+fpAction; }
	if (typeof fpPreviewImageURL != 'undefined') { mcflashvars += '&fpPreviewImageURL='+fpPreviewImageURL; }
	if (typeof colorScheme != 'undefined') { mcflashvars += '&colorScheme='+colorScheme; }// New in v0.8
	else { if (window.getComputedStyle) { bgc = window.getComputedStyle(vt, null).color; } else if (vt.currentStyle) { bgc = vt.currentStyle.color; } mcflashvars += '&colorScheme='+bgc.replace("#",""); }
	if (typeof cpBackgroundColor != 'undefined') { mcflashvars += '&cpBackgroundColor='+cpBackgroundColor; }
	if (typeof cpBackgroundOpacity != 'undefined') { mcflashvars += '&cpBackgroundOpacity='+cpBackgroundOpacity; }
	if (typeof cpButtonsOpacity != 'undefined') { mcflashvars += '&cpButtonsOpacity='+cpButtonsOpacity; }
	if (typeof cpCounterPosition != 'undefined') { mcflashvars += '&cpCounterPosition='+cpCounterPosition; }
	if (typeof cpFullscreenBtnPosition != 'undefined') { mcflashvars += '&cpFullscreenBtnPosition='+cpFullscreenBtnPosition; }
	if (typeof cpHideDelay != 'undefined') { mcflashvars += '&cpHideDelay='+cpHideDelay; }
	if (typeof cpHidePanel != 'undefined') { mcflashvars += '&cpHidePanel='+cpHidePanel; }
	if (typeof cpInfoBtnPosition != 'undefined') { mcflashvars += '&cpInfoBtnPosition='+cpInfoBtnPosition; }
	if (typeof cpPlayBtnPosition != 'undefined') { mcflashvars += '&cpPlayBtnPosition='+cpPlayBtnPosition; }
	if (typeof cpPlayBtnColor != 'undefined') { mcflashvars += '&cpPlayBtnColor='+cpPlayBtnColor; }// New in v0.8
	if (typeof cpPosition != 'undefined') { mcflashvars += '&cpPosition='+cpPosition; }
	if (typeof cpRepeatBtnPosition != 'undefined') { mcflashvars += '&cpRepeatBtnPosition='+cpRepeatBtnPosition; }
	if (typeof cpScrubberPosition != 'undefined') { mcflashvars += '&cpScrubberPosition='+cpScrubberPosition; }
	if (typeof cpScrubberColor != 'undefined') { mcflashvars += '&cpScrubberColor='+cpScrubberColor; }// New in v0.8
	if (typeof cpScrubberLoadedColor != 'undefined') { mcflashvars += '&cpScrubberLoadedColor='+cpScrubberLoadedColor; }// New in v0.8
	if (typeof cpScrubberElapsedColor != 'undefined') { mcflashvars += '&cpScrubberElapsedColor='+cpScrubberElapsedColor; }// New in v0.8
	if (typeof cpVolumeStart != 'undefined') { mcflashvars += '&cpVolumeStart='+cpVolumeStart; }
	if (typeof cpStopBtnPosition != 'undefined') { mcflashvars += '&cpStopBtnPosition='+cpStopBtnPosition; }
	if (typeof cpStopBtnColor != 'undefined') { mcflashvars += '&cpStopBtnColor='+cpStopBtnColor; }// New in v0.8
	if (typeof cpVolumeBtnPosition != 'undefined') { mcflashvars += '&cpVolumeBtnPosition='+cpVolumeBtnPosition; }
	if (typeof cpVolumeCtrlColor != 'undefined') { mcflashvars += '&cpVolumeCtrlColor='+cpVolumeCtrlColor; }// New in v0.8
	if (typeof cpSize != 'undefined') { mcflashvars += '&cpSize='+cpSize; }
	if (typeof defaultBufferLength != 'undefined') { mcflashvars += '&defaultBufferLength='+defaultBufferLength; }
	if (typeof defaultEndAction != 'undefined') { mcflashvars += '&defaultEndAction='+defaultEndAction; }
	if (typeof defaultStopAction != 'undefined') { mcflashvars += '&defaultStopAction='+defaultStopAction; }
	if (typeof fpButtonOpacity != 'undefined') { mcflashvars += '&fpButtonOpacity='+fpButtonOpacity; }
	if (typeof fpButtonPosition != 'undefined') { mcflashvars += '&fpButtonPosition='+fpButtonPosition; }
	if (typeof fpButtonSize != 'undefined') { mcflashvars += '&fpButtonSize='+fpButtonSize; }
	if (typeof fpButtonColor != 'undefined') { mcflashvars += '&fpButtonColor='+fpButtonColor; }// New in v0.8
	if (typeof fpPreviewImageSize != 'undefined') { mcflashvars += '&fpPreviewImageSize='+fpPreviewImageSize; }
	if (typeof msgBackgroundColor != 'undefined') { mcflashvars += '&msgBackgroundColor='+msgBackgroundColor; }
	if (typeof msgBackgroundOpacity != 'undefined') { mcflashvars += '&msgBackgroundOpacity='+msgBackgroundOpacity; }
	if (typeof playerBackgroundColor != 'undefined') { mcflashvars += '&playerBackgroundColor='+playerBackgroundColor; }
	else { if (window.getComputedStyle) { bgc = window.getComputedStyle(vt, null).backgroundColor; } else if (vt.currentStyle) { bgc = vt.currentStyle.backgroundColor; } mcflashvars += '&playerBackgroundColor='+bgc.replace("#",""); }
	if (typeof playerAutoResize != 'undefined') { mcflashvars += '&playerAutoResize='+playerAutoResize; }// New in 0.7
	if (typeof playerSize != 'undefined') { mcflashvars += '&playerSize='+playerSize; }
	if (typeof videoScreenSize != 'undefined') { mcflashvars += '&videoScreenSize='+videoScreenSize; }
	if (typeof videoScreenPosition != 'undefined') { mcflashvars += '&videoScreenPosition='+videoScreenPosition; }
	if (typeof tooltipTextColor != 'undefined') { mcflashvars += '&tooltipTextColor='+tooltipTextColor; }// New in 0.7
	if (typeof tooltipBGColor != 'undefined') { mcflashvars += '&tooltipBGColor='+tooltipBGColor; }// New in 0.7
	var str='';
	str+='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=7,0,19,0" width="'+playerWidth+'" height="'+playerHeight+'">\n';
	str+='<param name="movie" value="'+playerFile+'">';
	str+='<param name="allowScriptAccess" value="always">';
	str+='<param name="quality" value="high">';
	str+='<param name="allowFullScreen" value="true">';
	str+='<param name="FlashVars" value="'+mcflashvars+'">\n';
	str+='<embed src="'+playerFile+'" width="'+playerWidth+'" height="'+playerHeight+'" quality="high" allowFullScreen="true" allowscriptaccess="always" pluginspage="http:\/\/www.macromedia.com\/go\/getflashplayer" type="application\/x-shockwave-flash" FlashVars="'+mcflashvars+'"><\/embed>\n';
	str+='<\/object>';
	vt.innerHTML=str;
	}

/**
*	nextPicture
*
*	Bildergalerie:
*	Das nächste Bild anzeigen
*
*	@param	object image	object		Das zu verändernde Bild
*	@param	array			idarray		Array mit den Bild-IDs, die in Frage kommen
*	@param	array			altarray	Array mit den Bildkommentaren
*	@param	integer			counter		Der Bildzähler
*	@return	integer						Increment des Zählers
*/
function nextPicture(object,idarray,altarray,counter) {
	if (counter<(idarray.length-1)) {
		counter++;
		if (object.width&&object.width!=80) {
			object.src='index.php3?ACTION=imageShow&ID='+idarray[counter]+'&width='+object.width+'&height='+object.height+'&method=adjust&rnd='+Math.random();
			}
		else {
			object.src='index.php3?ACTION=THUMBNAILSHOW&ID='+idarray[counter]+'&rnd='+Math.random();
			}
		object.alt=altarray[counter];
		window.status=altarray[counter];
		}
	return counter;
	}

/**
*	pflichtfeldcheck
*
*	überprüft, ob die Pflichtfelder in einem Formular ausgefüllt wurden
*
*	@param	string	f	formularname
*	@param	string	c	pflichtfeldname
*	@return	boolean		Ausgefüllt, oder nicht
*/
function pflichtfeldcheck(f,c) {
	var senden=true;
	var el=document.forms[f].elements;
	for (i=0;i<el.length;i++) {
		if (el[i].className==c) {
			el[i].style.backgroundColor="#fff";
			}
		}
	for (i=0;i<el.length;i++) {
		if (el[i].className==c&&el[i].value=="") {
			el[i].style.backgroundColor="red";
			senden=false;
			}
		}
	if (!senden) {
		alert("Bitte überprüfen Sie alle rot markierten Eingabefelder im Formular, und füllen Sie diese ggf. richtig aus.");
		}
	return senden;
	}

/**
*	previousPicture
*
*	Bildergalerie:
*	Das vorherige Bild anzeigen
*
*	@param	object image	object		Das zu verändernde Bild
*	@param	array			idarray		Array mit den Bild-IDs, die in Frage kommen
*	@param	array			altarray	Array mit den Bildkommentaren
*	@param	integer			counter		Der Bildzähler
*	@return	integer						Decrement des Zählers
*/
function previousPicture(object,idarray,altarray,counter) {
	if (counter>0) {
		counter--;
		if (object.width&&object.width!=80) {
			object.src='index.php3?ACTION=imageShow&ID='+idarray[counter]+'&width='+object.width+'&height='+object.height+'&method=adjust&rnd='+Math.random();
			}
		else {
			object.src='index.php3?ACTION=THUMBNAILSHOW&ID='+idarray[counter]+'&rnd='+Math.random();
			}
		object.alt=altarray[counter];
		window.status=altarray[counter];
		}
	return counter;
	}

/**
*	openCentered
*
*	Ein Fenster zentriert öffnen
*
*	@url:			Die URL zum Inhalt des Fensters
*	@width:			die Breite des Fensters in Pixeln
*	@height:		die Höhe des Fensters in Pixeln
*	@windowName:	der Referenzname des Fensters
*	@featureString:	weitere Angaben (Buttonbar, resizable usw.)
*/
function openCentered (url, width, height, windowName, featureString) {
	if (!windowName) {
		windowName = '';
		}
	if (!featureString) {
		featureString = ',status=no';
		}
	else {
		featureString = ',status=no,' + featureString;
		}
	var x = Math.round((screen.availWidth - width) / 2);
	var y = Math.round((screen.availHeight - height) / 2);
	featureString = 'left=' + x + ',top=' + y + ',width=' + width + ',height=' + height + featureString;
	open (url, windowName, featureString);
	}

/**
*	showDate	
*
*	Function to get input back from calendar popup
*/
function showDate(y,m,d) {
	calendarPointer.value = d+"."+m+"."+y;
	}

/**
*	showKalenderItem
*/
function showKalenderItem(id) {
	e=document.getElementById("kalenderItemLink"+id);
	switch (e.innerHTML) {
		case "Details ausblenden":
			document.getElementById("kalenderItem"+id).style.display="none";
			e.innerHTML="Details anzeigen";
		break;
		default:
			document.getElementById("kalenderItem"+id).style.display="inline"; 
			e.innerHTML="Details ausblenden";
		break;
		}
	}

/**
*	showLoginTab
*
*	zeigt einer der beiden Karteikarten des Anmeldeformulars
*/
function showLoginTab(n) {
	document.getElementById("logintab1").style.display="none";
	document.getElementById("logintab2").style.display="none";
	document.getElementById("logintab"+n).style.display="block";
	}

/**
*	startSynapsisDiashow
*/
function SynapsisDiashowStart(t,textids,w,h) {
	timer=[];
	var rsc="http://"+location.host+"/scripts/frontend/index.php3?ACTION=imageShow&textid="+t+"&width="+w+"&height="+h+"&method=cut&ID=";
	if (typeof synapsis_static!="undefined") {
		rsc="/images/cut/"+t+"/";
		}
	var bild="";
	for (i=0;i<textids.length;i++) {
		bild+="<img src=\""+rsc+textids[i]+"\">";
		}
	document.getElementById("synapsis_diashow_"+t+"_3").innerHTML=bild;
	document.getElementById("synapsis_diashow_"+t+"_2").style.backgroundImage="url('"+rsc+textids[1]+"')";
	document.getElementById("synapsis_diashow_"+t+"_1").style.backgroundImage="url('"+rsc+textids[0]+"')";
	if (typeof synapsis_static!="undefined") {
		document.getElementById("synapsis_diashow_"+t+"_2").style.backgroundImage="url('"+rsc+textids[1]+"/"+w+"/"+h+".jpg')";
		document.getElementById("synapsis_diashow_"+t+"_1").style.backgroundImage="url('"+rsc+textids[0]+"/"+w+"/"+h+".jpg')";
		}
	SynapsisDiashowloadPage(1,0,t,textids,rsc,w,h);
	}

/**
*	SynapsisDiashowloadPage
*/
function SynapsisDiashowloadPage(s_activelayer,x,t,textids,rsc,w,h) {
	var fade=100;
	switch (s_activelayer) {
		case 1:
			s_activelayer=0;
			document.getElementById("synapsis_diashow_"+t+"_1").style.backgroundImage="url('"+rsc+textids[x]+"')";
			if (typeof synapsis_static!="undefined") {
				document.getElementById("synapsis_diashow_"+t+"_1").style.backgroundImage="url('"+rsc+textids[x]+"/"+w+"/"+h+".jpg')";
				}
		break;
		default:
			s_activelayer=1;
			document.getElementById("synapsis_diashow_"+t+"_2").style.backgroundImage="url('"+rsc+textids[x]+"')";
			if (typeof synapsis_static!="undefined") {
				document.getElementById("synapsis_diashow_"+t+"_2").style.backgroundImage="url('"+rsc+textids[x]+"/"+w+"/"+h+".jpg')";
				}
		break;
		}
	timer[t]=setTimeout("SynapsisDiashowfadepicture("+s_activelayer+","+t+","+fade+","+x+",["+textids+"],'"+rsc+"',"+w+","+h+");", 3500);
	}

/**
*	SynapsisDiashowfadepicture
*/
function SynapsisDiashowfadepicture(s_activelayer,t,fade,x,textids,rsc,w,h) {
	if (s_activelayer==0) {
		e=document.getElementById("synapsis_diashow_"+t+"_2");
		}
	else {
		e=document.getElementById("synapsis_diashow_"+t+"_1");
		}
	if (fade==100) {
		var mozo=1;
		}
	else {
		var mozo="0."+fade;
		}
	if (fade<10) {
		mozo="0.0"+fade;
		}
	e.style.filter="Alpha(opacity="+fade+");";
	e.style.opacity=mozo;
	if (fade>0) {
		fade-=10;
		timer[t]=setTimeout("SynapsisDiashowfadepicture("+s_activelayer+","+t+","+fade+","+x+",["+textids+"],'"+rsc+"',"+w+","+h+");", 20);
		}
	else {
		if (s_activelayer==0) {
			document.getElementById("synapsis_diashow_"+t+"_1").style.zIndex=2;
			document.getElementById("synapsis_diashow_"+t+"_2").style.zIndex=1;
			}
		else {
			document.getElementById("synapsis_diashow_"+t+"_2").style.zIndex=2;
			document.getElementById("synapsis_diashow_"+t+"_1").style.zIndex=1;
			}
		document.getElementById("synapsis_diashow_"+t+"_2").style.filter="Alpha(opacity=100);";
		document.getElementById("synapsis_diashow_"+t+"_1").style.filter="Alpha(opacity=100);";
		document.getElementById("synapsis_diashow_"+t+"_2").style.opacity=1;
		document.getElementById("synapsis_diashow_"+t+"_1").style.opacity=1;
		clearTimeout(timer[t]);
		x++;
		if (x>=textids.length) {
			x=0;
			}
		SynapsisDiashowloadPage(s_activelayer,x,t,textids,rsc,w,h);
		}
	}

/**
*	submitVote
*
*	schickt das Umfragenformular ab.
*/
function submitVote() {
	if (schonabgestimmt==true) {
		document.forms['umfrage'].submit();
		}
	else {
		alert ("Bitte wählen Sie zuerst eine Antwort aus.");
		}
	}

/**
*	toggleAlleBilder
*/
function toggleAlleBilder() {
	var pane=document.getElementById("allebilder");
	switch (pane.style.display) {
		case "block":
			pane.style.display="none";
		break;
		default:
			pane.style.display="block";
		break;
		}
	}

/**
*	encode_utf8
*/
function encode_utf8(rohtext) {
	rohtext = rohtext.replace(/\r\n/g,"\n");
	var utftext = "";
	for(var n=0; n<rohtext.length; n++) {
		var c=rohtext.charCodeAt(n);
		if (c<128) {
			utftext += String.fromCharCode(c);
			}
		else if((c>127) && (c<2048)) {
			utftext += String.fromCharCode((c>>6)|192);
			utftext += String.fromCharCode((c&63)|128);
			}
		else {
			utftext += String.fromCharCode((c>>12)|224);
			utftext += String.fromCharCode(((c>>6)&63)|128);
			utftext += String.fromCharCode((c&63)|128);
			}
		}
	return utftext;
	}

/**
*	decode_utf8
*/
function decode_utf8(utftext) {
	var plaintext = ""; var i=0; var c=c1=c2=0;
	while(i<utftext.length) {
		c = utftext.charCodeAt(i);
		if (c<128) {
			plaintext += String.fromCharCode(c);
			i++;
			}
		else if((c>191) && (c<224)) {
			c2 = utftext.charCodeAt(i+1);
			plaintext += String.fromCharCode(((c&31)<<6) | (c2&63));
			i+=2;
			}
		else {
			c2 = utftext.charCodeAt(i+1); c3 = utftext.charCodeAt(i+2);
			plaintext += String.fromCharCode(((c&15)<<12) | ((c2&63)<<6) | (c3&63));
			i+=3;
			}
		}
	return plaintext;
	}
