testFormularza={
  rodzajePol:{
    niepuste:[/.+/,'Prosze wypelnic pole'],
    email:[/^[\w\.-]{2,}@[\w\.-]+\.[a-z]{2,5}$/,'Prosze podc prawidlowy adres e-mail'],
    liczbacalkowita:[/^\d+$/,'Prawidłową wartością tego pola jest liczba całkowita'],
    kodpocztowy:[/^\d{2}\-\d{3}$/,'Proszę podać kod pocztowy np. 06-600'],
    nospam:[/^nospam$/,'Proszę wpisać słowo nospam.']
  },
  testuj:function(f){
	  
    var i,rodz,E;

    for(i=0;i<f.elements.length;i++){

      E=f.elements[i];

      if(rodz=this.rodzajePol[E.getAttribute('rodzajpola')]){
		    if(E.type=='radio'){
				var sel = true;
				for(var j=0; j<f[E.name].length; j++){
					f[E.name][j].checked?sel=false:true;
				}
				if(sel){
					E.focus();
					alert((E.getAttribute('komunikat')||"Proszę zaznaczyć opcję"));
					return false;
					};
			}else if(E.type=='select-one' && E.selectedIndex==0){
				  E.focus();
				  //E.select();
				  alert((E.getAttribute('komunikat')||"Proszę wybrać z listy")); 
				  return false;  
			}else{
				if(!rodz[0].test(E.value)){
				  E.focus();
				  E.select();
				  alert((E.getAttribute('komunikat')||rodz[1])); 
				  return false;          
				}
			}
	  }
    }
    return true;
  }
}
