<!--

if (!suchfenster) {
	var suchfenster;
}

var changed=false; // Flag, ob die Suchbegriffe veraendert wurden

function suchen() {
	if (!suchfenster || suchfenster.closed || changed) {
		suchfenster = window.open("./pop_suche_fs.php?suchbegriffe="+escape(document.suche.suchfeld.value),"suchen","width=616,height=500");
		if (navigator.appName == "Microsoft Internet Explorer") {
			suchfenster.moveTo((screen.width-616)/2,100);
		}
		if (!suchfenster.opener) {
			suchfenster.opener=window;
		}
	}
	else if (suchfenster.focus) {
		suchfenster.focus();
	}
}
  
function required (formname) {
    var feldname=new RegExp("^"+formname+"_*","gi");
    var ok=true;
    for (i=0;i<document.formular.length;i++)
    {
        if (document.formular[i].name.match(feldname)==(formname+"_"))
        {
            if (document.formular[i].name.match(/_required$/gi)) // Feld required
            {
                if (document.formular[i].type=="checkbox")
                {
                    if (document.formular[i].checked==false)
                    {
                        ok=false;
                    }
                }
                else if (document.formular[i].type=="radio")
                {
                    var radioname = document.formular[i].name;
                    var radiook = false;
                    var radiolength=eval("document.formular."+radioname+".length");
                    for (i2=0;i2<radiolength;i2++)
                    {
                        radiook = radiook || (eval("document.formular."+radioname+"["+i2+"].checked"));
                    }
                    if (radiook==false)
                    {
                        ok=false;
                    }
                }
                else if (document.formular[i].type.match(/^select/gi))
                {
                    if ((document.formular[i].value=="undefined") || (document.formular[i].value==""))
                    {
                        ok=false;
                    }
                }
				else if (document.formular[i].name.match(/mail/gi) == "mail") {
					 var mail = document.formular[i].value;
					 if (mail.search(/^[_a-z0-9A-Z+-]+(\.[_a-z0-9A-Z+-]+)*@[a-z0-9A-Z-]+(\.[a-z0-9A-Z-]+)$/) == -1)
						ok = false;
				}
                else
                {
                    if (document.formular[i].value=="")
                    {
                        ok=false;
                    }
                }
            }
        }
    }
    if (ok==false)
    {
        alert ("Sie haben leider nicht alle zur Bearbeitung notwendigen Angaben gemacht,\nbitte versuchen Sie es noch einmal.");
    }
    return ok;
}

function formular_auswerten(name) {
    var split=name.split("|");
    for (var i=split.length;i<4;i++)
    {
        split.push("");
    }
    var formname=split[0];

    if (required(formname))
    {
        var empfaenger=split[1];
        var subject=split[2];
        var absender=split[3];

        var feldname=new RegExp("^"+formname+"_*","gi");

        var name;
        var str="formularname="+escape(formname)+"&";
        str += "&empfaenger="+empfaenger;
        str += "&subject="+subject;
        str += "&absender="+absender;
        str += "&";
        for (i=0;i<document.formular.length;i++)
        {
            if (document.formular[i].name.match(feldname)==(formname+"_"))
            {

                name=document.formular[i].name.replace(feldname,"");
                name=name.replace(/_required$/gi,"");
                if ((document.formular[i].type=="radio") || (document.formular[i].type=="checkbox"))
                {
                    if (document.formular[i].checked==true)
                    {
                        str+= name+"="+escape(document.formular[i].value)+"&";
                    }
                }
                else if (document.formular[i].type.match(/^select/gi))
                {
                    var selectname = document.formular[i].name;
                    str+= name+"="+escape(eval("document.formular."+selectname+"[document.formular."+selectname+".selectedIndex].value"))+"&";
                }
                else
                {
                    str+= name+"="+escape(document.formular[i].value)+"&";
                }
            }
        }
        popup_nocontrol ("./formularauswertung.php?"+str,"mail",400,200);
    }
}

function popup_kontakt() {
  window.open('kontakt.php','kontakt','width=794,height=515');
}

function popup_popup(url,windowname,xsize,ysize) {
    var popupwinres;
    if (popupwinres != null)
    {
        if (popupwinres.closed != true)
        {
            popupwinres.window.close();
        }
    }
    popupwinres = window.open(url,windowname,'scrollbars=yes,resizable,width='+xsize+',height='+ysize+'');
    popupwinres.moveTo((screen.width-xsize)/2,100);
}
//-->
