function ajustes(valor){
	if ( valor == '1' ){
			limpaPJ();
		} else {
				if ( valor == '2' ){
					limpaPF();					
				}
		  }
}

function limpaPF(){
	
	var cpf = document.getElementById("cpf"); 
	cpf.setAttribute("obrigatorio", "0");
	cpf.value = "";
	document.getElementById("cpf2").className = 'invisivel';

	/* ==================================== AJUSTES PARA PJ ==================================== */
	document.getElementById("label_pf_pj").innerHTML = 'Razão Social';
	document.getElementById("label_pj_pf").innerHTML = 'Dados da Empresa';
	var razao_social = document.getElementById("razao_social"); 
	razao_social.setAttribute("obrigatorio", "1");
	razao_social.value = "";
	razao_social.setAttribute("hint", "Campo > Razão Social < Requerido");
	razao_social.setAttribute("display", "Razão Social");
	razao_social.setAttribute("title", "Razão Social");

	var cnpj = document.getElementById("cnpj"); 
	cnpj.setAttribute("obrigatorio", "1");
	cnpj.value = "";
	document.getElementById("cnpj2").className = 'visivel';

	var nome_fantasia = document.getElementById("nome_fantasia"); 
	nome_fantasia.setAttribute("obrigatorio", "0");
	nome_fantasia.value = "";
	document.getElementById("nome_fantasia2").className = 'visivel';

	var cnae = document.getElementById("cnae"); 
	cnae.setAttribute("obrigatorio", "0");
	cnae.value = "";
	document.getElementById("cnae2").className = 'visivel';

	var qtd_funcionarios = document.getElementById("qtd_funcionarios"); 
	qtd_funcionarios.setAttribute("obrigatorio", "1");
	qtd_funcionarios.value = "";
	document.getElementById("qtd_funcionarios2").className = 'visivel';
	
	document.getElementById("cnae2_qtd_funcionarios2").className = 'visivel';	
	
	var data_fundacao = document.getElementById("data_fundacao"); 
	data_fundacao.setAttribute("obrigatorio", "1");
	data_fundacao.value = "";
	document.getElementById("data_fundacao2").className = 'visivel';

	/* contato */	
	var nome_contato = document.getElementById("nome_contato"); 
	nome_contato.setAttribute("obrigatorio", "1");
	nome_contato.value = "";
	var email_contato = document.getElementById("email_contato"); 
	email_contato.setAttribute("obrigatorio", "1");
	email_contato.value = "";
	var telefone_contato = document.getElementById("telefone_contato"); 
	telefone_contato.setAttribute("obrigatorio", "1");
	telefone_contato.value = "";
	var setor_contato = document.getElementById("setor_contato"); 
	setor_contato.setAttribute("obrigatorio", "0");
	setor_contato.value = "";
	document.getElementById("contato_pj").className = 'visivel';
	/* contato */	
	/* ==================================== AJUSTES PARA PJ ==================================== */	
	
}//fim limpaPF

function limpaPJ(){
	var cnpj = document.getElementById("cnpj"); 
	cnpj.setAttribute("obrigatorio", "0");
	cnpj.value = "";
	document.getElementById("cnpj2").className = 'invisivel';
	
	var nome_fantasia = document.getElementById("nome_fantasia"); 
	nome_fantasia.setAttribute("obrigatorio", "0");
	nome_fantasia.value = "";
	document.getElementById("nome_fantasia2").className = 'invisivel';

	var cnae = document.getElementById("cnae"); 
	cnae.setAttribute("obrigatorio", "0");
	cnae.value = "";
	document.getElementById("cnae2").className = 'invisivel';

	var qtd_funcionarios = document.getElementById("qtd_funcionarios"); 
	qtd_funcionarios.setAttribute("obrigatorio", "0");
	qtd_funcionarios.value = "";
	document.getElementById("qtd_funcionarios2").className = 'invisivel';

	document.getElementById("cnae2_qtd_funcionarios2").className = 'invisivel';	

	var data_fundacao = document.getElementById("data_fundacao"); 
	data_fundacao.setAttribute("obrigatorio", "0");
	data_fundacao.value = "";
	document.getElementById("data_fundacao2").className = 'invisivel';

	/* contato */	
	var nome_contato = document.getElementById("nome_contato"); 
	nome_contato.setAttribute("obrigatorio", "0");
	nome_contato.value = "";
	var email_contato = document.getElementById("email_contato"); 
	email_contato.setAttribute("obrigatorio", "0");
	email_contato.value = "";
	var telefone_contato = document.getElementById("telefone_contato"); 
	telefone_contato.setAttribute("obrigatorio", "0");
	telefone_contato.value = "";
	var setor_contato = document.getElementById("setor_contato"); 
	setor_contato.setAttribute("obrigatorio", "0");
	setor_contato.value = "";
	document.getElementById("contato_pj").className = 'invisivel';
	/* contato */
	
	/* ==================================== AJUSTES PARA PF ==================================== */
	document.getElementById("label_pf_pj").innerHTML = 'Nome';
	document.getElementById("label_pj_pf").innerHTML = 'Dados Pessoais';
	var razao_social = document.getElementById("razao_social"); 
	razao_social.setAttribute("obrigatorio", "1");
	razao_social.value = "";
	razao_social.setAttribute("hint", "Campo > Nome < Requerido");
	razao_social.setAttribute("display", "Nome");
	razao_social.setAttribute("title", "Nome");
	
	var cpf = document.getElementById("cpf"); 
	cpf.setAttribute("obrigatorio", "1");
	cpf.value = "";
	document.getElementById("cpf2").className = 'visivel';
	/* ==================================== AJUSTES PARA PF ==================================== */

}

function valida( form ){

	if ( fnc_verifica_form( form ) ){

		if ( form.arquivo ){
			var tal = form.arquivo.value;
			if ( tal != '' ){
				var tal2 = tal.substring(tal.length-3, tal.length);
				if (!(tal2 == 'jpg' || tal2 == 'JPG' || tal2 == 'jpeg' || tal2 == 'JPEG' )){
				   alert('Requerido arquivo no formato JPG no campo > Arquivo <');
				   form.arquivo.focus();
				   return( false );    
				}
			}
		}

		if ( !form.termo_uso.checked ){
			alert("Para prosseguir é necessário concordar com o Termo de Aceitação.");
			return false;	
		}
		return true;
		
	}  else { return false; }
	
}

