function bloqueia(){
	if (document.frm2.pessoa[0].checked==true){
		//Dados Pessoa Física
		document.all.nome.style.background="white";
		document.frm2.nome.disabled=false;
		document.all.sobrenome.style.background="white";
		document.frm2.sobrenome.disabled=false;
		document.all.cpf.style.background="white";
		document.frm2.cpf.disabled=false;
		//Dados Pessoa Jurídica
		document.all.razao.style.background="silver";
		document.frm2.razao.disabled=true;
		document.all.fantasia.style.background="silver";
		document.frm2.fantasia.disabled=true;
		document.all.contato.style.background="silver";
		document.frm2.contato.disabled=true;
		document.all.cnpj.style.background="silver";
		document.frm2.cnpj.disabled=true;
		document.all.ie.style.background="silver";
		document.frm2.ie.disabled=true;
		document.all.isento.style.background="silver";
		document.frm2.isento.disabled=true;
	}else{
		//Dados Pessoa Fisica
		document.all.nome.style.background="silver";
		document.frm2.nome.disabled=true;
		document.all.sobrenome.style.background="silver";
		document.frm2.sobrenome.disabled=true;
		document.all.cpf.style.background="silver";
		document.frm2.cpf.disabled=true;
		//Dados Pessoa Jurídica
		document.all.razao.style.background="white";
		document.frm2.razao.disabled=false;
		document.all.fantasia.style.background="white";
		document.frm2.fantasia.disabled=false;
		document.all.contato.style.background="white";
		document.frm2.contato.disabled=false;
		document.all.cnpj.style.background="white";
		document.frm2.cnpj.disabled=false;
		document.all.ie.style.background="white";
		document.frm2.ie.disabled=false;
		document.all.isento.style.background="f7f7f7";
		document.frm2.isento.disabled=false;
		func_isento(); //Verifica se o flag de isento está clicado
	}
}
function func_isento(){
	if (document.frm2.isento.checked==true){
		document.all.ie.style.background="silver";
		document.frm2.ie.disabled=true;
	}else{
		document.all.ie.style.background="white";
		document.frm2.ie.disabled=false;
	}
}
function verifica(cad){
	if(cad.pessoa[0].checked){
		if(cad.nome.value==''){
			alert('O campo Nome é obrigatório');
			cad.nome.focus();
			return false;
		}
		if(cad.sobrenome.value==''){
			alert('O campo Sobrenome é obrigatório');
			cad.sobrenome.focus();
			return false;
		}		
		if(cad.cpf.value==''){
			alert('O campo CPF é obrigatório');
			cad.cpf.focus();
			return false;
		}
	}else{
		if(cad.razao.value==''){
			alert('O campo Razão Social é obrigatório');
			cad.razao.focus();
			return false;
		}
		if(cad.fantasia.value==''){
			alert('O campo Nome Fantasia é obrigatório');
			cad.fantasia.focus();
			return false;
		}		
		if(cad.contato.value==''){
			alert('O campo Nome de Contato é obrigatório');
			cad.contato.focus();
			return false;
		}
		if(cad.cnpj.value==''){
			alert('O campo CNPJ é obrigatório');
			cad.cnpj.focus();
			return false;
		}
		if(!cad.isento.checked){
			if(cad.ie.value==''){
				alert('O campo IE é obrigatório');
				cad.ie.focus();
				return false;
			}
		}
	}
	//campos comuns
	if(cad.email.value==''){
		alert('O campo Email é obrigatório');
		cad.email.focus();
		return false;
	}else{
		if(!verifica_email(cad.email.value)){
			alert('Email inválido');
			cad.email.focus();
			return false;
		}
	}
	if(cad.endereco.value==''){
		alert('O campo Endereço é obrigatório');
		cad.endereco.focus();
		return false;
	}
	if(cad.bairro.value==''){
		alert('O campo Bairro é obrigatório');
		cad.bairro.focus();
		return false;
	}
	if(cad.cidade.value==''){
		alert('O campo Cidade é obrigatório');
		cad.cidade.focus();
		return false;
	}
	if(cad.cep.value==''){
		alert('O campo CEP é obrigatório');
		cad.cep.focus();
		return false;		
	}else{
		if(!verifica_cep(cad.cep.value)){
			alert('CEP inválido');
			cad.cep.focus();
			return false;
		}
	}
	if(cad.fone1.value==''){
		alert('O campo Fone1 é obrigatório');
		cad.fone1.focus();
		return false;
	}
	return true;
}