function validarCpf(campo)
{
	var num_cpf = campo.value;

	num_cpf = num_cpf.toString().replace( "-", "" );
	num_cpf = num_cpf.toString().replace( "-", "" );
	num_cpf = num_cpf.toString().replace( ".", "" );
	num_cpf = num_cpf.toString().replace( ".", "" );
	num_cpf = num_cpf.toString().replace( "/", "" );
	num_cpf = num_cpf.toString().replace( "/", "" );
	num_cpf = num_cpf.toString().replace( "(", "" );
	num_cpf = num_cpf.toString().replace( "(", "" );
	num_cpf = num_cpf.toString().replace( ")", "" );
	num_cpf = num_cpf.toString().replace( ")", "" );
	num_cpf = num_cpf.toString().replace( " ", "" );
	num_cpf = num_cpf.toString().replace( " ", "" );

	if (num_cpf == null)
	{
		return false; 
	}
	if ((num_cpf.length != 11)&&(num_cpf != ""))
	{
		alert('CPF inválido!');
		//campo.focus();
		return false; 
	}
	for (i=0;i<num_cpf.length;i++)
	{
		if (!((num_cpf.substring(i,i+1) >= '0') && (num_cpf.substring(i,i+1) <= '9')))
		{
			alert('CPF inválido!');
			//campo.focus();
			return false; 
		}
	}

	num_cpf_dv=num_cpf.substring(9,11);
	num_cpf = num_cpf.substring(0,9);
	
	for (k=1;k<3;k++)
	{
		soma = 0;
		multi = 1;
		for (i=num_cpf.length-1;i>=0;i--)
		{
			multi++;
			soma += (parseInt(num_cpf.substring(i,i+1),10) * multi); 
		}
		
		resto = (soma % 11);
		dv =0;
		if (resto > 1)
		{
			dv= 11 - resto;
		}
		
		num_cpf +=dv; 
	}
	
	if (num_cpf_dv == num_cpf.substring(9,11))
		return 1; 
	else
	{
		alert('CPF inválido!');
		//campo.focus();
		return false; 
	}

}