// form_check.js
// --------------------------
// Erstellt: 03.08.2008, ob

function CheckMail(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 RadioValue(sObj)
{
  aObj = document.getElementsByName(sObj);
  for (i=0; i < aObj.length; i++)
  {
	  if(aObj[i].checked == true)
    {
		  return aObj[i].value;
		}
	}
}

function SelectValue(sObj)
{
  with (sObj) return options[selectedIndex].value;
}
  
function CheckPhone(sObj)
{
  if ((!isNaN(parseInt(sObj.value.substring(sObj.value.length-1, sObj.value.length)))) ||
      (sObj.value.substring(sObj.value.length-1, sObj.value.length) == '/') ||
      (sObj.value.substring(sObj.value.length-1, sObj.value.length) == '-') ||
      (sObj.value.substring(sObj.value.length-1, sObj.value.length) == '+') ||
      (sObj.value.substring(sObj.value.length-1, sObj.value.length) == '.') ||
      (sObj.value.substring(sObj.value.length-1, sObj.value.length) == '(') ||
      (sObj.value.substring(sObj.value.length-1, sObj.value.length) == ')') ||
      (sObj.value.substring(sObj.value.length-1, sObj.value.length) == ' ')
     )
  {
    return true;
  }  
  else
  {
    while ((isNaN(parseInt(sObj.value.substring(sObj.value.length-1, sObj.value.length)))) &&
          (sObj.value.length > 0))
    {
      sObj.value = sObj.value.substring(0,sObj.value.length-1);
    }

    if (sObj.value != "")
      return true;
    else
      return false;  
  }
}

function CheckPLZ(sObj)
{
  if ((!isNaN(parseInt(sObj.value.substring(sObj.value.length-1, sObj.value.length)))) &&
     (sObj.value.length <= 5))
  {
    return true;
  }  
  else
  {
    while ( ((isNaN(parseInt(sObj.value.substring(sObj.value.length-1, sObj.value.length)))) || (sObj.value.length > 5)) &&
          (sObj.value.length > 0))
    {
      sObj.value = sObj.value.substring(0,sObj.value.length-1);
    }

    if (sObj.value != "")
      return true;
    else
      return false;  
  }
}

function CheckNumber(sObj)
{
  if (!isNaN(parseInt(sObj.value.substring(sObj.value.length-1, sObj.value.length))))
  {
    return true;
  }  
  else
  {
    while ((isNaN(parseInt(sObj.value.substring(sObj.value.length-1, sObj.value.length)))) &&
          (sObj.value.length > 0))
    {
      sObj.value = sObj.value.substring(0,sObj.value.length-1);
    }

    if (sObj.value != "")
      return true;
    else
      return false;  
  }
}

function js_inarray(needle, haystack)
{
  for (i = 0; i < haystack.length; i++)
  {
    if (needle == haystack[i])
      return true;
  }
  return false;
}	

function ta_CorrectDate(tagObj, monatObj, jahrObj)
{
  var tag, monat, jahr;
  monat31 = new Array("1", "3", "5", "7", "8", "10", "12");
  monat30 = new Array("4", "6", "9", "11");
  var i;
  var maxtage;
  
  function checkit()
  {
    maxtage = 0;
    if (js_inarray(monat, monat31))
      maxtage = 31;    
    if ((monat == "2") && ((((jahr%4) == 0) && ((jahr%100) != 0)) || ( (jahr%400) == 0)))
      maxtage = 29;
    if ((monat == "2") && (maxtage != 29))
      maxtage = 28;
    if (js_inarray(monat, monat30))
      maxtage = 30;

    if ((tag > maxtage) && (monat != "") && (jahr != ""))
    {
      for (i = 0; i < tagObj.options.length; i++) 
      {
        if (tagObj.options[i].value == maxtage) 
        {
          tagObj.options[i].selected = true;		
        }
        else
        {
          tagObj.options[i].selected = false;	
        }
      }  	
    }
  }
  
  tag   = tagObj.options[tagObj.selectedIndex].value;
  monat = monatObj.options[monatObj.selectedIndex].value;
  jahr  = jahrObj.options[jahrObj.selectedIndex].value;
  checkit();  
}

function CheckForm(hObj)
{
  var bCheckOk = true;
  var nioBo = "1px solid #d78f2b";
  var ioBo ="1px dotted #000000";
  var nioBg = "#d78f2b";
  var ioBg = "#eaedf3";
  var a_error = new Array();

  // 01 ------------------------------------------------------------------------
  if ($("ablesung_tag01"))
  {
    ta_CorrectDate($("ablesung_tag01"), $("ablesung_monat01"), $("ablesung_jahr01"));
  }
  if ($("zaehlernrstrom_a01"))
  {
    var prodObj = new Array();
    prodObj[0] = $("zaehlernrstrom_a01");
    prodObj[1] = $("zaehlernrstrom_b01");
    prodObj[2] = $("zaehlernrstrom_c01");
    prodObj[3] = $("zaehlernrstrom_d01");
    prodObj[4] = $("zaehlernrstrom_e01");
    prodObj[5] = $("zaehlernrstrom_f01");
    prodObj[6] = $("zaehlernrstrom_g01");
    prodObj[7] = $("zaehlernrstrom_h01");
    prodObj[8] = $("zaehlernrstrom_i01");
    prodObj[9] = $("zaehlernrstrom_j01");
    
    for (i = 0; i < 10; i++)
    {
      if (prodObj[i].value != "")
      {
        if (isNaN(prodObj[i].value)) { prodObj[i].value = ""; }
        else { if((i<9)&&(!bFieldError)&&(hObj==prodObj[i])) prodObj[i+1].focus(); }
        if (prodObj[i].value.length > 1) { prodObj[i].value = prodObj[i].value.substring(0, 1); }
      }     
    }
  }
  if ($("zaehlerstandstrom_a01"))
  {
    var prodObj = new Array();
    prodObj[0] = $("zaehlerstandstrom_a01");
    prodObj[1] = $("zaehlerstandstrom_b01");
    prodObj[2] = $("zaehlerstandstrom_c01");
    prodObj[3] = $("zaehlerstandstrom_d01");
    prodObj[4] = $("zaehlerstandstrom_e01");
    prodObj[5] = $("zaehlerstandstrom_f01");
    prodObj[6] = $("zaehlerstandstrom_g01");
    
    var bFieldError = false;
    for (i = 0; i < 7; i++)
    {
      if (prodObj[i].value != "")
      {
        if (isNaN(prodObj[i].value)) { prodObj[i].value = ""; }
        else { if((i<6)&&(!bFieldError)&&(hObj==prodObj[i])) prodObj[i+1].focus(); }
        if (prodObj[i].value.length > 1) { prodObj[i].value = prodObj[i].value.substring(0, 1); }
      }     
    }
  }
  if ($("zaehlerstandstromht_a01"))
  {
    var prodObj = new Array();
    prodObj[0] = $("zaehlerstandstromht_a01");
    prodObj[1] = $("zaehlerstandstromht_b01");
    prodObj[2] = $("zaehlerstandstromht_c01");
    prodObj[3] = $("zaehlerstandstromht_d01");
    prodObj[4] = $("zaehlerstandstromht_e01");
    prodObj[5] = $("zaehlerstandstromht_f01");
    prodObj[6] = $("zaehlerstandstromht_g01");
    
    var bFieldError = false;
    for (i = 0; i < 7; i++)
    {
      if (prodObj[i].value != "")
      {
        if (isNaN(prodObj[i].value)) { prodObj[i].value = ""; }
        else { if((i<6)&&(!bFieldError)&&(hObj==prodObj[i])) prodObj[i+1].focus(); }
        if (prodObj[i].value.length > 1) { prodObj[i].value = prodObj[i].value.substring(0, 1); }
      }     
    }
  }
  if ($("zaehlerstandstromnt_a01"))
  {
    var prodObj = new Array();
    prodObj[0] = $("zaehlerstandstromnt_a01");
    prodObj[1] = $("zaehlerstandstromnt_b01");
    prodObj[2] = $("zaehlerstandstromnt_c01");
    prodObj[3] = $("zaehlerstandstromnt_d01");
    prodObj[4] = $("zaehlerstandstromnt_e01");
    prodObj[5] = $("zaehlerstandstromnt_f01");
    prodObj[6] = $("zaehlerstandstromnt_g01");
    
    var bFieldError = false;
    for (i = 0; i < 7; i++)
    {
      if (prodObj[i].value != "")
      {
        if (isNaN(prodObj[i].value)) { prodObj[i].value = ""; }
        else { if((i<6)&&(!bFieldError)&&(hObj==prodObj[i])) prodObj[i+1].focus(); }
        if (prodObj[i].value.length > 1) { prodObj[i].value = prodObj[i].value.substring(0, 1); }
      }     
    }
  }
  
  if ($("zaehlernrgas_a01"))
  {
    var prodObj = new Array();
    prodObj[0] = $("zaehlernrgas_a01");
    prodObj[1] = $("zaehlernrgas_b01");
    prodObj[2] = $("zaehlernrgas_c01");
    prodObj[3] = $("zaehlernrgas_d01");
    prodObj[4] = $("zaehlernrgas_e01");
    prodObj[5] = $("zaehlernrgas_f01");
    prodObj[6] = $("zaehlernrgas_g01");
    prodObj[7] = $("zaehlernrgas_h01");
    prodObj[8] = $("zaehlernrgas_i01");
    prodObj[9] = $("zaehlernrgas_j01");

    var bFieldError = false;
    for (i = 0; i < 10; i++)
    {
      if (prodObj[i].value != "")
      {
        if (isNaN(prodObj[i].value)) { prodObj[i].value = ""; }
        else { if((i<9)&&(!bFieldError)&&(hObj==prodObj[i])) prodObj[i+1].focus(); }
        if (prodObj[i].value.length > 1) { prodObj[i].value = prodObj[i].value.substring(0, 1); }
      }     
    }
  }
  if ($("zaehlerstandgas_a01"))
  {
    var prodObj = new Array();
    prodObj[0] = $("zaehlerstandgas_a01");
    prodObj[1] = $("zaehlerstandgas_b01");
    prodObj[2] = $("zaehlerstandgas_c01");
    prodObj[3] = $("zaehlerstandgas_d01");
    prodObj[4] = $("zaehlerstandgas_e01");
    prodObj[5] = $("zaehlerstandgas_f01");
    prodObj[6] = $("zaehlerstandgas_g01");
    
    var bFieldError = false;
    for (i = 0; i < 7; i++)
    {
      if (prodObj[i].value != "")
      {
        if (isNaN(prodObj[i].value)) { prodObj[i].value = ""; }
        else { if((i<6)&&(!bFieldError)&&(hObj==prodObj[i])) prodObj[i+1].focus(); }
        if (prodObj[i].value.length > 1) { prodObj[i].value = prodObj[i].value.substring(0, 1); }
      }     
    }
  }

  if ($("zaehlernrwasser_a01"))
  {
    var prodObj = new Array();
    prodObj[0] = $("zaehlernrwasser_a01");
    prodObj[1] = $("zaehlernrwasser_b01");
    prodObj[2] = $("zaehlernrwasser_c01");
    prodObj[3] = $("zaehlernrwasser_d01");
    prodObj[4] = $("zaehlernrwasser_e01");
    prodObj[5] = $("zaehlernrwasser_f01");
    prodObj[6] = $("zaehlernrwasser_g01");
    prodObj[7] = $("zaehlernrwasser_h01");
    prodObj[8] = $("zaehlernrwasser_i01");
    prodObj[9] = $("zaehlernrwasser_j01");

    var bFieldError = false;
    for (i = 0; i < 10; i++)
    {
      if (prodObj[i].value != "")
      {
        if (isNaN(prodObj[i].value)) { prodObj[i].value = ""; }
        else { if((i<9)&&(!bFieldError)&&(hObj==prodObj[i])) prodObj[i+1].focus(); }
        if (prodObj[i].value.length > 1) { prodObj[i].value = prodObj[i].value.substring(0, 1); }
      }     
    }
  }
  if ($("zaehlerstandwasser_a01"))
  {
    var prodObj = new Array();
    prodObj[0] = $("zaehlerstandwasser_a01");
    prodObj[1] = $("zaehlerstandwasser_b01");
    prodObj[2] = $("zaehlerstandwasser_c01");
    prodObj[3] = $("zaehlerstandwasser_d01");
    prodObj[4] = $("zaehlerstandwasser_e01");
    prodObj[5] = $("zaehlerstandwasser_f01");
    prodObj[6] = $("zaehlerstandwasser_g01");
    
    var bFieldError = false;
    for (i = 0; i < 7; i++)
    {
      if (prodObj[i].value != "")
      {
        if (isNaN(prodObj[i].value)) { prodObj[i].value = ""; }
        else { if((i<6)&&(!bFieldError)&&(hObj==prodObj[i])) prodObj[i+1].focus(); }
        if (prodObj[i].value.length > 1) { prodObj[i].value = prodObj[i].value.substring(0, 1); }
      }     
    }
  }
  
  // 02 ------------------------------------------------------------------------
  if ($("name02"))
  {
    if ($("name02").value == "") { bCheckOk = false; a_error.push("Name"); $("name02").style.border = nioBo; }
    else { $("name02").style.border = ioBo; }
  }
  if ($("vorname02"))
  {
    if ($("vorname02").value == "") { bCheckOk = false; a_error.push("Vorname"); $("vorname02").style.border = nioBo; }
    else { $("vorname02").style.border = ioBo; }
  }
  if ($("strasse02"))
  {
    if ($("strasse02").value == "") { bCheckOk = false; a_error.push("Straße"); $("strasse02").style.border = nioBo; }
    else { $("strasse02").style.border = ioBo; }
  }
  if ($("hausnr02"))
  {
    if ($("hausnr02").value == "") { bCheckOk = false; a_error.push("Hausnummer"); $("hausnr02").style.border = nioBo; }
    else { $("hausnr02").style.border = ioBo; }
  }
  if ($("plz02"))
  {
    if (($("plz02").value == "") || (!CheckPLZ($("plz02"))) ) { bCheckOk = false;  a_error.push("Postleitzahl");$("plz02").style.border = nioBo; }
    else { $("plz02").style.border = ioBo; }
  }
  if ($("ort02"))
  {
    if ($("ort02").value == "") { bCheckOk = false; a_error.push("Ort"); $("ort02").style.border = nioBo; }
    else { $("ort02").style.border = ioBo; }
  }
  if ($("tel_vorwahl02"))
  {
    if ((!CheckPhone($("tel_vorwahl02"))) || ($("tel_vorwahl02").value == "")) { bCheckOk = false;  a_error.push("Telefon - Vorwahl"); $("tel_vorwahl02").style.border = nioBo; }
    else { $("tel_vorwahl02").style.border = ioBo; }
    if ((!CheckPhone($("tel_nummer02"))) || ($("tel_nummer02").value == "")) { bCheckOk = false;  a_error.push("Telefon - Nummer"); $("tel_nummer02").style.border = nioBo; }
    else { $("tel_nummer02").style.border = ioBo; }
  }
  if ($("fax_vorwahl02"))
  {
    CheckPhone($("fax_vorwahl02"));    
    CheckPhone($("fax_nummer02"));        
  }
  if ($("email02"))
  {
    if (!CheckMail($("email02").value)) { bCheckOk = false; a_error.push("E-Mail-Adresse"); $("email02").style.border = nioBo; }
    else { $("email02").style.border = ioBo; }
  }
  // 03 ------------------------------------------------------------------------
  if ($("name03"))
  {
    if ($("name03").value == "") { bCheckOk = false; a_error.push("Name"); $("name03").style.border = nioBo; }
    else { $("name03").style.border = ioBo; }
  }
  if ($("vorname03"))
  {
    if ($("vorname03").value == "") { bCheckOk = false; a_error.push("Vorname"); $("vorname03").style.border = nioBo; }
    else { $("vorname03").style.border = ioBo; }
  }
  if ($("email03"))
  {
    if (!CheckMail($("email03").value)) { bCheckOk = false; a_error.push("E-Mail-Adresse"); $("email03").style.border = nioBo; }
    else { $("email03").style.border = ioBo; }
  }
  if ($("kdnr03"))
  {
    if ((isNaN($("kdnr03").value)) || ($("kdnr03").value == "")) { bCheckOk = false; a_error.push("Kundennummer"); $("kdnr03").style.border = nioBo; }
    else { $("kdnr03").style.border = ioBo; }    
  }
  if ($("auszug_tag03"))
  {
    ta_CorrectDate($("auszug_tag03"), $("auszug_monat03"), $("auszug_jahr03"));
    if ($("auszug_tag03").selectedIndex <= 0) { bCheckOk = false; a_error.push("Auszugsdatum, Tag"); $("auszug_tag03").style.background = nioBg; }
    else { $("auszug_tag03").style.background = ioBg; }
    if ($("auszug_monat03").selectedIndex <= 0) { bCheckOk = false; a_error.push("Auszugsdatum, Monat"); $("auszug_monat03").style.background = nioBg; }
    else { $("auszug_monat03").style.background = ioBg; }
    if ($("auszug_jahr03").selectedIndex <= 0) { bCheckOk = false; a_error.push("Auszugsdatum, Jahr"); $("auszug_jahr03").style.background = nioBg; }
    else { $("auszug_jahr03").style.background = ioBg; }
  }
  
  
  // 04 ------------------------------------------------------------------------
  if ($("strasse04"))
  {
    if ($("strasse04").value == "") { bCheckOk = false; a_error.push("Straße"); $("strasse04").style.border = nioBo; }
    else { $("strasse04").style.border = ioBo; }
  }
  if ($("hausnr04"))
  {
    if ($("hausnr04").value == "") { bCheckOk = false; a_error.push("Hausnummer"); $("hausnr04").style.border = nioBo; }
    else { $("hausnr04").style.border = ioBo; }
  }
  if ($("plz04"))
  {
    if (($("plz04").value == "") || (!CheckPLZ($("plz04"))) ) { bCheckOk = false;  a_error.push("Postleitzahl");$("plz04").style.border = nioBo; }
    else { $("plz04").style.border = ioBo; }
  }
  if ($("ort04"))
  {
    if ($("ort04").value == "") { bCheckOk = false; a_error.push("Ort"); $("ort04").style.border = nioBo; }
    else { $("ort04").style.border = ioBo; }
  }
  // 05 ------------------------------------------------------------------------
  if ($("name05"))
  {
    if ($("name05").value == "") { bCheckOk = false; a_error.push("Name"); $("name05").style.border = nioBo; }
    else { $("name05").style.border = ioBo; }
  }
  if ($("vorname05"))
  {
    if ($("vorname05").value == "") { bCheckOk = false; a_error.push("Vorname"); $("vorname05").style.border = nioBo; }
    else { $("vorname05").style.border = ioBo; }
  }
  if ($("strasse05"))
  {
    if ($("strasse05").value == "") { bCheckOk = false; a_error.push("Straße"); $("strasse05").style.border = nioBo; }
    else { $("strasse05").style.border = ioBo; }
  }
  if ($("hausnr05"))
  {
    if ($("hausnr05").value == "") { bCheckOk = false; a_error.push("Hausnummer"); $("hausnr05").style.border = nioBo; }
    else { $("hausnr05").style.border = ioBo; }
  }
  if ($("plz05"))
  {
    if (($("plz05").value == "") || (!CheckPLZ($("plz05"))) ) { bCheckOk = false;  a_error.push("Postleitzahl");$("plz05").style.border = nioBo; }
    else { $("plz05").style.border = ioBo; }
  }
  if ($("ort05"))
  {
    if ($("ort05").value == "") { bCheckOk = false; a_error.push("Ort"); $("ort05").style.border = nioBo; }
    else { $("ort05").style.border = ioBo; }
  }
  // 06 ------------------------------------------------------------------------
  // 07 ------------------------------------------------------------------------  
  if ($("name_vorm07"))
  {
    if (RadioValue("uebernahme07") == "Hausverwalter/Eigentümer")
    {
      $("name_vorm07").disabled    = false;
      $("vorname_vorm07").disabled = false;
      $("strasse_vorm07").disabled = false;
      $("hausnr_vorm07").disabled  = false;
      $("plz_vorm07").disabled     = false;
      $("ort_vorm07").disabled     = false;
      $("name07").disabled         = "disabled"; $("name07").style.border = ioBo;
      $("vorname07").disabled      = "disabled"; $("vorname07").style.border = ioBo;
      if ($("name_vorm07").value == "") { bCheckOk = false; a_error.push("Vormieter - Name"); $("name_vorm07").style.border = nioBo; }
      else { $("name_vorm07").style.border = ioBo; }
      if ($("vorname_vorm07").value == "") { bCheckOk = false; a_error.push("Vormieter - Vorname"); $("vorname_vorm07").style.border = nioBo; }
      else { $("vorname_vorm07").style.border = ioBo; }
      if ($("strasse_vorm07").value == "") { bCheckOk = false; a_error.push("Vormieter - Straße"); $("strasse_vorm07").style.border = nioBo; }
      else { $("strasse_vorm07").style.border = ioBo; }
      if ($("hausnr_vorm07").value == "") { bCheckOk = false; a_error.push("Vormieter - Hausnummer"); $("hausnr_vorm07").style.border = nioBo; }
      else { $("hausnr_vorm07").style.border = ioBo; }
      if (($("plz_vorm07").value == "") || (!CheckPLZ($("plz_vorm07"))) ) { bCheckOk = false;  a_error.push("Vormieter - Postleitzahl");$("plz_vorm07").style.border = nioBo; }
      else { $("plz_vorm07").style.border = ioBo; }
      if ($("ort_vorm07").value == "") { bCheckOk = false; a_error.push("Vormieter - Ort"); $("ort_vorm07").style.border = nioBo; }
      else { $("ort_vorm07").style.border = ioBo; }
    }
    else
    {
      $("name_vorm07").disabled    = "disabled"; $("name_vorm07").style.border = ioBo;
      $("vorname_vorm07").disabled = "disabled"; $("vorname_vorm07").style.border = ioBo;
      $("strasse_vorm07").disabled = "disabled"; $("strasse_vorm07").style.border = ioBo;
      $("hausnr_vorm07").disabled  = "disabled"; $("hausnr_vorm07").style.border = ioBo;
      $("plz_vorm07").disabled     = "disabled"; $("plz_vorm07").style.border = ioBo;
      $("ort_vorm07").disabled     = "disabled"; $("ort_vorm07").style.border = ioBo;
      $("name07").disabled         = false;
      $("vorname07").disabled      = false;
      if ($("name07").value == "") { bCheckOk = false; a_error.push("Nachmieter - Name"); $("name07").style.border = nioBo; }
      else { $("name07").style.border = ioBo; }
      if ($("vorname07").value == "") { bCheckOk = false; a_error.push("Nachmieter - Vorname"); $("vorname07").style.border = nioBo; }
      else { $("vorname07").style.border = ioBo; }    
    }
  }
  // 08 ------------------------------------------------------------------------
  // 09 ------------------------------------------------------------------------
  if ($("ktoinhaber09"))
  {
    if ($("ktoinhaber09").value == "") { bCheckOk = false; a_error.push("Kontoinhaber"); $("ktoinhaber09").style.border = nioBo; }
    else { $("ktoinhaber09").style.border = ioBo; }
  }
  if ($("ktonr09"))
  {
    if (($("ktonr09").value == "") || (!CheckNumber($("ktonr09")))) { bCheckOk = false;  a_error.push("Kontonummer");$("ktonr09").style.border = nioBo; }
    else { $("ktonr09").style.border = ioBo; }
  }
  if ($("bank09"))
  {
    if ($("bank09").value == "") { bCheckOk = false; a_error.push("Kontoinhaber"); $("bank09").style.border = nioBo; }
    else { $("bank09").style.border = ioBo; }
  }
  if ($("blz09"))
  {
    if (($("blz09").value == "") || (!CheckNumber($("blz09")))) { bCheckOk = false;  a_error.push("Kontonummer");$("blz09").style.border = nioBo; }
    else { $("blz09").style.border = ioBo; }
  }
  // 10 ------------------------------------------------------------------------
  if ($("ktoinhaber10"))
  {
    if ($("ktoinhaber10").value == "") { bCheckOk = false; a_error.push("Kontoinhaber"); $("ktoinhaber10").style.border = nioBo; }
    else { $("ktoinhaber10").style.border = ioBo; }
  }
  if ($("ktonr10"))
  {
    if (($("ktonr10").value == "") || (!CheckNumber($("ktonr10")))) { bCheckOk = false;  a_error.push("Kontonummer");$("ktonr10").style.border = nioBo; }
    else { $("ktonr10").style.border = ioBo; }
  }
  if ($("bank10"))
  {
    if ($("bank10").value == "") { bCheckOk = false; a_error.push("Kontoinhaber"); $("bank10").style.border = nioBo; }
    else { $("bank10").style.border = ioBo; }
  }
  if ($("blz10"))
  {
    if (($("blz10").value == "") || (!CheckNumber($("blz10")))) { bCheckOk = false;  a_error.push("Kontonummer");$("blz10").style.border = nioBo; }
    else { $("blz10").style.border = ioBo; }
  }  
  // 11 ------------------------------------------------------------------------
  if ($("ktoinhaber11"))
  {
    if ($("ktoinhaber11").value == "") { bCheckOk = false; a_error.push("Kontoinhaber"); $("ktoinhaber11").style.border = nioBo; }
    else { $("ktoinhaber11").style.border = ioBo; }
  }
  if ($("ktonr11"))
  {
    if (($("ktonr11").value == "") || (!CheckNumber($("ktonr11")))) { bCheckOk = false;  a_error.push("Kontonummer");$("ktonr11").style.border = nioBo; }
    else { $("ktonr11").style.border = ioBo; }
  }
  if ($("bank11"))
  {
    if ($("bank11").value == "") { bCheckOk = false; a_error.push("Kontoinhaber"); $("bank11").style.border = nioBo; }
    else { $("bank11").style.border = ioBo; }
  }
  if ($("blz11"))
  {
    if (($("blz11").value == "") || (!CheckNumber($("blz11")))) { bCheckOk = false;  a_error.push("Kontonummer");$("blz11").style.border = nioBo; }
    else { $("blz11").style.border = ioBo; }
  }
  // 12 ------------------------------------------------------------------------
  if ($("name12"))
  {
    if ($("name12").value == "") { bCheckOk = false; a_error.push("Name"); $("name12").style.border = nioBo; }
    else { $("name12").style.border = ioBo; }
  }
  if ($("vorname12"))
  {
    if ($("vorname12").value == "") { bCheckOk = false; a_error.push("Vorname"); $("vorname12").style.border = nioBo; }
    else { $("vorname12").style.border = ioBo; }
  }
  if ($("strasse12"))
  {
    if ($("strasse12").value == "") { bCheckOk = false; a_error.push("Straße"); $("strasse12").style.border = nioBo; }
    else { $("strasse12").style.border = ioBo; }
  }
  if ($("hausnr12"))
  {
    if ($("hausnr12").value == "") { bCheckOk = false; a_error.push("Hausnummer"); $("hausnr12").style.border = nioBo; }
    else { $("hausnr12").style.border = ioBo; }
  }
  if ($("plz12"))
  {
    if (($("plz12").value == "") || (!CheckPLZ($("plz12"))) ) { bCheckOk = false;  a_error.push("Postleitzahl");$("plz12").style.border = nioBo; }
    else { $("plz12").style.border = ioBo; }
  }
  if ($("ort12"))
  {
    if ($("ort12").value == "") { bCheckOk = false; a_error.push("Ort"); $("ort12").style.border = nioBo; }
    else { $("ort12").style.border = ioBo; }
  }
  if ($("tel_vorwahl12"))
  {
    if ((!CheckPhone($("tel_vorwahl12"))) || ($("tel_vorwahl12").value == "")) { bCheckOk = false;  a_error.push("Telefon - Vorwahl"); $("tel_vorwahl12").style.border = nioBo; }
    else { $("tel_vorwahl12").style.border = ioBo; }
    if ((!CheckPhone($("tel_nummer12"))) || ($("tel_nummer12").value == "")) { bCheckOk = false;  a_error.push("Telefon - Nummer"); $("tel_nummer12").style.border = nioBo; }
    else { $("tel_nummer12").style.border = ioBo; }
  }
  if ($("fax_vorwahl12"))
  {
    CheckPhone($("fax_vorwahl12"));    
    CheckPhone($("fax_nummer12"));        
  }
  if ($("email12"))
  {
    if (!CheckMail($("email12").value)) { bCheckOk = false; a_error.push("E-Mail-Adresse"); $("email12").style.border = nioBo; }
    else { $("email12").style.border = ioBo; }
  }

  // 13 ------------------------------------------------------------------------

  if ($("name13"))
  {
    if ($("name13").value == "") { bCheckOk = false; a_error.push("Name"); $("name13").style.border = nioBo; }
    else { $("name13").style.border = ioBo; }
  }
  if ($("vorname13"))
  {
    if ($("vorname13").value == "") { bCheckOk = false; a_error.push("Vorname"); $("vorname13").style.border = nioBo; }
    else { $("vorname13").style.border = ioBo; }
  }
  if ($("strasse13"))
  {
    if ($("strasse13").value == "") { bCheckOk = false; a_error.push("Straße"); $("strasse13").style.border = nioBo; }
    else { $("strasse13").style.border = ioBo; }
  }
  if ($("hausnr13"))
  {
    if ($("hausnr13").value == "") { bCheckOk = false; a_error.push("Hausnummer"); $("hausnr13").style.border = nioBo; }
    else { $("hausnr13").style.border = ioBo; }
  }
  if ($("plz13"))
  {
    if (($("plz13").value == "") || (!CheckPLZ($("plz13"))) ) { bCheckOk = false;  a_error.push("Postleitzahl");$("plz13").style.border = nioBo; }
    else { $("plz13").style.border = ioBo; }
  }
  if ($("ort13"))
  {
    if ($("ort13").value == "") { bCheckOk = false; a_error.push("Ort"); $("ort13").style.border = nioBo; }
    else { $("ort13").style.border = ioBo; }
  }
  if ($("tel_vorwahl13"))
  {
    CheckPhone($("tel_vorwahl13"));    
    CheckPhone($("tel_nummer13"));        
  }
  if ($("fax_vorwahl13"))
  {
    CheckPhone($("fax_vorwahl13"));    
    CheckPhone($("fax_nummer13"));        
  }
  if ($("email13"))
  {
    if (!CheckMail($("email13").value)) { bCheckOk = false; a_error.push("E-Mail-Adresse"); $("email13").style.border = nioBo; }
    else { $("email13").style.border = ioBo; }
  }  
  // 14 ------------------------------------------------------------------------
  // 15 ------------------------------------------------------------------------
  if ($("ansprechpartner15"))
  {
    if (SelectValue($("ansprechpartner15")) == "0") { bCheckOk = false; a_error.push("Ansprechpartner"); $("ansprechpartner15").style.border = nioBo; }
    else { $("ansprechpartner15").style.border = ioBo; }
  }
  
  // 16 ------------------------------------------------------------------------
  if ($("name16"))
  {
    if ($("name16").value == "") { bCheckOk = false; a_error.push("Name"); $("name16").style.border = nioBo; }
    else { $("name16").style.border = ioBo; }
  }
  if ($("vorname16"))
  {
    if ($("vorname16").value == "") { bCheckOk = false; a_error.push("Vorname"); $("vorname16").style.border = nioBo; }
    else { $("vorname16").style.border = ioBo; }
  }
  if ($("strasse16"))
  {
    if ($("strasse16").value == "") { bCheckOk = false; a_error.push("Straße"); $("strasse16").style.border = nioBo; }
    else { $("strasse16").style.border = ioBo; }
  }
  if ($("hausnr16"))
  {
    if ($("hausnr16").value == "") { bCheckOk = false; a_error.push("Hausnummer"); $("hausnr16").style.border = nioBo; }
    else { $("hausnr16").style.border = ioBo; }
  }
  if ($("plz16"))
  {
    if (($("plz16").value == "") || (!CheckPLZ($("plz16"))) ) { bCheckOk = false;  a_error.push("Postleitzahl");$("plz16").style.border = nioBo; }
    else { $("plz16").style.border = ioBo; }
  }
  if ($("ort16"))
  {
    if ($("ort16").value == "") { bCheckOk = false; a_error.push("Ort"); $("ort16").style.border = nioBo; }
    else { $("ort16").style.border = ioBo; }
  }
  if ($("tel_vorwahl16"))
  {
    if ((!CheckPhone($("tel_vorwahl16"))) || ($("tel_vorwahl16").value == "")) { bCheckOk = false;  a_error.push("Telefon - Vorwahl"); $("tel_vorwahl16").style.border = nioBo; }
    else { $("tel_vorwahl16").style.border = ioBo; }
    if ((!CheckPhone($("tel_nummer16"))) || ($("tel_nummer16").value == "")) { bCheckOk = false;  a_error.push("Telefon - Nummer"); $("tel_nummer16").style.border = nioBo; }
    else { $("tel_nummer16").style.border = ioBo; }
  }
  if ($("fax_vorwahl16"))
  {
    CheckPhone($("fax_vorwahl16"));    
    CheckPhone($("fax_nummer16"));        
  }
  if ($("email16"))
  {
    if (!CheckMail($("email16").value)) { bCheckOk = false; a_error.push("E-Mail-Adresse"); $("email16").style.border = nioBo; }
    else { $("email16").style.border = ioBo; }
  }
  if ($("einzug_tag16"))
  {
    ta_CorrectDate($("einzug_tag16"), $("einzug_monat16"), $("einzug_jahr16"));
    if ($("einzug_tag16").selectedIndex <= 0) { bCheckOk = false; a_error.push("Datum, Tag"); $("einzug_tag16").style.background = nioBg; }
    else { $("einzug_tag16").style.background = ioBg; }
    if ($("einzug_monat16").selectedIndex <= 0) { bCheckOk = false; a_error.push("Datum, Monat"); $("einzug_monat16").style.background = nioBg; }
    else { $("einzug_monat16").style.background = ioBg; }
    if ($("einzug_jahr16").selectedIndex <= 0) { bCheckOk = false; a_error.push("Datum, Jahr"); $("einzug_jahr16").style.background = nioBg; }
    else { $("einzug_jahr16").style.background = ioBg; }
  }  
    
  // 18 ------------------------------------------------------------------------
  if ($("aenderung_tag18"))
  {
    ta_CorrectDate($("aenderung_tag18"), $("aenderung_monat18"), $("aenderung_jahr18"));
    if ($("aenderung_tag18").selectedIndex <= 0) { bCheckOk = false; a_error.push("Datum, Tag"); $("aenderung_tag18").style.background = nioBg; }
    else { $("aenderung_tag18").style.background = ioBg; }
    if ($("aenderung_monat18").selectedIndex <= 0) { bCheckOk = false; a_error.push("Datum, Monat"); $("aenderung_monat18").style.background = nioBg; }
    else { $("aenderung_monat18").style.background = ioBg; }
    if ($("aenderung_jahr18").selectedIndex <= 0) { bCheckOk = false; a_error.push("Datum, Jahr"); $("aenderung_jahr18").style.background = nioBg; }
    else { $("aenderung_jahr18").style.background = ioBg; }
  }  
  if ($("vonabschlag_gas18"))
  {
    if (($("vonabschlag_gas18").value == "") || (isNaN($("vonabschlag_gas18").value))) { bCheckOk = false;  a_error.push("Abschlagshöhe Gas - von");$("vonabschlag_gas18").style.border = nioBo; }
    else { $("vonabschlag_gas18").style.border = ioBo; }
  }
  if ($("aufabschlag_gas18"))
  {
    if (($("aufabschlag_gas18").value == "") || (isNaN($("aufabschlag_gas18").value))) { bCheckOk = false;  a_error.push("Abschlagshöhe Gas - auf");$("aufabschlag_gas18").style.border = nioBo; }
    else { $("aufabschlag_gas18").style.border = ioBo; }
  }
  if ($("vonabschlag_strom18"))
  {
    if (($("vonabschlag_strom18").value == "") || (isNaN($("vonabschlag_strom18").value))) { bCheckOk = false;  a_error.push("Abschlagshöhe Strom - von");$("vonabschlag_strom18").style.border = nioBo; }
    else { $("vonabschlag_strom18").style.border = ioBo; }
  }
  if ($("aufabschlag_strom18"))
  {
    if (($("aufabschlag_strom18").value == "") || (isNaN($("aufabschlag_strom18").value))) { bCheckOk = false;  a_error.push("Abschlagshöhe Strom - auf");$("aufabschlag_strom18").style.border = nioBo; }
    else { $("aufabschlag_strom18").style.border = ioBo; }
  }

  if ($("zaehlerstandgas_a18"))
  {
    var prodObj = new Array();
    prodObj[0] = $("zaehlerstandgas_a18");
    prodObj[1] = $("zaehlerstandgas_b18");
    prodObj[2] = $("zaehlerstandgas_c18");
    prodObj[3] = $("zaehlerstandgas_d18");
    prodObj[4] = $("zaehlerstandgas_e18");
    prodObj[5] = $("zaehlerstandgas_f18");
    prodObj[6] = $("zaehlerstandgas_g18");
    
    var bFieldError = false;
    for (i = 0; i < 7; i++)
    {
      if ((prodObj[i].value == "") || (isNaN(prodObj[i].value))) { bFieldError = true; a_error.push("Zählerstand Strom, Stelle "+(i+1)); bCheckOk = false; prodObj[i].style.border = nioBo; }
      else { prodObj[i].style.border = ioBo; if((i<6)&&(!bFieldError)&&(hObj==prodObj[i])) prodObj[i+1].focus(); }
      if (prodObj[i].value.length > 1) { prodObj[i].value = prodObj[i].value.substring(0, 1); }     
    }
  }
  if ($("zaehlerstandstrom_a18"))
  {
    var prodObj = new Array();
    prodObj[0] = $("zaehlerstandstrom_a18");
    prodObj[1] = $("zaehlerstandstrom_b18");
    prodObj[2] = $("zaehlerstandstrom_c18");
    prodObj[3] = $("zaehlerstandstrom_d18");
    prodObj[4] = $("zaehlerstandstrom_e18");
    prodObj[5] = $("zaehlerstandstrom_f18");
    prodObj[6] = $("zaehlerstandstrom_g18");
    
    var bFieldError = false;
    for (i = 0; i < 7; i++)
    {
      if ((prodObj[i].value == "") || (isNaN(prodObj[i].value))) { bFieldError = true; a_error.push("Zählerstand Strom, Stelle "+(i+1)); bCheckOk = false; prodObj[i].style.border = nioBo; }
      else { prodObj[i].style.border = ioBo; if((i<6)&&(!bFieldError)&&(hObj==prodObj[i])) prodObj[i+1].focus(); }
      if (prodObj[i].value.length > 1) { prodObj[i].value = prodObj[i].value.substring(0, 1); }     
    }
  }
  // 20 ------------------------------------------------------------------------
  if ($("zwrechnung_tag20"))
  {
    ta_CorrectDate($("zwrechnung_tag20"), $("zwrechnung_monat20"), $("zwrechnung_jahr20"));
    if ($("zwrechnung_tag20").selectedIndex <= 0) { bCheckOk = false; a_error.push("Datum, Tag"); $("zwrechnung_tag20").style.background = nioBg; }
    else { $("zwrechnung_tag20").style.background = ioBg; }
    if ($("zwrechnung_monat20").selectedIndex <= 0) { bCheckOk = false; a_error.push("Datum, Monat"); $("zwrechnung_monat20").style.background = nioBg; }
    else { $("zwrechnung_monat20").style.background = ioBg; }
    if ($("zwrechnung_jahr20").selectedIndex <= 0) { bCheckOk = false; a_error.push("Datum, Jahr"); $("zwrechnung_jahr20").style.background = nioBg; }
    else { $("zwrechnung_jahr20").style.background = ioBg; }
  }
  
  // 21 ------------------------------------------------------------------------
  if ($("ktoinhaber21"))
  {
    if (RadioValue("einzug21") == "Ja")
    {
      if ($("ktoinhaber21").value == "") { bCheckOk = false; a_error.push("Kontoinhaber"); $("ktoinhaber21").style.border = nioBo; }
      else { $("ktoinhaber21").style.border = ioBo; }
      if (($("ktonr21").value == "") || (!CheckNumber($("ktonr21")))) { bCheckOk = false;  a_error.push("Kontonummer");$("ktonr21").style.border = nioBo; }
      else { $("ktonr21").style.border = ioBo; }
      if ($("bank21").value == "") { bCheckOk = false; a_error.push("Kontoinhaber"); $("bank21").style.border = nioBo; }
      else { $("bank21").style.border = ioBo; }
      if (($("blz21").value == "") || (!CheckNumber($("blz21")))) { bCheckOk = false;  a_error.push("Kontonummer");$("blz21").style.border = nioBo; }
      else { $("blz21").style.border = ioBo; }
    }
    else
    {
      $("ktoinhaber21").style.border = ioBo;
      $("ktonr21").style.border      = ioBo;
      $("bank21").style.border       = ioBo;
      $("blz21").style.border        = ioBo;
    }
  }
  
  // 23 ------------------------------------------------------------------------
  if ($("name23"))
  {
    if ($("name23").value == "") { bCheckOk = false; a_error.push("Name"); $("name23").style.border = nioBo; }
    else { $("name23").style.border = ioBo; }
  }
  if ($("vorname23"))
  {
    if ($("vorname23").value == "") { bCheckOk = false; a_error.push("Vorname"); $("vorname23").style.border = nioBo; }
    else { $("vorname23").style.border = ioBo; }
  }
  if ($("tel_vorwahl23"))
  {
    CheckPhone($("tel_vorwahl23"));    
    CheckPhone($("tel_nummer23"));        
  }
  if ($("fax_vorwahl23"))
  {
    CheckPhone($("fax_vorwahl23"));    
    CheckPhone($("fax_nummer23"));        
  }
  if ($("email23"))
  {
    if (!CheckMail($("email23").value)) { bCheckOk = false; a_error.push("E-Mail-Adresse"); $("email23").style.border = nioBo; }
    else { $("email23").style.border = ioBo; }
  }
  if ($("strasse23"))
  {
    if ($("strasse23").value == "") { bCheckOk = false; a_error.push("Straße"); $("strasse23").style.border = nioBo; }
    else { $("strasse23").style.border = ioBo; }
  }
  if ($("hausnr23"))
  {
    if ($("hausnr23").value == "") { bCheckOk = false; a_error.push("Hausnummer"); $("hausnr23").style.border = nioBo; }
    else { $("hausnr23").style.border = ioBo; }
  }
  if ($("plz23"))
  {
    if (($("plz23").value.length != 5) || (isNaN($("plz23").value)) ) { bCheckOk = false;  a_error.push("Postleitzahl");$("plz23").style.border = nioBo; }
    else { $("plz23").style.border = ioBo; }
  }
  if ($("ort23"))
  {
    if ($("ort23").value == "") { bCheckOk = false; a_error.push("Ort"); $("ort23").style.border = nioBo; }
    else { $("ort23").style.border = ioBo; }
  }
  // 24 ------------------------------------------------------------------------
  if ($("persdat24"))
  {
    if ($("persdat24").checked == false)
    {
      bCheckOk = false;
      a_error.push("Einverständnis Datensicherung");
      $("error_persdat24").style.background = nioBg;
    }
    else
    {
      $("error_persdat24").style.background = ioBg;
    }
  }
  if ($("agb24"))
  {
    if ($("agb24").checked == false)
    {
      bCheckOk = false;
      a_error.push("Kenntnisnahme AGB");
      $("error_agb24").style.background = nioBg;
    }
    else
    {
      $("error_agb24").style.background = ioBg;
    }
  }
  // 28 ------------------------------------------------------------------------
  if ($("leistung28"))
  {
    if ($("leistung28").value == "") { bCheckOk = false; a_error.push("Installierte Leistung"); $("leistung28").style.border = nioBo; }
    else { $("leistung28").style.border = ioBo; }
  }
  if ($("bedarf28"))
  {
    if ($("bedarf28").value == "") { bCheckOk = false; a_error.push("Voraussichtlicher Jahresbedarf"); $("bedarf28").style.border = nioBo; }
    else { $("bedarf28").style.border = ioBo; }
  }
  // 32 ------------------------------------------------------------------------
  if ($("zaehlernrgas_a32"))
  {
    var prodObj = new Array();
    prodObj[0] = $("zaehlernrgas_a32");
    prodObj[1] = $("zaehlernrgas_b32");
    prodObj[2] = $("zaehlernrgas_c32");
    prodObj[3] = $("zaehlernrgas_d32");
    prodObj[4] = $("zaehlernrgas_e32");
    prodObj[5] = $("zaehlernrgas_f32");
    prodObj[6] = $("zaehlernrgas_g32");
    prodObj[7] = $("zaehlernrgas_h32");
    prodObj[8] = $("zaehlernrgas_i32");
    prodObj[9] = $("zaehlernrgas_j32");

    var bFieldError = false;
    for (i = 0; i < 10; i++)
    {
      if(prodObj[i].value != "")
      {
        if (isNaN(prodObj[i].value)) { bFieldError = true; a_error.push("Zählernummer Gas, Stelle "+(i+1)); bCheckOk = false; prodObj[i].style.border = nioBo; }
        else { prodObj[i].style.border = ioBo; if((i<9)&&(!bFieldError)&&(hObj==prodObj[i])) prodObj[i+1].focus(); }
        if (prodObj[i].value.length > 1) { prodObj[i].value = prodObj[i].value.substring(0, 1); }
      }
      else { prodObj[i].style.border = ioBo; }     
    }
  }
  if ($("zaehlerstandgas_a32"))
  {
    var prodObj = new Array();
    prodObj[0] = $("zaehlerstandgas_a32");
    prodObj[1] = $("zaehlerstandgas_b32");
    prodObj[2] = $("zaehlerstandgas_c32");
    prodObj[3] = $("zaehlerstandgas_d32");
    prodObj[4] = $("zaehlerstandgas_e32");
    prodObj[5] = $("zaehlerstandgas_f32");
    prodObj[6] = $("zaehlerstandgas_g32");
    
    var bFieldError = false;
    for (i = 0; i < 7; i++)
    {
      if (prodObj[i].value != "")
      {
        if (isNaN(prodObj[i].value)) { bFieldError = true; a_error.push("Zählerstand Gas, Stelle "+(i+1)); bCheckOk = false; prodObj[i].style.border = nioBo; }
        else { prodObj[i].style.border = ioBo; if((i<6)&&(!bFieldError)&&(hObj==prodObj[i])) prodObj[i+1].focus(); }
        if (prodObj[i].value.length > 1) { prodObj[i].value = prodObj[i].value.substring(0, 1); }
      }
      else { prodObj[i].style.border = ioBo; }     
    }
  }
  if ($("zaehlernrstrom_a32"))
  {
    var prodObj = new Array();
    prodObj[0] = $("zaehlernrstrom_a32");
    prodObj[1] = $("zaehlernrstrom_b32");
    prodObj[2] = $("zaehlernrstrom_c32");
    prodObj[3] = $("zaehlernrstrom_d32");
    prodObj[4] = $("zaehlernrstrom_e32");
    prodObj[5] = $("zaehlernrstrom_f32");
    prodObj[6] = $("zaehlernrstrom_g32");
    prodObj[7] = $("zaehlernrstrom_h32");
    prodObj[8] = $("zaehlernrstrom_i32");
    prodObj[9] = $("zaehlernrstrom_j32");
    
    var bFieldError = false;
    for (i = 0; i < 10; i++)
    {
      if (prodObj[i].value != "")
      {
        if (isNaN(prodObj[i].value)) { bFieldError = true; a_error.push("Zählernummer Strom, Stelle "+(i+1)); bCheckOk = false; prodObj[i].style.border = nioBo; }
        else { prodObj[i].style.border = ioBo; if((i<9)&&(!bFieldError)&&(hObj==prodObj[i])) prodObj[i+1].focus(); }
        if (prodObj[i].value.length > 1) { prodObj[i].value = prodObj[i].value.substring(0, 1); }
      }
      else { prodObj[i].style.border = ioBo; }     
    }
  }
  if ($("zaehlerstandstrom_a32"))
  {
    var prodObj = new Array();
    prodObj[0] = $("zaehlerstandstrom_a32");
    prodObj[1] = $("zaehlerstandstrom_b32");
    prodObj[2] = $("zaehlerstandstrom_c32");
    prodObj[3] = $("zaehlerstandstrom_d32");
    prodObj[4] = $("zaehlerstandstrom_e32");
    prodObj[5] = $("zaehlerstandstrom_f32");
    prodObj[6] = $("zaehlerstandstrom_g32");
    
    var bFieldError = false;
    for (i = 0; i < 7; i++)
    {
      if (prodObj[i].value != "")
      {
        if (isNaN(prodObj[i].value)) { bFieldError = true; a_error.push("Zählerstand Strom, Stelle "+(i+1)); bCheckOk = false; prodObj[i].style.border = nioBo; }
        else { prodObj[i].style.border = ioBo; if((i<6)&&(!bFieldError)&&(hObj==prodObj[i])) prodObj[i+1].focus(); }
        if (prodObj[i].value.length > 1) { prodObj[i].value = prodObj[i].value.substring(0, 1); }
      }     
      else { prodObj[i].style.border = ioBo; }
    }
  }
  // 33 ------------------------------------------------------------------------
  if ($("name33"))
  {
    if ($("name33").value == "") { bCheckOk = false; a_error.push("Name"); $("name33").style.border = nioBo; }
    else { $("name33").style.border = ioBo; }
  }
  if ($("vorname33"))
  {
    if ($("vorname33").value == "") { bCheckOk = false; a_error.push("Vorname"); $("vorname33").style.border = nioBo; }
    else { $("vorname33").style.border = ioBo; }
  }
  if ($("tel_vorwahl33"))
  {
    CheckPhone($("tel_vorwahl33"));    
    CheckPhone($("tel_nummer33"));        
  }
  if ($("fax_vorwahl33"))
  {
    CheckPhone($("fax_vorwahl33"));    
    CheckPhone($("fax_nummer33"));        
  }
  if ($("email33"))
  {
    if (!CheckMail($("email33").value)) { bCheckOk = false; a_error.push("E-Mail-Adresse"); $("email33").style.border = nioBo; }
    else { $("email33").style.border = ioBo; }
  }
  if ($("strasse33"))
  {
    if ($("strasse33").value == "") { bCheckOk = false; a_error.push("Straße"); $("strasse33").style.border = nioBo; }
    else { $("strasse33").style.border = ioBo; }
  }
  if ($("hausnr33"))
  {
    if ($("hausnr33").value == "") { bCheckOk = false; a_error.push("Hausnummer"); $("hausnr33").style.border = nioBo; }
    else { $("hausnr33").style.border = ioBo; }
  }
  if ($("plz33"))
  {
    if (($("plz33").value.length != 5) || (isNaN($("plz33").value)) ) { bCheckOk = false;  a_error.push("Postleitzahl");$("plz33").style.border = nioBo; }
    else { $("plz33").style.border = ioBo; }
  }
  if ($("ort33"))
  {
    if ($("ort33").value == "") { bCheckOk = false; a_error.push("Ort"); $("ort33").style.border = nioBo; }
    else { $("ort33").style.border = ioBo; }
  }
  if ($("gebdat_tag33"))
  {
    ta_CorrectDate($("gebdat_tag33"), $("gebdat_monat33"), $("gebdat_jahr33"));
  }  



  if (bCheckOk)
  {
    if ($("weiter")) { $("weiter").disabled = false; }
    if ($("submitform")) { $("submitform").disabled = false; }

    // Verlaufsnavi anpassen
    var alen  = parseInt($("ablauf_length").value);
    var act_a = parseInt($("reqstep").value);

    for (var a = 1; a <= alen; a++)
    {
      if (a < (act_a+1))
        $("vertnav"+a).innerHTML = "<img style=\"margin-left: 2px; margin-right: 2px; border: 0px;\" src=\"inc/ressources/ablauf_" + a + "_disabled.png\">";
      if (a == act_a)
        $("vertnav"+a).innerHTML = "<img onclick=\"GoBack('" + $("pid").value + "');\" style=\"margin-left: 2px; margin-right: 2px; border: 0px; cursor: pointer; \" src=\"inc/ressources/ablauf_" + a + ".png\">";
      if (a == (act_a+1))
        $("vertnav"+a).innerHTML = "<img style=\"margin-left: 2px; margin-right: 2px; border: 0px;\" src=\"inc/ressources/ablauf_" + a + "_actual.png\">";
      if (a > (act_a+1))
        $("vertnav"+a).innerHTML = "<img onclick=\"GoForward('" + $("pid").value + "');\" onclick=\"this.form.submit();\" style=\"margin-left: 2px; margin-right: 2px; border: 0px; cursor: pointer;\" src=\"inc/ressources/ablauf_" + a + ".png\">";
      if (a > (act_a+2))
        $("vertnav"+a).innerHTML = "<img style=\"margin-left: 2px; margin-right: 2px; border: 0px;\" src=\"inc/ressources/ablauf_" + a + "_disabled.png\">";
    }     
  }
  else
  {
    if ($("weiter")) { $("weiter").disabled = "disabled"; }
    if ($("submitform")) { $("submitform").disabled = "disabled"; }

    // Verlaufsnavi anpassen
    var alen  = parseInt($("ablauf_length").value);
    var act_a = parseInt($("reqstep").value);
    
    for (var a = 1; a <= alen; a++)
    {
      if (a < (act_a+1))
        $("vertnav"+a).innerHTML = "<img style=\"margin-left: 2px; margin-right: 2px; border: 0px;\" src=\"inc/ressources/ablauf_" + a + "_disabled.png\">";
      if (a == act_a)
        $("vertnav"+a).innerHTML = "<img onclick=\"GoBack('" + $("pid").value + "');\" style=\"margin-left: 2px; margin-right: 2px; border: 0px; cursor: pointer; \" src=\"inc/ressources/ablauf_" + a + ".png\">";
      if (a == (act_a+1))
        $("vertnav"+a).innerHTML = "<img style=\"margin-left: 2px; margin-right: 2px; border: 0px;\" src=\"inc/ressources/ablauf_" + a + "_actual.png\">";
      if ((a-1) > act_a)
        $("vertnav"+a).innerHTML = "<img style=\"margin-left: 2px; margin-right: 2px; border: 0px;\" src=\"inc/ressources/ablauf_" + a + "_disabled.png\">";
    }     
  }

  // Hinweis ausgeben
  if (a_error.length > 0)
  {
    $("errormessage").innerHTML = "Folgende Felder müssen noch ausgefüllt oder korrigiert werden:<br/><ul>";
    for (i = 0; i < a_error.length; i++)
    {
      $("errormessage").innerHTML += "<li>" + a_error[i] + "</li>";
    }
    $("errormessage").innerHTML += "</ul>";
  }
  else
    $("errormessage").innerHTML = "";  
  
} 

function GoBack(pid)
{
  $("actform").action = "?id="+pid+"&zurueck=zurueck";
  $("actform").submit();
}

function GoForward(pid)
{
  $("actform").action = "?id="+pid+"&weiter=weiter";
  $("actform").submit();
}

