function Fenster (Dateiname,Hoehe)
{
 win = window.open(Dateiname, "Zweitfenster", 'width=700, height='+Hoehe+', top=50, resizable=1, scrollbars=auto');
 win.focus();
}

function FensterLeer (Text,Hoehe)
{
 win = window.open('', "Zweitfenster", 'width=700, height='+Hoehe+', top=50, resizable=1, scrollbars=auto');
 win.document.write(Text);
 win.document.close();
 win.focus();
}

function checkAll(field)
{ for (i = 0; i < field.length; i++)
  field[i].checked = true ;
}
function uncheckAll(field)
{ for (i = 0; i < field.length; i++)
  field[i].checked = false ;
}

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 chkconfirm()
{
if(document.Formular.takepart[0].checked == false &&
   document.Formular.takepart[1].checked == false)
 { alert("Reconfirmation of your participation is missing");
   document.Formular.takepart[0].focus();
   return false; }
}

function chkformular()
{
/*
iOrganisation       = "Bitte einen Firmennamen eingeben!";
iStreet     = "Bitte eine Straße eingeben!";
iZIP         = "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!";
iFoundet       = "Bitte Gründungsjahr angeben";
iEmployees = "Bitte Zahl der Mitarbeiter angeben";
iBusinessTyp = "Bitte den Unternehmenstyp angeben";
iGender      = "Bitte Anrede Herr/Frau angeben";
iFirstname     = "Bitte einen Vornamen angeben!";
iLastname    = "Bitte einen Nachnamen angeben!";
iFunktion    = "Bitte Ihre Position/Funktion angeben!";
iLanguage     = "Welche Sprachen sprechen Sie?";
iBranche     = "Bitte eine Branche auswählen";
iPasswort    = "Bitte ein Passwort angeben (min. 4 Zeichen)!";
iAntispam    = "Bitte gültigen Antispam Code eingeben";
iKooperation = "Für welche Arten von Kooperation interessieren Sie sich?";
iProfilTyp   = "Bitte den Profiltyp auswählen";
iProfilTitel = "Titel - Über was wollen Sie mit wem reden fehlt.";
iText1       = "Angaben zum Produkt, Service, Know-how fehlen";
iText2       = "Angaben zu Kooperationswunsch fehlen.";
iText3       = "Kurze Firmenbeschreibung fehlt";
iFrage1      = "Frage1";
iFrage2      = "Frage2";
iFrage3      = "Frage3";
iFrage4      = "Frage4";
iFrage5      = "Frage5";
*/

iOrganisation= "Organisation name missing!";
iStreet      = "Street missing!";
iZIP         = "Postal Code missing!";
iOrt         = "City missing!";
iRegion      = "Region/Country missing";
iTelefon     = "Phone missing!";
iMail        = "E-Mail address missing or wrong!";
iFoundet     = "Year of foundation missing";
iEmployees   = "Number of employees missing";
iBusinessTyp = "Organisation Type missing";
iGender      = "Gender (Mr/Ms) missing";
iFirstname   = "First Name missing!";
iLastname    = "Last Name missing!";
iFunktion    = "Position / Function missing!";
iLanguage    = "Which languages do you speak?";
iBranche     = "Areas of activities missing!";
ilectures    = "Type of participation (Exhibitor, Attendee) missing";
iPasswort    = "Passwort missing or to short (min. 4 characters)!";
iAntispam    = "Please insert valid (4 digits) Antispam Code";
iKooperation = "What kind of co-opeartion you are interested in?";
iProfilTyp   = "Type of profile not specified";
iProfilTitel = "Title - About what and with whom you would like to talk about";
iText1       = "Short description about product, technology, service, know-how missing";
iText2       = "Type and qualification of co-operation partner missing";
iText3       = "Short description of company/organisation missing";
iFrage1      = "Frage 1";
iFrage2      = "Frage 2";
iFrage3      = "Frage 3";
iFrage4      = "Frage 4";
iFrage5      = "Frage 5";

if(document.Formular.organisation.value == "")
 { alert(iOrganisation);
   document.Formular.organisation.focus();
   return false; }

if(document.Formular.street.value == "")
 { alert(iStreet);
   document.Formular.street.focus();
   return false; }

if(document.Formular.zip.value == "")
 { alert(iZIP);
   document.Formular.zip.focus();
   return false; }


if(document.Formular.city.value == "")
 { alert(iOrt);
   document.Formular.city.focus();
   return false; }


if (document.Formular.region.selectedIndex == 0)
  { 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.client_email.value) == false)
 { alert(iMail);
   document.Formular.client_email.focus();
   return false; }


