function Fenster (Dateiname,Hoehe)
{
 win = window.open(Dateiname, "Zweitfenster", 'width=600, height='+Hoehe+', top=50, resizable=1, scrollbars=auto');
 win.focus();
}


function chkProjectformular()
{
 return true;
}


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!";
iGJahr       = "Bitte Gründungsjahr angeben";
iZahlenOnly  = "Bitte nur Ziffern eingeben";
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.";
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";
*/

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";
iZahlenOnly  = "Please, enter digits only";
iMitarbeiter = "Number of employees missing";
iMitarbeiterRTD = "Number of employees working in RTD missing";
iExport      = "Export activities missing";
iBusinessTyp = "Organisation Type missing";
iAnrede      = "Gender (Mr/Ms) missing";
iVorname     = "First Name missing!";
iNachname    = "Last Name missing!";
iFunktion    = "Position / Function missing!";
iSprache     = "Which language do you speak?";
iPrimeClass  = "Primary classification missing!";
iBranche     = "Thematic areas (branches) missing!";
iActivities  = "Core competences missing!";
iPasswort    = "Passwort missing or to short (min. 4 characters)!";
iProfilTitel = "Your company in 2 sentences";
iProfilTitelDE = "Your company in 2 sentences (in German)";
iText1       = "Short description about Research & Development activities missing";
iText2       = "Short description about product, technology, service, know-how missing";
iText3       = "Short description about international activities missing";
iText4       = "Short description about company/organisation missing";


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 < 1)
{ alert(iRegion);
  document.Formular.region.focus();
  return false; }

var chks = document.Formular.elements['business[]'];
var count = 0;
for (var i=0;i<chks.length;i++)
 if (chks[i].checked) count +=1;
if (count == 0) { alert(iBusinessTyp);
                  chks[0].focus();
                  return false;
                }

if(document.Formular.anzahl.value == "")
 { alert(iMitarbeiter);
   document.Formular.anzahl.focus();
   return false; }

/*
if(document.Formular.fax.value == "")
 { alert("Bitte eine Faxnunmer eingeben!");
   document.Formular.fax.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.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; }

var chks = document.Formular.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;
                }

if(document.Formular.profiltitel.value == "")
 { alert(iProfilTitel);
   document.Formular.profiltitel.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.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;
}



// Funktionen für das Layoutieren
// <a style="font-weight:normal;" href="javascript:insert('<li>','</li>');" titel="Einzelner Textblock einrücken">Liste A</a>&nbsp; |&nbsp;

function storeFocus(obj) {
  stored = obj.name;
}

function insert(aTag, eTag) {
  var input = document.forms['Formular'].elements[stored];
  input.focus();
  /* für Internet Explorer */
  if(typeof document.selection != 'undefined') {
    /* Einfügen des Formatierungscodes */
    var range = document.selection.createRange();
    var insText = range.text;
    range.text = aTag + insText + eTag;
    /* Anpassen der Cursorposition */
    range = document.selection.createRange();
    if (insText.length == 0) {
      range.move('character', -eTag.length);
    } else {
      range.moveStart('character', aTag.length + insText.length + eTag.length);
    }
    range.select();
  }
  /* für neuere auf Gecko basierende Browser */
  else if(typeof input.selectionStart != 'undefined')
  {
    /* Einfügen des Formatierungscodes */
    var start = input.selectionStart;
    var end = input.selectionEnd;
    var insText = input.value.substring(start, end);
    input.value = input.value.substr(0, start) + aTag + insText + eTag + input.value.substr(end);
    /* Anpassen der Cursorposition */
    var pos;
    if (insText.length == 0) {
      pos = start + aTag.length;
    } else {
      pos = start + aTag.length + insText.length + eTag.length;
    }
    input.selectionStart = pos;
    input.selectionEnd = pos;
  }
  /* für die übrigen Browser */
  else
  {
    /* Abfrage der Einfügeposition */
    var pos;
    var re = new RegExp('^[0-9]{0,3}$');
    while(!re.test(pos)) {
      pos = prompt("Einfügen an Position (0.." + input.value.length + "):", "0");
    }
    if(pos > input.value.length) {
      pos = input.value.length;
    }
    /* Einfügen des Formatierungscodes */
    var insText = prompt("Bitte geben Sie den zu formatierenden Text ein:");
    input.value = input.value.substr(0, pos) + aTag + insText + eTag + input.value.substr(pos);
  }
}
