var VALIDA = {
	is_cpf: function(cpf){
      var c = cpf;
      if((c = c.replace(/[^\d]/g,"").split("")).length != 11) return false;
      if(new RegExp("^" + c[0] + "{11}$").test(c.join(""))) return false;
      for(var s = 10, n = 0, i = 0; s >= 2; n += c[i++] * s--);
      if(c[9] != (((n %= 11) < 2) ? 0 : 11 - n)) return false;
      for(var s = 11, n = 0, i = 0; s >= 2; n += c[i++] * s--);
      if(c[10] != (((n %= 11) < 2) ? 0 : 11 - n)) return false;
      return true;
  },

//----------------------------------------------------------------------------------------

	is_email: function(email){
      var filter  = /^[\w\-]+(\.[\w\-]+)*@(([A-Za-z\d][A-Za-z\d\-]{0,61}[A-Za-z\d]\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;
      return (filter.test(email)) ? true : false;
  },

//----------------------------------------------------------------------------------------

   is_cnpj: function(cnpj){
      var b = [6,5,4,3,2,9,8,7,6,5,4,3,2], c = cnpj;
      if((c = c.replace(/[^\d]/g,"").split("")).length != 14) return false;
      if(new RegExp("^" + c[0] + "{14}$").test(c.join(""))) return false;
      for(var i = 0, n = 0; i < 12; n += c[i] * b[++i]);
      if(c[12] != (((n %= 11) < 2) ? 0 : 11 - n)) return false;
      for(var i = 0, n = 0; i <= 12; n += c[i] * b[i++]);
      if(c[13] != (((n %= 11) < 2) ? 0 : 11 - n)) return false;
      return true;
  },
  
//----------------------------------------------------------------------------------------------      

   onlyNumbers: function(v){
      return v.replace(/[^\d]/g,"");
   },
  
//----------------------------------------------------------------------------------------------      

   onlyAlfa: function(v){
      return v.replace(/[^a-z-&. ]/gi,"");
   },
  
//----------------------------------------------------------------------------------------------      

   onlyAlfaNumbers: function(v){
      return v.replace(/[^\w-&. ]/gi,"");
   }
}
