
    function RegControlClearHelper( e ) {
        for(var i=0; i<e.length; i++) {
            e[i].style.backgroundColor = '';
        }
    }

    function  RegControl( e ) {
        RegControlClearHelper( e );

        re = /^[0-9]*$/;
        if (e['f06[]'][7].value!='' && !re.test(e['f06[]'][7].value)) {
            e['f06[]'][7].style.backgroundColor = 'yellow';
            e['f06[]'][7].focus();
            return false;
        }
        /*
        if (!e['f01[]'][0].checked && !e['f01[]'][1].checked && !e['f01[]'][2].checked) {
            e['f01[]'][0].style.backgroundColor = 'yellow';
            e['f01[]'][0].focus();
            return false;
        }
        
        if (!e['f02[]'][0].checked && !e['f02[]'][1].checked && !e['f02[]'][2].checked &&
            !e['f02[]'][3].checked && !e['f02[]'][4].checked && !e['f02[]'][5].checked &&
            !e['f03[]'][0].checked && !e['f03[]'][1].checked && !e['f03[]'][2].checked &&
            !e['f03[]'][3].checked && !e['f03[]'][4].checked && !e['f04[]'][0].checked &&
            !e['f04[]'][1].checked) {
            e['f02[]'][0].style.backgroundColor = 'yellow';
            e['f02[]'][0].focus();
            return false;
        }
        */
        if (e['f05[]'][0].value=='') {
            e['f05[]'][0].style.backgroundColor = 'yellow';
            e['f05[]'][0].focus();
            alert(jmeno);
            return false;
        }
        
        if (e['f05[]'][1].value=='') {
            e['f05[]'][1].style.backgroundColor = 'yellow';
            e['f05[]'][1].focus();
            alert(prijmeni);
            return false;
        }

        if (!e['f05[]'][2].checked && !e['f05[]'][3].checked) {
            e['f05[]'][2].style.backgroundColor = 'yellow';
            e['f05[]'][2].focus();
            alert(pohlavi);
            return false;
        }
        re = /^(([0-2]?[0-9])|(3[01])).((0?[0-9])|(1[012])).[0-9]{4}/
        if (e['f05[]'][4].value != '' &&!re.test(e['f05[]'][4].value)) {
            e['f05[]'][4].style.backgroundColor = 'yellow';
            e['f05[]'][4].focus();
            alert(format_datumu);
            return false;
        }

        
        if (e['f06[]'][0].value=='') {
            e['f06[]'][0].style.backgroundColor = 'yellow';
            e['f06[]'][0].focus();
            return false;
        }
        
        if (e['f06[]'][0].value=='Česká republika') {
          if (e['f06[]'][1].value=='') {
              e['f06[]'][1].style.backgroundColor = 'yellow';
              e['f06[]'][1].focus();
              alert(kraj);
              return false;
          }
        
          /*
          if (e['f06[]'][2].value=='') {
              e['f06[]'][2].style.backgroundColor = 'yellow';
              e['f06[]'][2].focus();
              alert(okres);
              return false;
          }
          */
          
        }
        
        if (e['f06[]'][3].value=='') {
            e['f06[]'][3].style.backgroundColor = 'yellow';
            e['f06[]'][3].focus();
            alert(ulice);
            return false;
        }

        if (e['f06[]'][4].value=='') {
            e['f06[]'][4].style.backgroundColor = 'yellow';
            e['f06[]'][4].focus();
            alert(cislo);
            return false;
        }

        if (e['f06[]'][5].value=='') {
            e['f06[]'][5].style.backgroundColor = 'yellow';
            e['f06[]'][5].focus();
            alert(mesto);
            return false;
        }

        if (e['f06[]'][6].value=='') {
            e['f06[]'][6].style.backgroundColor = 'yellow';
            e['f06[]'][6].focus();
            alert(psc);
            return false;
        }

        re = /^[+]?[()/0-9. -]{9,}$/;
        if (e['f06[]'][7].value!='' && !re.test(e['f06[]'][7].value)) {
            e['f06[]'][7].style.backgroundColor = 'yellow';
            e['f06[]'][7].focus();
            alert(mobil);
            return false;
        }
        
        re = /^[+]?[()/0-9. -]{9,}$/;
        if (!re.test(e['f06[]'][8].value)) {
            e['f06[]'][8].style.backgroundColor = 'yellow';
            e['f06[]'][8].focus();
            alert(mobil);
            return false;
        }
        
        re = /^[^.]+(\.[^.]+)*@([^.]+[.])+[a-z]{2,3}$/;
       
       /* if (!re.test(e['f06[]'][9].value)) {
            e['f06[]'][9].style.backgroundColor = 'yellow';
            e['f06[]'][9].focus();
            alert(email);
            return false;
        }
        */
        if (e['f07[]'][0].value!='1'){
          // pokud jsem nevybral zakladni vzdelani musim validovat
          if (e['f07[]'][2].value=='') {
            e['f07[]'][2].style.backgroundColor = 'yellow';
            e['f07[]'][2].focus();
            alert(vzdelani);
            return false;
          }
          
          
        
        }
        if (!e['f07_1[]'][0].checked && !e['f07_1[]'][1].checked) {
              e['f07_1[]'][0].style.backgroundColor = 'yellow';
              e['f07_1[]'][0].focus();
              alert(studuji);
              return false;
          }
  
          if (e['f07_1[]'][0].checked) {
              if (e['f07_2[]'].value=='') {
                  e['f07_2[]'].style.backgroundColor = 'yellow';
                  e['f07_2[]'].focus();
                  alert(instituce);
                  return false;
              }
              if (e['f07_3'].value=='') {
                  e['f07_3'].style.backgroundColor = 'yellow';
                  e['f07_3'].focus();
                  alert(ukonceni_studia);
                  return false;
              }
              re = /^(([0-2]?[0-9])|(3[01])).((0?[0-9])|(1[012])).[0-9]{4}/
              if (!re.test(e['f07_3'].value)) {
                  e['f07_3'].style.backgroundColor = 'yellow';
                  e['f07_3'].focus();
                  alert(format_datumu);
                  return false;
              }
              
          }
        
        /*
        if (!e['f08[]'][0].checked && !e['f08[]'][1].checked && !e['f08[]'][2].checked &&
            !e['f08[]'][3].checked && !e['f08[]'][4].checked && !e['f08[]'][5].checked &&
            e['f09[]'].value=='')
        {
            e['f08[]'][0].style.backgroundColor = 'yellow';
            e['f08[]'][0].focus();
            return false;
        }
        */
        if (!e['f10[]'][0].checked && !e['f10[]'][1].checked && !e['f10[]'][2].checked && !e['f10[]'][3].checked && !e['f10[]'][4].checked) {
            e['f10[]'][0].style.backgroundColor = 'yellow';
            e['f10[]'][0].focus();
            return false;
        }

        if (!e['f11[]'][0].checked && !e['f11[]'][1].checked && !e['f11[]'][2].checked && !e['f11[]'][3].checked && !e['f11[]'][4].checked) {
            e['f11[]'][0].style.backgroundColor = 'yellow';
            e['f11[]'][0].focus();
            return false;
        }

        if (!e['f12[]'][0].checked && !e['f12[]'][1].checked && !e['f12[]'][2].checked && !e['f12[]'][3].checked && !e['f12[]'][4].checked) {
            e['f12[]'][0].style.backgroundColor = 'yellow';
            e['f12[]'][0].focus();
            return false;
        }

        if (!e['f13[]'][0].checked && !e['f13[]'][1].checked && !e['f13[]'][2].checked && !e['f13[]'][3].checked && !e['f13[]'][4].checked) {
            e['f13[]'][0].style.backgroundColor = 'yellow';
            e['f13[]'][0].focus();
            return false;
        }
        /*
        if (!e['f14[]'][0].checked && !e['f14[]'][1].checked && !e['f14[]'][2].checked &&
            !e['f14[]'][3].checked && !e['f14[]'][4].checked && !e['f14[]'][5].checked )
        {
            e['f14[]'][0].style.backgroundColor = 'yellow';
            e['f14[]'][0].focus();
            return false;
        }
*/
        re = /^(([0-2]?[0-9])|(3[01])).((0?[0-9])|(1[012])).[0-9]{4}/
        /*if (e['vyhlaska50_platnost'].value != '' && !re.test(e['vyhlaska50_platnost'].value)) {
                  e['vyhlaska50_platnost'].style.backgroundColor = 'yellow';
                  e['vyhlaska50_platnost'].focus();
                  alert(format_datumu);
                  return false;
        }
*/
        if (!e['f15[]'].checked && !e['f16[]'].checked ) {
            e['f15[]'].style.backgroundColor = 'yellow';
            e['f15[]'].focus();
            alert(absolvent);
            return false;
        }

        if (e['f16[]'].checked ) {
            if (e['f17_od'].value=='') {
                e['f17_od'].style.backgroundColor = 'yellow';
                e['f17_od'].focus();
                alert(datum_od);
                return false;
            }
            re = /^(([0-2]?[0-9])|(3[01])).((0?[0-9])|(1[012])).[0-9]{4}/
            if (e['f17_od'].value != '' && !re.test(e['f17_od'].value)) {
                      e['f17_od'].style.backgroundColor = 'yellow';
                      e['f17_od'].focus();
                      alert(format_datumu);
                      return false;
            }
            if(!e['jeste_pracuji_1'].checked)
              if (e['f17_do'].value=='') {
                  e['f17_do'].style.backgroundColor = 'yellow';
                  e['f17_do'].focus();
                  alert(datum_do);
                  return false;
              }
            
            re = /^(([0-2]?[0-9])|(3[01])).((0?[0-9])|(1[012])).[0-9]{4}/
            if (e['f17_do'].value != '' && !re.test(e['f17_do'].value)) {
                      e['f17_do'].style.backgroundColor = 'yellow';
                      e['f17_do'].focus();
                      alert(format_datumu);
                      return false;
            }
            
            if (e['f17[]'][0].value=='') {
                e['f17[]'][0].style.backgroundColor = 'yellow';
                e['f17[]'][0].focus();
                alert(spolecnost);
                return false;
            }
            if (e['f17[]'][1].value=='') {
                e['f17[]'][1].style.backgroundColor = 'yellow';
                e['f17[]'][1].focus();
                alert(pozice);
                return false;
            }
            if (e['f17[]'][2].value=='') {
                e['f17[]'][2].style.backgroundColor = 'yellow';
                e['f17[]'][2].focus();
                alert(napln);
                return false;
            }
            
            
            
        }
        
        re = /^(([0-2]?[0-9])|(3[01])).((0?[0-9])|(1[012])).[0-9]{4}/
            if (e['f18_od'].value != '' && !re.test(e['f18_od'].value)) {
                      e['f18_od'].style.backgroundColor = 'yellow';
                      e['f18_od'].focus();
                      alert(format_datumu);
                      return false;
        }
        
        re = /^(([0-2]?[0-9])|(3[01])).((0?[0-9])|(1[012])).[0-9]{4}/
            if (e['f18_do'].value != '' && !re.test(e['f18_do'].value)) {
                      e['f18_do'].style.backgroundColor = 'yellow';
                      e['f18_do'].focus();
                      alert(format_datumu);
                      return false;
        }
        
        if (e['f20[]'][0].value=='') {
            e['f20[]'][0].style.backgroundColor = 'yellow';
            alert(zivotopis);
            e['f20[]'][0].focus();
            return false;
        }else{
          // test zda ma dobrou priponu
          var soubor = e['f20[]'][0].value;
          var index = soubor.lastIndexOf(".");
          var pripona = soubor.substring(index+1,soubor.length);
          
          if(pripona == "doc" || pripona == "pdf" || pripona == "rtf" || pripona == "xls"){
            // ok
          }else{
            e['f20[]'][0].focus();
            alert(format);
            return false;
          }
          
          
        }
        
/*
        if (e['f20[]'][1].value=='') {
            e['f20[]'][1].style.backgroundColor = 'yellow';
            alert('Je třeba doplnit životopis');
            e['f20[]'][1].focus();
            return false;
        }
*/        
        if (e['f20[]'][0].value==e['f20[]'][1].value) {
            e['f20[]'][0].style.backgroundColor = 'yellow';
            e['f20[]'][1].style.backgroundColor = 'yellow';
            alert(stejny_zivotopis);
            e['f20[]'][0].focus();
            return false;
        }

        if (e['f21[]'][0].value=='') {
            e['f21[]'][0].style.backgroundColor = 'yellow';
            e['f21[]'][0].focus();
            alert(plat);
            return false;
        }

        if (!e['f21_1[]'][0].checked && !e['f21_1[]'][1].checked && !e['f21_1[]'][2].checked && !e['f21_1[]'][3].checked &&
             e['f21[]'][1].value=='')
        {
            e['f21_1[]'][0].style.backgroundColor = 'yellow';
            e['f21_1[]'][0].focus();
            alert(nastup);
            return false;
        }
        re = /^(([0-2]?[0-9])|(3[01])).((0?[0-9])|(1[012])).[0-9]{4}/
            if (e['f21[]'][1].value != '' && !re.test(e['f21[]'][1].value)) {
                      e['f21[]'][1].style.backgroundColor = 'yellow';
                      e['f21[]'][1].focus();
                      alert(format_datumu);
                      return false;
        }
        
/*
       if (!e['f22[]'][0].checked && !e['f22[]'][1].checked && !e['f22[]'][2].checked &&
            !e['f22[]'][3].checked && !e['f22[]'][4].checked && !e['f22[]'][5].checked &&
            !e['f22[]'][6].checked )
        {
            e['f22[]'][0].style.backgroundColor = 'yellow';
            e['f22[]'][0].focus();
            alert(dozvedeli);
            return false;
        }
        */
        if (!e['f23[]'].checked) {
            e['f23[]'].style.backgroundColor = 'yellow';
            e['f23[]'].focus();
            alert(souhlas);
            return false;
        }
        
        return true;
    }
    
    function  RegControl1( e ) {
        RegControlClearHelper( e );
/*
        re = /^[0-9]*$/;
        if (e['f06[]'][7].value!='' && !re.test(e['f06[]'][7].value)) {
            e['f06[]'][7].style.backgroundColor = 'yellow';
            e['f06[]'][7].focus();
            return false;
        }
  8?
        /*
  
        if (!e['f01[]'][0].checked && !e['f01[]'][1].checked && !e['f01[]'][2].checked) {
            e['f01[]'][0].style.backgroundColor = 'yellow';
            e['f01[]'][0].focus();
            return false;
        }
        
        if (!e['f02[]'][0].checked && !e['f02[]'][1].checked && !e['f02[]'][2].checked &&
            !e['f02[]'][3].checked && !e['f02[]'][4].checked && !e['f02[]'][5].checked &&
            !e['f03[]'][0].checked && !e['f03[]'][1].checked && !e['f03[]'][2].checked &&
            !e['f03[]'][3].checked && !e['f03[]'][4].checked && !e['f04[]'][0].checked &&
            !e['f04[]'][1].checked) {
            e['f02[]'][0].style.backgroundColor = 'yellow';
            e['f02[]'][0].focus();
            return false;
        }
        */
        if (e['f05[]'][0].value=='') {
            e['f05[]'][0].style.backgroundColor = 'yellow';
            e['f05[]'][0].focus();
            alert(jmeno);
            return false;
        }
        
        if (e['f05[]'][1].value=='') {
            e['f05[]'][1].style.backgroundColor = 'yellow';
            e['f05[]'][1].focus();
            alert(prijmeni);
            return false;
        }

        if (!e['f05[]'][2].checked && !e['f05[]'][3].checked) {
            e['f05[]'][2].style.backgroundColor = 'yellow';
            e['f05[]'][2].focus();
            alert(pohlavi);
            return false;
        }
        
        re = /^(([0-2]?[0-9])|(3[01])).((0?[0-9])|(1[012])).[0-9]{4}/
        if (e['f05[]'][4].value != '' &&!re.test(e['f05[]'][4].value)) {
            e['f05[]'][4].style.backgroundColor = 'yellow';
            e['f05[]'][4].focus();
            alert(format_datumu);
            return false;
        }
        re = /^[+]?[()/0-9. -]{9,}$/;
        if (!re.test(e['mobil'].value)) {
            e['mobil'].style.backgroundColor = 'yellow';
            e['mobil'].focus();
            alert(mobil);
            return false;
        }
        /*
        if (e['f06[]'][0].value=='') {
            e['f06[]'][0].style.backgroundColor = 'yellow';
            e['f06[]'][0].focus();
            return false;
        }
        */
        if (e['zeme'].value=='Česká republika') {
          if (e['kraj'].value=='') {
              e['kraj'].style.backgroundColor = 'yellow';
              e['kraj'].focus();
              alert(kraj);
              return false;
          }
        /*
          if (e['f06[]'][2].value=='') {
              e['f06[]'][2].style.backgroundColor = 'yellow';
              e['f06[]'][2].focus();
              alert(okres);
              return false;
          }
          
          */
        }
        
        if (e['ulice'].value=='') {
            e['ulice'].style.backgroundColor = 'yellow';
            e['ulice'].focus();
            alert(ulice);
            return false;
        }

        if (e['cislo'].value=='') {
            e['cislo'].style.backgroundColor = 'yellow';
            e['cislo'].focus();
            alert(cislo);
            return false;
        }

        if (e['mesto'].value=='') {
            e['mesto'].style.backgroundColor = 'yellow';
            e['mesto'].focus();
            alert(mesto);
            return false;
        }

        if (e['psc'].value=='') {
            e['psc'].style.backgroundColor = 'yellow';
            e['psc'].focus();
            alert(psc);
            return false;
        }
/*
        re = /^[+]?[()/0-9. -]{9,}$/;
        if (e['mobil'].value!='' && !re.test(e['mobil'].value)) {
            e['mobil'].style.backgroundColor = 'yellow';
            e['mobil'].focus();
            alert(mobil);
            return false;
        }
  */      
        
        
        re = /^[^.]+(\.[^.]+)*@([^.]+[.])+[a-z]{2,3}$/;
       /* if (!re.test(e['f06[]'][9].value)) {
            e['f06[]'][9].style.backgroundColor = 'yellow';
            e['f06[]'][9].focus();
            alert(email);
            return false;
        }*/

        if (e['f07[]'][0].value!='1'){
          // pokud jsem nevybral zakladni vzdelani musim validovat
          if (e['f07[]'][2].value=='') {
            e['f07[]'][2].style.backgroundColor = 'yellow';
            e['f07[]'][2].focus();
            alert(vzdelani);
            return false;
          }
          
          
        
        }
        if (!e['f07_1[]'][0].checked && !e['f07_1[]'][1].checked) {
              e['f07_1[]'][0].style.backgroundColor = 'yellow';
              e['f07_1[]'][0].focus();
              alert(studuji);
              return false;
          }
  
          if (e['f07_1[]'][0].checked) {
              if (e['f07_2[]'].value=='') {
                  e['f07_2[]'].style.backgroundColor = 'yellow';
                  e['f07_2[]'].focus();
                  alert(instituce);
                  return false;
              }
              if (e['f07_3'].value=='') {
                  e['f07_3'].style.backgroundColor = 'yellow';
                  e['f07_3'].focus();
                  alert(ukonceni_studia);
                  return false;
              }
              re = /^(([0-2]?[0-9])|(3[01])).((0?[0-9])|(1[012])).[0-9]{4}/
              if (!re.test(e['f07_3'].value)) {
                  e['f07_3'].style.backgroundColor = 'yellow';
                  e['f07_3'].focus();
                  alert(format_datumu);
                  return false;
              } 
              
          }
        
        /*if (!e['f08[]'][0].checked && !e['f08[]'][1].checked && !e['f08[]'][2].checked &&
            !e['f08[]'][3].checked && !e['f08[]'][4].checked && !e['f08[]'][5].checked &&
            e['f09[]'].value=='')
        {
            e['f08[]'][0].style.backgroundColor = 'yellow';
            e['f08[]'][0].focus();
            return false;
        }
        */
        
        if (!e['f10[]'][0].checked && !e['f10[]'][1].checked && !e['f10[]'][2].checked && !e['f10[]'][3].checked && !e['f10[]'][4].checked) {
            e['f10[]'][0].style.backgroundColor = 'yellow';
            e['f10[]'][0].focus();
            return false;
        }

        if (!e['f11[]'][0].checked && !e['f11[]'][1].checked && !e['f11[]'][2].checked && !e['f11[]'][3].checked && !e['f11[]'][4].checked) {
            e['f11[]'][0].style.backgroundColor = 'yellow';
            e['f11[]'][0].focus();
            return false;
        }
        /*
        if (!e['f12[]'][0].checked && !e['f12[]'][1].checked && !e['f12[]'][2].checked && !e['f12[]'][3].checked) {
            e['f12[]'][0].style.backgroundColor = 'yellow';
            e['f12[]'][0].focus();
            return false;
        }

        if (!e['f13[]'][0].checked && !e['f13[]'][1].checked && !e['f13[]'][2].checked && !e['f13[]'][3].checked) {
            e['f13[]'][0].style.backgroundColor = 'yellow';
            e['f13[]'][0].focus();
            return false;
        }
        */
        /*
        if (!e['f14[]'][0].checked && !e['f14[]'][1].checked && !e['f14[]'][2].checked &&
            !e['f14[]'][3].checked && !e['f14[]'][4].checked && !e['f14[]'][5].checked )
        {
            e['f14[]'][0].style.backgroundColor = 'yellow';
            e['f14[]'][0].focus();
            return false;
        }
*/
        re = /^(([0-2]?[0-9])|(3[01])).((0?[0-9])|(1[012])).[0-9]{4}/
       /* if (e['vyhlaska50_platnost'].value != '' && !re.test(e['vyhlaska50_platnost'].value)) {
                  e['vyhlaska50_platnost'].style.backgroundColor = 'yellow';
                  e['vyhlaska50_platnost'].focus();
                  alert(format_datumu);
                  return false;
        }
        
        re = /^(([0-2]?[0-9])|(3[01])).((0?[0-9])|(1[012])).[0-9]{4}/
        if (e['jerabnickyprukaz_platnost'].value != '' && !re.test(e['jerabnickyprukaz_platnost'].value)) {
                  e['jerabnickyprukaz_platnost'].style.backgroundColor = 'yellow';
                  e['jerabnickyprukaz_platnost'].focus();
                  alert(format_datumu);
                  return false;
        }

        re = /^(([0-2]?[0-9])|(3[01])).((0?[0-9])|(1[012])).[0-9]{4}/
        if (e['vazacskyprukaz_platnost'].value != '' && !re.test(e['vazacskyprukaz_platnost'].value)) {
                  e['vazacskyprukaz_platnost'].style.backgroundColor = 'yellow';
                  e['vazacskyprukaz_platnost'].focus();
                  alert(format_datumu);
                  return false;
        }

        re = /^(([0-2]?[0-9])|(3[01])).((0?[0-9])|(1[012])).[0-9]{4}/
        if (e['svarecskyprukaz_platnost'].value != '' && !re.test(e['svarecskyprukaz_platnost'].value)) {
                  e['svarecskyprukaz_platnost'].style.backgroundColor = 'yellow';
                  e['svarecskyprukaz_platnost'].focus();
                  alert(format_datumu);
                  return false;
        }

*/

        if (!e['f15[]'].checked && !e['f16[]'].checked ) {
            e['f15[]'].style.backgroundColor = 'yellow';
            e['f15[]'].focus();
            alert(absolvent);
            return false;
        }

        if (e['f16[]'].checked ) {
            if (e['f17_od'].value=='') {
                e['f17_od'].style.backgroundColor = 'yellow';
                e['f17_od'].focus();
                alert(datum_od);
                return false;
            }
            re = /^(([0-2]?[0-9])|(3[01])).((0?[0-9])|(1[012])).[0-9]{4}/
            if (e['f17_od'].value != '' && !re.test(e['f17_od'].value)) {
                      e['f17_od'].style.backgroundColor = 'yellow';
                      e['f17_od'].focus();
                      alert(format_datumu);
                      return false;
            } 
            if(!e['jeste_pracuji_1'].checked)
              if (e['f17_do'].value=='') {
                  e['f17_do'].style.backgroundColor = 'yellow';
                  e['f17_do'].focus();
                  alert(datum_do);
                  return false;
              }
            re = /^(([0-2]?[0-9])|(3[01])).((0?[0-9])|(1[012])).[0-9]{4}/
            if (e['f17_do'].value != '' && !re.test(e['f17_do'].value)) {
                      e['f17_do'].style.backgroundColor = 'yellow';
                      e['f17_do'].focus();
                      alert(format_datumu);
                      return false;
            }   
            if (e['f17[]'][0].value=='') {
                e['f17[]'][0].style.backgroundColor = 'yellow';
                e['f17[]'][0].focus();
                alert(spolecnost);
                return false;
            }
            if (e['f17[]'][1].value=='') {
                e['f17[]'][1].style.backgroundColor = 'yellow';
                e['f17[]'][1].focus();
                alert(pozice);
                return false;
            }
            if (e['f17[]'][2].value=='') {
                e['f17[]'][2].style.backgroundColor = 'yellow';
                e['f17[]'][2].focus();
                alert(napln);
                return false;
            }
            
            re = /^(([0-2]?[0-9])|(3[01])).((0?[0-9])|(1[012])).[0-9]{4}/
            if (e['f18_od'].value != '' && !re.test(e['f18_od'].value)) {
                      e['f18_od'].style.backgroundColor = 'yellow';
                      e['f18_od'].focus();
                      alert(format_datumu);
                      return false;
        }
        
        re = /^(([0-2]?[0-9])|(3[01])).((0?[0-9])|(1[012])).[0-9]{4}/
            if (e['f18_do'].value != '' && !re.test(e['f18_do'].value)) {
                      e['f18_do'].style.backgroundColor = 'yellow';
                      e['f18_do'].focus();
                      alert(format_datumu);
                      return false;
        }

        re = /^(([0-2]?[0-9])|(3[01])).((0?[0-9])|(1[012])).[0-9]{4}/
            if (e['f19_od'].value != '' && !re.test(e['f19_od'].value)) {
                      e['f19_od'].style.backgroundColor = 'yellow';
                      e['f19_od'].focus();
                      alert(format_datumu);
                      return false;
        }
        
        re = /^(([0-2]?[0-9])|(3[01])).((0?[0-9])|(1[012])).[0-9]{4}/
            if (e['f19_do'].value != '' && !re.test(e['f19_do'].value)) {
                      e['f19_do'].style.backgroundColor = 'yellow';
                      e['f19_do'].focus();
                      alert(format_datumu);
                      return false;
        }

            
            
        }
/*        
        if (e['f20[]'][0].value=='') {
            e['f20[]'][0].style.backgroundColor = 'yellow';
            alert(zivotopis);
            e['f20[]'][0].focus();
            return false;
        }else{
          // test zda ma dobrou priponu
          var soubor = e['f20[]'][0].value;
          var index = soubor.lastIndexOf(".");
          var pripona = soubor.substring(index+1,soubor.length);
          
          if(pripona == "doc" || pripona == "pdf" || pripona == "rtf" || pripona == "xls"){
            // ok
          }else{
            e['f20[]'][0].focus();
            alert(format);
            return false;
          }
          
          
        }

        if (e['f20[]'][1].value=='') {
            e['f20[]'][1].style.backgroundColor = 'yellow';
            alert('Je třeba doplnit životopis');
            e['f20[]'][1].focus();
            return false;
        }
        
        if (e['f20[]'][0].value==e['f20[]'][1].value) {
            e['f20[]'][0].style.backgroundColor = 'yellow';
            e['f20[]'][1].style.backgroundColor = 'yellow';
            alert(stejny_zivotopis);
            e['f20[]'][0].focus();
            return false;
        }
*/
        if (e['f21[]'][0].value=='') {
            e['f21[]'][0].style.backgroundColor = 'yellow';
            e['f21[]'][0].focus();
            alert(plat);
            return false;
        }

        if (!e['f21_1[]'][0].checked && !e['f21_1[]'][1].checked && !e['f21_1[]'][2].checked && !e['f21_1[]'][3].checked &&
             e['f21[]'][1].value=='')
        {
            e['f21_1[]'][0].style.backgroundColor = 'yellow';
            e['f21_1[]'][0].focus();
            alert(nastup);
            return false;
        }
        re = /^(([0-2]?[0-9])|(3[01])).((0?[0-9])|(1[012])).[0-9]{4}/
            if (e['f21[]'][1].value != '' && !re.test(e['f21[]'][1].value)) {
                      e['f21[]'][1].style.backgroundColor = 'yellow';
                      e['f21[]'][1].focus();
                      alert(format_datumu);
                      return false;
        } 
        
/*
        if (!e['f22[]'][0].checked && !e['f22[]'][1].checked && !e['f22[]'][2].checked &&
            !e['f22[]'][3].checked && !e['f22[]'][4].checked && !e['f22[]'][5].checked &&
            !e['f22[]'][6].checked )
        {
            e['f22[]'][0].style.backgroundColor = 'yellow';
            e['f22[]'][0].focus();
            alert(dozvedeli);
            return false;
        }
        */
        if (!e['f23[]'].checked) {
            e['f23[]'].style.backgroundColor = 'yellow';
            e['f23[]'].focus();
            alert(souhlas);
            return false;
        }
        
        return true;
    }
    
    function initRegControl() {
        document.forms[0].onsubmit = function() {
            return RegControl( this );
        }
    }

    function addLoadEvent( func ) {
        var oldonload = window.onload;
        if (typeof window.onload != 'function') {
            window.onload = func;
        } else {
            window.onload = function() {
                oldonload();
                func();
            }
        }
    }
    
 //   addLoadEvent(initRegControl);






