


// ############################################################################
// ### formHasElement:
// ############################################################################
function formHasElement(f, e) {
  rtn = false;
  for (i=0; i<f.elements.length; i++)
    rtn |= (f.elements[i].name==e);
  return rtn;
}

// ############################################################################
// ### floatInputChange:
// ############################################################################
function floatInputChange(inp) {
  var ok = !isNaN(inp.value);
  if (!ok) {
    alert(">"  + inp.value + "< ist keine Fliesskomma-Zahl!");
    inp.value = s;
    inp.focus();
    return false;
  }
  return true;
}

// ############################################################################
// ### intInputChange:
// ############################################################################
function intInputChange(inp) {
  var ok = true;
  var s = "";
  for (i=0; i<inp.value.length; i++) {
      ch = inp.value.charAt(i);
      ch_ok =
         (ch == '0' || ch == '1' || ch == '2' || ch == '3' || ch == '4' ||
      	  ch == '5' || ch == '6' || ch == '7' || ch == '8' || ch == '9');
      ok = ok && ch_ok;
      if (ch_ok)
        s += ch;
  }
  if (!ok) {
    alert(">"  + inp.value + "< ist keine ganze Zahl!");
    inp.value = s;
    inp.focus();
    return false;
  }
  return true;
}

// ############################################################################
// ### teleInputChange:
// ############################################################################
function teleInputChange(inp) {
  var ok = true;
  var s = "";
  for (i=0; i<inp.value.length; i++) {
      ch = inp.value.charAt(i);
      ch_ok =
         (ch == '0' || ch == '1' || ch == '2' || ch == '3' || ch == '4' ||
      	  ch == '5' || ch == '6' || ch == '7' || ch == '8' || ch == '9' ||
      	  ch == '(' || ch == ')' || ch == '/' || ch == '-' || ch == '+' ||
          ch == ' ');
      ok = ok && ch_ok;
      if (ch_ok)
        s += ch;
  }
  if (!ok) {
    alert(">"  + inp.value + "< ist keine gültige Telefonnummer (zugelassene Zeichen sind 0...9 + - ( ) /)!");
    inp.value = s;
    inp.focus();
    return false;
  }
  return true;
}
