function protected_email(address, host) {
  document.write("<a href=" + "mail" + "to:" + address + "@" + host + ">" + address + "@" + host + "</a>");
}


function protected_email_db(name1, text) {
  var un = name1;
  var hn = "db.fmi.uni-passau.de";
  var lt = text;
  if (lt == "@")
    lt = name1 + lt + hn;

  document.write("<a href=" + "mail" + "to:" + un + "@" + hn + ">" + lt + "</a>");
}

function AnfrageFormularValidator(theForm)
{
  if( theForm.Telefon.value =="" && theForm.email.value =="")
  {
    alert("Geben Sie bitte eine Telefonnummer oder eine E-Mail Adresse an,\n unter der wir Sie erreichen können.");
    return false;
  }
  return true;
}


function AnfrageFormularValidatorAlt(theForm)
{

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ \t\r\n\f";
  var checkStr = theForm.Name.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Geben Sie nur Buchstaben und Leerräume in das Feld \"Name\" ein.");
    theForm.Name.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ \t\r\n\f";
  var checkStr = theForm.Vorname.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Geben Sie nur Buchstaben und Leerräume in das Feld \"Vorname\" ein.");
    theForm.Vorname.focus();
    return (false);
  }

  

  if (theForm.Name.value =="")
  {
    alert("Geben Sie bitte einen Namen ein");
    theForm.Name.focus();
    return (false);
  }
  
  if (theForm.Vorname.value =="")
  {
    alert("Geben Sie bitte Ihren Vornamen an");
    theForm.Vorname.focus();
    return (false);
  }
  
  
  
  if (theForm.Strasse.value =="")
  {
    alert("Geben Sie bitte einen Wert in das Feld Strasse ein");
    theForm.Strasse.focus();
    return (false);
  }
  if (theForm.PLZ.value == "")
  {
    alert("Geben Sie einen Wert in das Feld \"PLZ\" ein.");
    theForm.PLZ.focus();
    return (false);
  }
  if (theForm.PLZ.value.length < 4)
  {
    alert("Geben Sie mindestens 4 Zeichen in das Feld \"PLZ\" ein.");
    theForm.PLZ.focus();
    return (false);
  }

  if (theForm.PLZ.value.length > 6)
  {
    alert("Geben Sie höchstens 6 Zeichen in das Feld \"PLZ\" ein.");
    theForm.PLZ.focus();
    return (false);
  }
  if (theForm.Ort.value =="")
  {
    alert("Geben Sie bitte einen Ort an");
    theForm.Ort.focus();
    return (false);
  }
  var checkOK = "0123456789-";
  var checkStr = theForm.PLZ.value;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
    allNum += ch;
  }
  if (!allValid)
  {
    alert("Geben Sie nur Ziffern in das Feld \"PLZ\" ein.");
    theForm.PLZ.focus();
    return (false);
  }

  var chkVal = allNum;
  var prsVal = parseInt(allNum);
  if (chkVal != "" && !(prsVal >= "0" && prsVal <= "999999"))
  {
    alert("Geben Sie einen Wert größer oder gleich \"0\" und kleiner oder gleich \"999999\" in das Feld \"PLZ\" ein.");
    theForm.PLZ.focus();
    return (false);
  }
  return (true);
}

