function Fenster (Dateiname,Hoehe)
{
 win = window.open(Dateiname, "Zweitfenster", 'width=600, height='+Hoehe+', top=50, resizable=1, scrollbars=auto');
 win.focus();
}


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 (please enter digits only)";
iZahlenOnly  = "Please, enter digits only";
iMitarbeiter = "Number of employees missing (please enter digits only)";
iMitarbeiter2= "Number of employees in RTD must be lower than total number of employees";
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!";
iCollaboration= "Type of collaboration missing!";
iBranche     = "Thematic areas (branches) missing!";
iStage       = "Current stage of development!";
iIPR         = "Intellectual property rights";
iPasswort    = "Passwort missing or to short (min. 4 characters)!";
iProfilTitel = "Your company in 2 sentences";
iText1       = "Short description about Research & Development activities 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; }
if (document.Formular.region.selectedIndex < 1)
{ alert(iRegion);
  document.Formular.region.focus();
  return false; }

if(document.Formular.telefon.value.length < 4)
 { alert(iTelefon);
   document.Formular.telefon.focus();
   return false; }

if(document.Formular.fax.value == "")
 { alert("Bitte eine Faxnunmer eingeben!");
   document.Formular.fax.focus();
   return false; }
*/

if(chk_mail(document.Formular.kundenmail.value) == false)
 { alert(iMail);
   document.Formular.kundenmail.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; }

var chks = document.Formular.elements['business[]'];
var count = 0;
for (var i=0;i<chks.length;i++)
 if (chks[i].checked) count +=1;
   //alert(chks[i].value);
if (count == 0) { alert(iBusinessTyp);
                  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; }

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;
                }

var chks = document.Formular.elements['collaboration[]'];
var count = 0;
for (var i=0;i<chks.length;i++)
   if (chks[i].checked) count +=1;
if (count == 0) { alert(iCollaboration);
                  chks[0].focus();
                  return false;
                }

var chks = document.Formular.elements['devstage[]'];
var count = 0;
for (var i=0;i<chks.length;i++)
   if (chks[i].checked) count +=1;
if (count == 0) { alert(iStage);
                  chks[0].focus();
                  return false;
                }

var chks = document.Formular.elements['ipr[]'];
var count = 0;
for (var i=0;i<chks.length;i++)
   if (chks[i].checked) count +=1;
if (count == 0) { alert(iIPR);
                  chks[0].focus();
                  return false;
                }

*/

if(document.Formular.passkunde.value.length < 1)
 { alert(iPasswort);
   document.Formular.passkunde.focus();
   return false; }

} // ###############  Ende Check Formular  #############################
  // ###################################################################


function isInt(wert) {
  if (wert == "") return false;
  for (i=0; i<wert.length;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);
}

// 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);
  }
}
