document.write("<SCR" + "IPT LANGUAGE='JavaScript1.2' SRC='../../include/trim.js' TYPE='text/javascript'><\/SCR" + "IPT>");
function ValidaCNPJ( cnpj )
{
	trim(cnpj);
	var wcnpj = cnpj.value;

	if ( (wcnpj != "") )
	{
		if( isNaN(wcnpj) )
   		{
			alert( "CNPJ deve ser numérico" ); 
    		cnpj.focus();
      		cnpj.select();
      		return false;
   		}
		if( (wcnpj.indexOf(".") >= 0) || (wcnpj.indexOf("+") >= 0) || (wcnpj.indexOf("-") >= 0)) 
		{
		alert("CNPJ apresenta caracteres inválidos"); 
		cnpj.focus();
		cnpj.select(); 
		return false; 
		}

		if( (cnpj.value.length < 14) )
   		{
			alert( "CNPJ deve conter 14 digitos" ); 
    		cnpj.focus();
      		cnpj.select();
      		return false;
    	}
	}	
	return true;	
}

