function checacampo1() {
	with(document.fichacadastro) {	
	       if (razao.value == "") {
			alert("Por favor, digite a razão social!");
			razao.focus();
			return false;}
		   if (nome.value == "") {
			alert("Por favor, digite o nome fantasia!");
			nome.focus();
			return false;}
			if (ramo.value == "") {
			alert("Por favor, digite o ramo de atividade!");
			ramo.focus();
			return false;}
			if (CNPJ.value == "") {
			alert("Por favor, digite o CNPJ!");
			CNPJ.focus();
			return false;}
			if (inscricao.value == "") {
			alert("Por favor, digite a inscrição Estadual!");
			inscricao.focus();
			return false;}
			if (endereco.value == "") {
			alert("Por favor, digite seu endereco!");
			endereco.focus();
			return false;}
			if (bairro.value == "") {
			alert("Por favor, digite o seu bairro!");
			bairro.focus();
			return false;}
			if (cidade.value == "") {
			alert("Por favor, digite sua cidade!");
			cidade.focus();
			return false;}
			if (cepc.value == "") {
			alert("Por favor, digite seu Cep!");
			cepc.focus();
			return false;}
			if (cepd.value == "") {
			alert("Por favor, digite seu Cep!");
			cepd.focus();
			return false;}
			if (DDD.value == "") {
			alert("Por favor, digite o DDD!");
			DDD.focus();
			return false;}
			if (telefone.value == "") {
			alert("Por favor, digite seu telefone!");
			telefone.focus();
			return false;}
			if (representante.value == "") {
			alert("Por favor, digite o representante!");
			representante.focus();
			return false;}
			if (CPF.value == "") {
			alert("Por favor, digite o CPF!");
			CPF.focus();
			return false;}
			if (RG.value == "") {
			alert("Por favor, digite o RG!");
			RG.focus();
			return false;}
			if (nascimento.value == "") {
			alert("Por favor, digite o nascimento!");
			nascimento.focus();
			return false;}
			if (representante.value == "") {
			alert("Por favor, digite o representante!");
			representante.focus();
			return false;}
			if (email.value == "") {
			alert("Por favor, digite um endereço de email válido!");
			email.focus();
			return false;}
            if (mensagem.value == "") {
			alert("Por favor, digite a mensagem!");
			mensagem.focus();
			return false;
			}
            submit();
	}
}	


function limpa_string(S){
 // Deixa so' os digitos no numero
 var Digitos = "0123456789";
 var temp = "";
 var digito = "";

 for (var i=0; i<S.length; i++) {
  digito = S.charAt(i);
  if (Digitos.indexOf(digito)>=0) {
   temp=temp+digito }
 } //for

 return temp
}
// fim da funcao

function valida_CGC(s)
{
 var i;
 s = limpa_string(s);
 var c = s.substr(0,12);
 var dv = s.substr(12,2);
 var d1 = 0;
 for (i = 0; i < 12; i++)
 {
  d1 += c.charAt(11-i)*(2+(i % 8));
 }
        if (d1 == 0) return false;
        d1 = 11 - (d1 % 11);
 if (d1 > 9) d1 = 0;
 if (dv.charAt(0) != d1)
 {
  return false;
 }

 d1 *= 2;
 for (i = 0; i < 12; i++)
 {
  d1 += c.charAt(11-i)*(2+((i+1) % 8));
 }
 d1 = 11 - (d1 % 11);
 if (d1 > 9) d1 = 0;
 if (dv.charAt(1) != d1)
 {
  return false;
 }
 return true;
}

