function Fenster (Dateiname,Hoehe)
{
 win = window.open(Dateiname, "Zweitfenster", 'width=500, height='+Hoehe+', top=50, resizable=1, scrollbars=auto');
 win.focus();
}

function checkAllMail()
{ count = document.MailFormular.elements.length;
  for (i=0; i < count; i++)
  document.MailFormular.elements[i].checked = 1;
}

function uncheckAllMail()
{ count = document.MailFormular.elements.length;
  for (i=0; i < count; i++)
  document.MailFormular.elements[i].checked = 0;
}

function chkCreateAccount()
{
 iMail        = "E-Mail address missing or wrong!";
 iPasswort1   = "Passwort missing or to short (min. 4 characters)!";
 iPasswort2   = "Reconfirmation passwort missing or to short (min. 4 characters)!";
 iPasswort12  = "Passwort 1 and 2 does not match";
 iAntispam    = "Antispam Code missing or wrong";

if(chk_mail(document.Formular.usermail.value) == false)
 { alert(iMail);
   document.Formular.usermail.focus();
   return false; }

if(document.Formular.passkunde.value.length < 4)
 { alert(iPasswort1);
   document.Formular.passkunde.focus();
   return false; }

if(document.Formular.passkunde2.value.length < 4)
 { alert(iPasswort2);
   document.Formular.passkunde2.focus();
   return false; }

if(document.Formular.passkunde.value != document.Formular.passkunde2.value)
 { alert(iPasswort12);
   document.Formular.passkunde2.focus();
   return false; }

if(document.Formular.antispam && document.Formular.antispam.value != document.Formular.antispam2.value)
 { alert(iAntispam);
   document.Formular.antispam.focus();
   return false; }

}


function chkformular1()
{
 iCompetence    = "Core competence is missing";
 iOrginfoTitel  = "Central aim of your organization is missing";
 iOrginfo       = "Describe your organisation is missing";
 iBranche       = "ICT sector fields missing!";

 if(document.Formular1.competence) {
   var competence_ok = false;
   for (var i=0; i<document.Formular1.competence.length; i++)
     if (document.Formular1.competence[i].checked) competence_ok = true;
   if (!competence_ok) {
     alert(iCompetence);
     document.Formular1.competence[0].focus();
     return false;
   }
 }

 if(document.Formular1.orginfo_titel.value == "")
  { alert(iOrginfoTitel);
    document.Formular1.orginfo_titel.focus();
    return false; }

 if(document.Formular1.orginfo.value == "")
  { alert(iOrginfo);
    document.Formular1.orginfo.focus();
    return false; }

 if(document.Formular1.competence[0].checked) {
   var chks = document.Formular1.elements['branche[]'];
   var count = 0;
   for (var i=0;i<chks.length;i++)
      if (chks[i].checked) count +=1;
   if(count == 0) { alert(iBranche);
      chks[0].focus();
      return false;
   }
 }

}


