function classValidaterForm(f){  
  var self = this;
	self.oAuto = new Array();
	self.capa = null;
	// variable del formulario
	self.f = f;
	// indice del formulario	
	self.noStyle = "";
	// nombre del estilo cuando el campo este enfocado --NO IMPLEMENTADO AUN
	self.focusElementStyle = "bordeazul";
	// nombre del estilo cuando cuando el elemento haga blur --NO IMPLEMENTADO AUN
	self.BlurElementStyle = "bordeazul";
	//** PARA EL MANEJO DE ERRORES **//
	self.focusElement = null;
    // nombre del atributo que se va a utilizar para el manejo de errores
	self.vattribute = "vtipo";
	// nombre del estilo del campo cuando se detecte un error
	self.ErrorStyle = "borderojo";
	// velocidad del parpadeo
	self.timeouterror = 500;
	// objeto que se va a utilizar para los campos en el evento onkeyup, ej. cuando solo sean numeros
	self.DoCaseChange = new Array();
	// campo en el que se detecto el error
	self.errorField = null;
	// esta variable en true muestra un tooltip cuando se detecta el error, caso contrario en un alert, en la funcion self.Alert()
	self.showerrortool = false;
	// secuencia de parpadeo deseado, para crear una nueva utilizar la funcion self.BlinkErrorSeq()
	self.errorSeq = [self.ErrorStyle,self.noStyle,self.ErrorStyle,self.noStyle,self.ErrorStyle,self.noStyle];
	// posicion de parpadeo en el array errorSeq
	self.errorIndex = 0;
	// capa de tooltip
	self.tooldiv = null;
	// capa del puntero del tooltip
	self.tooldivpointer = null;
	// checkbox a validar
	self._ckgroup = new Array();
	//intervalo en blink
	self.intervalo = null;	
	//functión para validar...
  self.enviar = true; 
	
  self.validate = function(){
    self.enviar = true; 
		if(self.intervalo != null){
			clearInterval(self.intervalo);
			self.errorIndex = 0;
		}
		_checkbox = new Array();
		_radio = new Array();
		_rdlastname = "";
		_cklastname = "";
		self.CleanStyles();
		for(var i =0; i < self.f.elements.length; i++){
			
			campo = self.f.elements[i];
			//campo.className = self.noStyle;
			attr = self.getFieldAttribute(campo);
			isvalid = true;
			if(!campo.type)continue;
			
			if(campo.type.toLowerCase() == "radio" || campo.type.toLowerCase() == "checkbox"){
				if(_rdlastname != campo.name && attr){
				    if(attr.toLowerCase().indexOf("selected")==0){
					    _radio[_radio.length] = campo.name;
					}
			  }
				_rdlastname = campo.name;
			}
			if(attr == null)continue;
			switch(attr){
				case "email":
					is_valid = self.ValidateEMail(campo.value);					
					self.divError(campo,is_valid);          
          if(!is_valid){        
             self.enviar = false;
              
              /*
              self.Alert("Correo electrónico no valido",campo);						
						  campo.select();
						  campo.focus();
					    self.SetErrorStyle(campo);
              */					
                   	
            						
					}
				break;
				case "rfc":
					is_valid = self.ValidateRFC(campo.value);
					self.divError(campo,is_valid);
					if(!is_valid){
						self.enviar = false;            
					}
				break;
				default:
				  self.divError(campo,true); 
					if(attr.indexOf("list") == 0){
						var nums = 1;
						opciones = campo.options.length;
						if(attr.indexOf("list_") > -1){
							separa = attr.split("_");
							nums = Number(separa[1]);
							if(nums < 1)nums = 1;
						}
						if(nums > opciones)nums = opciones;
						csel = 0;
						for(var op=0;op<opciones;op++){
							if(campo.options[op].selected == true)csel++;
							if(csel == opciones)break;
							
						}
						if(csel < nums){
							
              self.enviar = false;
              self.divError(campo,false); 
              /*
              self.Alert("Favor de seleccionar " + nums + " elementos de la lista",campo);
							campo.focus();
							self.SetErrorStyle(campo);
							return false;
							*/
						}
					}
					else if(attr.indexOf("text") == 0){
						var nums = 1;
						if(attr.indexOf("text_") > -1){
							separa = attr.split("_");
							nums = Number(separa[1]);
							if(nums < 1)nums = 1;
						}
						if(campo.value.length < nums){
							/*
              self.Alert("Este campo debe tener al menos "+nums+" caracteres",campo);
							campo.focus();
							self.SetErrorStyle(campo);
							return false;
							*/
							self.enviar = false;
              self.divError(campo,false); 
							
						}
						
					}
					else if(attr.indexOf("numero") == 0){
						var nums = 1;
						if(attr.indexOf("numero_") > -1){
							separa = attr.split("_");
							nums = Number(separa[1]);
							if(nums < 1)nums = 1;
						}
						if(campo.value.length < nums){
							/*
              self.Alert("Este campo debe tener al menos "+nums+" numeros",campo);
							campo.focus();
							self.SetErrorStyle(campo);
							return false;
							*/
							self.enviar = false;
              self.divError(campo,false);
              
						}else if(!self.ValidateNumber(campo.value)){
						  /*
              self.Alert("Este campo solo acepta numeros",campo);
							campo.focus();
							self.SetErrorStyle(campo);
							return false;
							*/
							self.enviar = false;
              self.divError(campo,false);
						}
						
					}
				break;
			}
			

		}
		
    for(var rd=0;rd < _radio.length; rd++){
		    var rdgp = self.f[_radio[rd]];
		    var vr = "";
		    var scount = 0;
		    for(var n=0;n<rdgp.length;n++){
		        var rdItem = rdgp[n];
		        if(rdItem.checked){
		            scount++;
		        }
		        if(vr=="" && rdItem.getAttribute("vtipo")!=""){
		            vr = rdItem.getAttribute("vtipo"); 
		        }
		    }
		    if(vr != ""){
		        if(vr.indexOf("selected") == 0){
						var nums = 1;
						if(vr.indexOf("selected_") > -1){
							separa = vr.split("_");
							nums = Number(separa[1]);
							if(nums < 1)nums = 1;
						}
						if(scount < nums){
							/*
              self.Alert("Este elemento debe tener al menos "+nums+" elementos seleccionados",rdgp[0]);
							return false;
							*/
							self.enviar = false;
              self.divError(_radio,false);
						}
			    }
		    }
		}
		return self.enviar;
    //self.isValidationOk();
	}
	self.CleanStyles = function(){
		for(var i =0; i < self.f.elements.length; i++){
			campo = self.f.elements[i];
			campo.className = self.noStyle;
		}
	}
	self.in_array = function(arreglo,palabra){
		if(arreglo == null || arreglo == undefined || arreglo.length < 1)return false;
		for(var ia = 0; ia<arreglo.length; ia++){
			if(palabra.toLowerCase().indexOf(arreglo[ia].toLowerCase()) > -1){
					return true;
			}
		}
			return false;
	}
	self.ValidateEMail = function(texto){
		regExpr = texto.match(/^[\w._-]{2,}@[\w._-]{2,}\.[\w_-]{2,4}$/);
		if(!regExpr){
			return false;		   
		}
		return true;
	}
	self.ValidateNumber = function(texto){
	    regExpr = texto.match(/^[0-9]{2,}$/);
		if(!regExpr){
			return false;		   
		}
		return true;
	}
	self.ValidateRFC = function(texto){
		rfc = texto;
		if(rfc.length == 10){
			if(!rfc.match(/^[a-zA-Z]{4}[\d]{6}$/)){
				return false;
			}else return true;
		}
		else if(rfc.length == 13){
			if(!rfc.match(/^[A-Z]{4}[\d]{6}[A-Z0-9]{3}$/)){
				return false;
			}else return true;
		}
		else{
			return false;
		}	
	}
	self.getFieldAttribute = function(formField){
		attr = null;
		try{
			attr = formField.getAttribute(self.vattribute);
		}catch(ex){}
		return attr;
	}
	self.CleanEndBeginSpace = function(campo){
		texto = campo.value;
		texto = texto.replace(/^\s+/g, "");
		texto = texto.replace(/\s+$/g, "");
		texto = texto.replace(/\s{2,}/gi," ");
		
	}
	self.CleanField = function(campo){
		texto = campo.value;
		texto = texto.replace(/^\s+/g, "");
		texto = texto.replace(/\s+$/g, "");
		texto = texto.replace(/<\/?[^>]*>/gi,"");
		texto = texto.replace(/\s{2,}/gi," ");
		return texto;
	}
	self.Alert = function(texto,obj){
		if(obj != null && obj != undefined && self.showerrortool){
			try{
				self.Show(obj,texto);
			}catch(ex){
				alert(texto);
			}
		}else{
			alert(texto);
		}
	}
	self.divError = function(obj,flag){
    div = document.getElementById(obj.name+"_helpSpan");
    if(flag){      
      div.style.display = "none";
    }else{      
      div.style.display = "block";
    }
    return flag;
  } 
	
	
}