function IsEmpty(field,text)
{
  if (field.value.length == 0) { if (text.length > 0) { alert(text);} field.focus(); return (true);}
  return (false);
}
var set_numeric = new String("0123456789");
var set_ABC = new String("ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÜß");
var set_abc = new String("abcdefghijklmnopqrstuvwxyzäöüß");
var set_Abc = set_ABC+set_abc;
function VerifySet(field,set_include,set_necessary,text)
{
  _value = field.value;
  _result = true;
  _verify_index = 0;
  while ((_verify_index < _value.length) && (_result))
  {
    _symbol = _value.substr(_verify_index,1);
    if (set_include.length > 0) _result = (!(set_include.indexOf(_symbol) < 0));
    _verify_index++;
  }
  _verify_index = 0;
  while ((_verify_index < set_necessary.length) && (_result))
  {
    _symbol = set_necessary.substr(_verify_index,1);
    if (_value.length > 0) _result = (!(_value.indexOf(_symbol) < 0));
    _verify_index++;
  }
  if (!_result) { if (text.length > 0) { alert(text);} field.focus();}
  return (_result);
}
function IsNumeric(field,kein_text,falsch_text)
{
  if (IsEmpty(field,kein_text)) return (false);
  return (VerifySet(field,set_numeric,"",falsch_text));
}
function CheckDate(day,month,year)
{
  if (!IsNumeric(day,"keine Datei","falsche Datei")) return (false);
  if (!IsNumeric(month,"keine Datei","falsche Datei")) return (false);
  if (!IsNumeric(year,"keine Datei","falsche Datei")) return (false);
  if (day.value.length < 2) day.value = "0"+day.value;
  if (month.value.length < 2) month.value = "0"+month.value;
  if (year.value.length < 4) { if (year.value < 50) { year.value = Number(year.value) + 2000;} else { year.value = Number(year.value) + 1900;}}
  if (year.value < 1900) { year.focus(); alert("falsche Datum"); return (false);}
  date = new Date(year.value,(month.value-1),day.value);
  if (year.value != date.getFullYear()) { month.focus(); alert("falsche Datum"); return (false);}
  if (month.value != (date.getMonth()+1)) { day.focus(); alert("falsche Datum"); return (false);}
  if (day.value != date.getDate()) { day.focus(); alert("falsche Datum"); return (false);}
  return (date);
}