function chkformular()
{
iFirma       = "Organisation name missing!";
iStrasse     = "Street missing!";
iPLZ         = "Postal Code missing!";
iOrt         = "City missing!";
iRegion      = "Region/Country missing";
iTelefon     = "Phone missing!";
iMail        = "E-Mail address missing or wrong!";
iGJahr       = "Year of foundation missing";
iMitarbeiter = "Number of employees missing";
iBusinessTyp = "Organisation Type missing";
iAnrede      = "Gender (Mr/Ms) missing";
iVorname     = "First Name missing!";
iNachname    = "Last Name missing!";
iSprache     = "Which language do you speak?";
iPasswort1   = "Passwort missing or to short (min. 4 characters)!";
iPasswort2   = "Reconfirmation passwort missing or to short (min. 4 characters)!";
iPasswort12  = "Passwort 1 and 2 does not match";
iAntispam    = "Antispam Code missing or wrong";

if(document.Formular.firma.value == "")
 { alert(iFirma);
   document.Formular.firma.focus();
   return false; }

if(document.Formular.strasse.value == "")
 { alert(iStrasse);
   document.Formular.strasse.focus();
   return false; }

if(document.Formular.plz.value == "")
 { alert(iPLZ);
   document.Formular.plz.focus();
   return false; }

if(document.Formular.ort.value == "")
 { alert(iOrt);
   document.Formular.ort.focus();
   return false; }

/* Unterschiedliche Abfrage bei select / radio */

if (document.Formular.region.selectedIndex < 2)
{ alert(iRegion);
  document.Formular.region.focus();
  return false; }


if(document.Formular.telefon.value == "")
 { alert(iTelefon);
   document.Formular.telefon.focus();
   return false; }

if(chk_mail(document.Formular.kundenmail.value) == false)
 { alert(iMail);
   document.Formular.kundenmail.focus();
   return false; }


if(document.Formular.gjahr)
{
 if(document.Formular.gjahr.value == "")
  { alert(iGJahr);
    document.Formular.gjahr.focus();
    return false; }
}

if(document.Formular.business)
{
if (document.Formular.business.selectedIndex < 2)
{ alert(iBusinessTyp);
  document.Formular.business.focus();
  return false; }

}

if(document.Formular.anzahl)
{
 var anzahl_ok = false;
 for (var i=0; i<document.Formular.anzahl.length; i++)
    if (document.Formular.anzahl[i].checked) anzahl_ok = true;
 if (!anzahl_ok) { alert(iMitarbeiter);
                   document.Formular.anzahl[0].focus();
                   return false; }
}

if(document.Formular.anrede[0].checked == false &&
   document.Formular.anrede[1].checked == false )
 { alert(iAnrede);
   document.Formular.anrede[0].focus();
   return false; }

if(document.Formular.vorname.value == "")
 { alert(iVorname);
   document.Formular.vorname.focus();
   return false; }

if(document.Formular.nachname.value == "")
 { alert(iNachname);
   document.Formular.nachname.focus();
   return false; }

if(document.Formular.passkunde.value.length < 4)
 { alert(iPasswort1);
   document.Formular.passkunde.focus();
   return false; }

} // ###############  Ende Check Formular  #############################


function checkrequest()
{
 if(document.RequestFormular.AbsenderName.value.length < 3)
  { alert("Name missing");
    document.RequestFormular.AbsenderName.focus();
    return false; }

 if(document.RequestFormular.AbsenderFirma.value.length < 3)
  { alert("Organisation missing");
    document.RequestFormular.AbsenderFirma.focus();
    return false; }

 if(document.RequestFormular.AbsenderEmail.value.length < 3)
  { alert("Email missing");
    document.RequestFormular.AbsenderEmail.focus();
    return false; }

 if(document.RequestFormular.AbsenderPhone.value.length < 3)
  { alert("Phone missing");
    document.RequestFormular.AbsenderPhone.focus();
    return false; }

 if(document.RequestFormular.AbsenderQuestion.value.length < 3)
  { alert("Question missing");
    document.RequestFormular.AbsenderQuestion.focus();
    return false; }

 if(document.RequestFormular.antispam && document.RequestFormular.antispam.value != document.RequestFormular.antispam2.value)
  { alert("Antispam Code missing or wrong");
    document.RequestFormular.antispam.focus();
    return false; }
}



function isInt(wert) {
  if (wert == "") return false;
  for (i=0; i<4;i++) {
    if (wert.charAt(i) < "0") { return false; }
    if (wert.charAt(i) > "9") { return false; }
  }
}

function chk_mail(s)
{
 var a = false;
 var res = false;
 if(typeof(RegExp) == 'function')
 {
  var b = new RegExp('abc');
  if(b.test('abc') == true){a = true;}
  }

 if(a == true)
 {
  reg = new RegExp('^([a-zA-Z0-9\\-\\.\\_]+)'+
                   '(\\@)([a-zA-Z0-9\\-\\.]+)'+
                   '(\\.)([a-zA-Z]{2,4})$');
  res = (reg.test(s));
 }
 else
 {
  res = (s.search('@') >= 1 &&
         s.lastIndexOf('.') > s.search('@') &&
         s.lastIndexOf('.') >= s.length-5)
 }
 return(res);
}