if(document.Formular.founded)
{
 if(document.Formular.founded.value == "")
  { alert(iFoundet);
    document.Formular.founded.focus();
    return false; }
}

if(document.Formular.employees)
{
 var SelectionOK = false;
 for (var i=0; i<document.Formular.employees.length; i++)
    if (document.Formular.employees[i].checked) SelectionOK = true;
 if (!SelectionOK) { alert(iEmployees);
                   document.Formular.employees[0].focus();
                   return false; }
}

 var orgtype_ok = false;
 for (var i=0; i<document.Formular.orgtype.length; i++)
    if (document.Formular.orgtype[i].checked) orgtype_ok = true;
 if (!orgtype_ok) { alert(iBusinessTyp);
                   document.Formular.orgtype[0].focus();
                   return false; }


if(document.Formular.gender[0].checked == false &&
   document.Formular.gender[1].checked == false )
 { alert(iGender);
   document.Formular.gender[0].focus();
   return false; }

if(document.Formular.firstname.value == "")
 { alert(iFirstname);
   document.Formular.firstname.focus();
   return false; }

if(document.Formular.lastname.value == "")
 { alert(iLastname);
   document.Formular.lastname.focus();
   return false; }

if(document.Formular.position.value == "")
 { alert(iFunktion);
   document.Formular.position.focus();
   return false; }


/*
var chks = document.Formular.elements['language[]'];
if(chks)
{
 var count = 0;
 for (var i=0;i<chks.length;i++)
  if (chks[i].checked) count +=1;
 if (count == 0) { alert(iLanguage);
                   chks[0].focus();
                   return false;
                 }
}
*/


var SelectionPackageValue = 0;
if(document.Formular.radio3) {
 for (var i=0; i<document.Formular.radio3.length; i++)
   if (document.Formular.radio3[i].checked) SelectionPackageValue = document.Formular.radio3[i].value;
}

if(SelectionPackageValue == 0) {
 var chks = document.Formular.elements['lectures[]'];
 if(chks)
 {
  var count = 0;
  for (var i=0;i<chks.length;i++)
   if (chks[i].checked) count +=1;
  if (count == 0) { alert(ilectures);
                    chks[0].focus();
                    return false;
                  }
 }
}

var b2b = document.Formular.elements['b2bsessions[]'];
var B2Bcount = 0;

 if(typeof (b2b.length) == 'undefined') {
    if (b2b.checked) B2Bcount +=1;
 }
 else {
   for (var i=0;i<b2b.length;i++)
      if (b2b[i].checked) B2Bcount +=1;
 }

if(B2Bcount > 0 || typeof(b2b) == 'undefined')
{
 var chks = document.Formular.elements['business_field[]'];
 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;
                 }


