function Fenster (Dateiname,Hoehe)
{
 win = window.open(Dateiname, "Zweitfenster", 'width=600, height='+Hoehe+', top=50, resizable=1, scrollbars=auto');
 win.focus();
}

function chkformular()
{
/*
iFirma       = "Bitte einen Firmennamen eingeben!";
iStrasse     = "Bitte eine Straße eingeben!";
iPLZ         = "Bitte eine Postleitzahl eingeben!";
iOrt         = "Bitte einen Ort eingeben!";
iRegion      = "Bitte ein Land auswählen";
iTelefon     = "Bitte eine Telefonnummer eingeben!";
iMail        = "E-Mail addresse fehlt oder fehlerhaft!";
iMitarbeiter = "Bitte Zahl der Mitarbeiter angeben";
iBusinessTyp = "Bitte den Unternehmenstyp angeben";
iAnrede      = "Bitte Anrede Herr/Frau angeben";
iVorname     = "Bitte einen Vornamen angeben!";
iNachname    = "Bitte einen Nachnamen angeben!";
iFunktion    = "Bitte Ihre Position/Funktion angeben!";
iSprache     = "Welche Sprachen sprechen Sie?";
iBranche     = "Bitte eine Branche auswählen";
iPasswort    = "Bitte ein Passwort angeben (min. 4 Zeichen)!";
iKooperation = "Für welche Arten von Kooperation interessieren Sie sich?";
iProfilTitel = "Titel - Über was wollen Sie mit wem reden fehlt.";
*/

iFirma       = "University name missing!";
iAddress     = "Address missing!";
iRegion      = "Region/Country missing";
iTelefon     = "Phone missing!";
iMail        = "E-Mail address missing or wrong!";
iAnrede      = "Gender (Male/Female) missing";
iVorname     = "First Name missing!";
iNachname    = "Last Name missing!";
iAge         = "Age missing!";
iSprache     = "Which language do you speak?";
iPasswort    = "Passwort missing or to short (min. 4 characters)!";
iText1       = "Scientific background missing";
iText2       = "Engineering background missing";
iText3       = "Special field of interest missing";
iSpam  	     = "Security code for spam protection missing";
iSupport     = "Organisation offering financial support is missing";


if(document.Formular.organisation.value == "")
 { alert(iFirma);
   document.Formular.organisation.focus();
   return false; }

if(document.Formular.address2.value == "")
 { alert(iAddress);
   document.Formular.address2.focus();
   return false; }

if (document.Formular.region.selectedIndex < 1)
{ alert(iRegion);
  document.Formular.region.focus();
  return false; }

if(document.Formular.telefon2.value == "")
 { alert(iTelefon);
   document.Formular.telefon2.focus();
   return false; }

if(chk_mail(document.Formular.email2.value) == false)
 { alert(iMail);
   document.Formular.email2.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.age.value == "")
 { alert(iAge);
   document.Formular.age.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.address.value == "")
 { alert(iAddress);
   document.Formular.address.focus();
   return false; }

if(document.Formular.telefon.value == "")
 { alert(iTelefon);
   document.Formular.telefon.focus();
   return false; }

if(chk_mail(document.Formular.email.value) == false)
 { alert(iMail);
   document.Formular.email.focus();
   return false; }


if(document.Formular.text1.value == "")
 { alert(iText1);
   document.Formular.text1.focus();
   return false; }

if(document.Formular.text2.value == "")
 { alert(iText2);
   document.Formular.text2.focus();
   return false; }

if(document.Formular.text3.value == "")
 { alert(iText3);
   document.Formular.text3.focus();
   return false; }

if(document.Formular.word.value == "")
 { alert(iSpam);
   document.Formular.word.focus();
   return false; }


var support_ok = false;
for (var i=0; i<document.Formular.support.length; i++)
   if (document.Formular.support[i].checked) support_ok = true;
if (!support_ok) { alert(iSupport);
                  document.Formular.support[0].focus();
                  return false; }


if(document.Formular.passkunde.value.length < 4)
 { alert(iPasswort);
   document.Formular.passkunde.focus();
   return false; }

} // ###############  Ende Check Formular  #############################
  // ###################################################################


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);
}

function chk_talk_anzahl(maxtalks)
{
var chks = document.ListTalkFormular.elements['selected_host_talks[]'];
var count = 0;
for (var i=0;i<chks.length;i++)
 if (chks[i].checked) count +=1;
   //alert(chks[i].value);
if (count > maxtalks)
{ alert("You can book a maximum of " + maxtalks + " talks, only.");
  return false;
}
return true;
}