if(typeof(document.Formular.CoopTypeO) != 'undefined') {
 var Cooperation=false;
  if(document.Formular.CoopTypeO0 && document.Formular.CoopTypeO0.checked==true) Cooperation=true;
  if(document.Formular.CoopTypeR0 && document.Formular.CoopTypeR0.checked==true) Cooperation=true;
  if(document.Formular.CoopTypeO1 && document.Formular.CoopTypeO1.checked==true) Cooperation=true;
  if(document.Formular.CoopTypeR1 && document.Formular.CoopTypeR1.checked==true) Cooperation=true;
  if(document.Formular.CoopTypeO2 && document.Formular.CoopTypeO2.checked==true) Cooperation=true;
  if(document.Formular.CoopTypeR2 && document.Formular.CoopTypeR2.checked==true) Cooperation=true;
  if(document.Formular.CoopTypeO3 && document.Formular.CoopTypeO3.checked==true) Cooperation=true;
  if(document.Formular.CoopTypeR3 && document.Formular.CoopTypeR3.checked==true) Cooperation=true;
  if(document.Formular.CoopTypeO4 && document.Formular.CoopTypeO4.checked==true) Cooperation=true;
  if(document.Formular.CoopTypeR4 && document.Formular.CoopTypeR4.checked==true) Cooperation=true;
  if(document.Formular.CoopTypeO5 && document.Formular.CoopTypeO5.checked==true) Cooperation=true;
  if(document.Formular.CoopTypeR5 && document.Formular.CoopTypeR5.checked==true) Cooperation=true;
  if(document.Formular.CoopTypeO6 && document.Formular.CoopTypeO6.checked==true) Cooperation=true;
  if(document.Formular.CoopTypeR6 && document.Formular.CoopTypeR6.checked==true) Cooperation=true;
  if(document.Formular.CoopTypeO7 && document.Formular.CoopTypeO7.checked==true) Cooperation=true;
  if(document.Formular.CoopTypeR7 && document.Formular.CoopTypeR7.checked==true) Cooperation=true;
  if(document.Formular.CoopTypeO8 && document.Formular.CoopTypeO8.checked==true) Cooperation=true;
  if(document.Formular.CoopTypeR8 && document.Formular.CoopTypeR8.checked==true) Cooperation=true;
  if(document.Formular.CoopTypeO9 && document.Formular.CoopTypeO9.checked==true) Cooperation=true;
  if(document.Formular.CoopTypeR9 && document.Formular.CoopTypeR9.checked==true) Cooperation=true;

  if (Cooperation==false)
  { alert(iKooperation);
    document.Formular.CoopTypeO0.focus();
    return false;
  }
}

 if(document.Formular.orgbackground.value == "")
  { alert(iText3);
    document.Formular.orgbackground.focus();
    return false; }

 if (document.Formular.type1) {
   var ProfilTyp_ok = false;
   for (var i=0; i<document.Formular.type1.length; i++)
     if (document.Formular.type1[i].checked) ProfilTyp_ok = true;
   if (!ProfilTyp_ok) { alert(iProfilTyp);
                        document.Formular.type1[0].focus();
                        return false; }
 }

 if(document.Formular.titel1.value == "")
   { alert(iProfilTitel);
     document.Formular.titel1.focus();
     return false; }

 if(document.Formular.text1.value == "")
  { alert(iText1);
    document.Formular.text1.focus();
    return false; }

} //  Ende B2B Meetings

/*
var SelectionOK = false;
if(document.Formular.radio1 && document.Formular.radio1_mandatory) {
 for (var i=0; i<document.Formular.radio1.length; i++)
    if (document.Formular.radio1[i].checked) SelectionOK = true;
 if (!SelectionOK) { alert(iFrage1);
                   document.Formular.radio1[0].focus();
                   return false; }
}

var SelectionOK = false;
if(document.Formular.radio2 && document.Formular.radio2_mandatory) {
 for (var i=0; i<document.Formular.radio2.length; i++)
    if (document.Formular.radio2[i].checked) SelectionOK = true;
 if (!SelectionOK) { alert(iFrage2);
                   document.Formular.radio2[0].focus();
                   return false; }
}

var SelectionOK = false;
if(document.Formular.radio3 && document.Formular.radio3_mandatory) {
 for (var i=0; i<document.Formular.radio3.length; i++)
    if (document.Formular.radio3[i].checked) SelectionOK = true;
 if (!SelectionOK) { alert(iFrage3);
                   document.Formular.radio3[0].focus();
                   return false; }
}

var chks = document.Formular.elements['checkbox1[]'];
if(document.Formular.checkbox1_mandatory == true && chks)
{
 var count = 0;
 for (var i=0;i<chks.length;i++)
    if (chks[i].checked) count +=1;
 if (count == 0) { alert(iFrage4);
                   chks[0].focus();
                   return false;
                 }
}

var chks = document.Formular.elements['checkbox2[]'];
if(document.Formular.checkbox2_mandatory == true && chks)
{
 var count = 0;
 for (var i=0;i<chks.length;i++)
    if (chks[i].checked) count +=1;
 if (count == 0) { alert(iFrage5);
                   chks[0].focus();
                   return false;
                 }
}
*/

if(document.Formular.client_password.value.length < 4)
 { alert(iPasswort);
   document.Formular.client_password.focus();
   return false; }

if(document.Formular.antispam && document.Formular.antispam.value != document.Formular.antispam2.value)
 { alert(iAntispam);
   document.Formular.antispam.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 check_talk_number(maxtalks)
{
 var count1 = 0;
 var count2 = 0;

 var chks1 = document.ListTalkFormular.elements['selected_own_talks[]'];
 for (var i=0;i<chks1.length;i++)
   if (chks1[i].checked) count1 +=1;

 var chks2 = document.ListTalkFormular.elements['selected_guest_talks[]'];
 if(typeof(chks2) != 'undefined') {
  for (var i=0;i<chks2.length;i++)
    if (chks2[i].checked) count2 +=1;
 }

 if ( (count1+count2) > maxtalks)
 { alert("The maximum of " + maxtalks + " meetings has been achieved.");
   return false;
 }
 return true;
}
