function getVersaoCDCCadastroPF2JS() {
	return "1.0";
}

function validaForm() {
	var aux		= null;
	var retorno = true;
	
	var nome	= "cdc_cli_nome_razao";
	if (((aux = document.getElementById(nome)) != null) && (aux.value == "")) {
		retorno = false;
		document.getElementById("td_" + nome).style.backgroundColor = COR_ALERTA;
	} else {
		document.getElementById("td_" + nome).style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
	}

	nome	= "cdc_cli_rg";
	if (((aux = document.getElementById(nome)) != null) && (aux.value == "")) {
		retorno = false;
		document.getElementById("td_" + nome).style.backgroundColor = COR_ALERTA;
	} else {
		document.getElementById("td_" + nome).style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
	}

	nome	= "cdc_cli_rg_orgao";
	if (((aux = document.getElementById(nome)) != null) && (aux.value == "")) {
		retorno = false;
		document.getElementById("td_" + nome).style.backgroundColor = COR_ALERTA;
	} else {
		document.getElementById("td_" + nome).style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
	}

	nome	= "cdc_cli_rg_emissao_uf";
	if (((aux = document.getElementById(nome)) != null) && (aux.value == "-1")) {
		retorno = false;
		document.getElementById("td_" + nome).style.backgroundColor = COR_ALERTA;
	} else {
		document.getElementById("td_" + nome).style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
	}

	nome	= "cdc_cli_end_logradouro_tipo";
	if (((aux = document.getElementById(nome)) != null) && (aux.value == "-1")) {
		retorno = false;
		document.getElementById("td_" + nome).style.backgroundColor = COR_ALERTA;
	} else {
		document.getElementById("td_" + nome).style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
	}

	nome	= "cdc_cli_end_logradouro";
	if (((aux = document.getElementById(nome)) != null) && (aux.value == "")) {
		retorno = false;
		document.getElementById("td_" + nome).style.backgroundColor = COR_ALERTA;
	} else {
		document.getElementById("td_" + nome).style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
	}

	nome	= "cdc_cli_end_numero";
	if (((aux = document.getElementById(nome)) != null) && (aux.value == "")) {
		retorno = false;
		document.getElementById("td_" + nome).style.backgroundColor = COR_ALERTA;
	} else {
		document.getElementById("td_" + nome).style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
	}

	nome	= "cdc_cli_end_bairro";
	if (((aux = document.getElementById(nome)) != null) && (aux.value == "")) {
		retorno = false;
		document.getElementById("td_" + nome).style.backgroundColor = COR_ALERTA;
	} else {
		document.getElementById("td_" + nome).style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
	}

	nome	= "cdc_cli_end_cidade";
	if (((aux = document.getElementById(nome)) != null) && (aux.value == "")) {
		retorno = false;
		document.getElementById("td_" + nome).style.backgroundColor = COR_ALERTA;
	} else {
		document.getElementById("td_" + nome).style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
	}

	nome	= "cdc_cli_end_uf";
	if (((aux = document.getElementById(nome)) != null) && (aux.value == "-1")) {
		retorno = false;
		document.getElementById("td_" + nome).style.backgroundColor = COR_ALERTA;
	} else {
		document.getElementById("td_" + nome).style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
	}

	nome	= "cdc_cli_prf_cargo";
	if (((aux = document.getElementById(nome)) != null) && (aux.value == "")) {
//		retorno = false;
		document.getElementById("td_" + nome).style.backgroundColor = COR_ALERTA;
	} else {
		document.getElementById("td_" + nome).style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
	}

	nome	= "cdc_cli_prf_empresa_nome";
	if (((aux = document.getElementById(nome)) != null) && (aux.value == "")) {
		retorno = false;
		document.getElementById("td_" + nome).style.backgroundColor = COR_ALERTA;
	} else {
		document.getElementById("td_" + nome).style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
	}
	
	//Danilo Sandim - 13/11/2008 - solicitação = 43141
/*	nome = "cdc_cli_fone_com_ddd";
	if (((aux = document.getElementById(nome)) != null) && (aux.value == "")) {
		retorno = false;
		document.getElementById("cdc_tel_com").style.backgroundColor = COR_ALERTA;
	} else {
		document.getElementById("cdc_tel_com").style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
	}
	
	nome = "cdc_cli_fone_com_numero";
	if (((aux = document.getElementById(nome)) != null) && (aux.value == "")) {
		retorno = false;
		document.getElementById("cdc_tel_com").style.backgroundColor = COR_ALERTA;
	} else {
		document.getElementById("cdc_tel_com").style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
	}
*/	
	//--------------------------------------------------------
	
	nome	= "cdc_bco1_codigo";
	if ((aux = document.getElementById(nome)) != null) {
		if (aux.value == "-1") {
			retorno = false;
			document.getElementById("td_" + nome).style.backgroundColor = COR_ALERTA;
		} else {
			document.getElementById("td_" + nome).style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
		}
	}
	
	nome	= "cdc_bco1_agencia";
	if ((aux = document.getElementById(nome)) != null) {
		if (aux.value == "") {
			retorno = false;
			document.getElementById("td_" + nome).style.backgroundColor = COR_ALERTA;
		} else {
			document.getElementById("td_" + nome).style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
		}
	}
	
/*	
	nome	= "cdc_bco1_agencia_dv";
	if ((aux = document.getElementById(nome)) != null) {
		if (aux.value == "") {
			document.getElementById("td_" + nome).style.backgroundColor = COR_ALERTA;
		} else {
			document.getElementById("td_" + nome).style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
		}
	}
*/
	nome	= "cdc_bco1_conta";
	if ((aux = document.getElementById(nome)) != null) {
		if (aux.value == "") {
			retorno = false;
			document.getElementById("td_" + nome).style.backgroundColor = COR_ALERTA;
		} else {
			document.getElementById("td_" + nome).style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
		}
	}
	
	nome	= "cdc_cli_sexo";
	if ((aux = document.getElementById(nome)) != null) {
		if (aux.value == "-1") {
			retorno = false;
			document.getElementById("td_" + nome).style.backgroundColor = COR_ALERTA;
		} else {
			document.getElementById("td_" + nome).style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
		}
	}
	
	nome	= "cdc_cli_estado_civil";
	if ((aux = document.getElementById(nome)) != null) {
		if (aux.value == "-1") {
			retorno = false;
			document.getElementById("td_" + nome).style.backgroundColor = COR_ALERTA;
		} else {
			document.getElementById("td_" + nome).style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
		}
	}
	
	nome	= "cdc_cli_profissao";
	if ((aux = document.getElementById(nome)) != null) {
		if (aux.value == "-1") {
			retorno = false;
			document.getElementById("td_" + nome).style.backgroundColor = COR_ALERTA;
		} else {
			document.getElementById("td_" + nome).style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
		}
	}
	
	nome	= "cdc_cli_prf_admissao";
	if ((aux = document.getElementById(nome)) != null) {
		if (aux.value == "") {
			retorno = false;
			document.getElementById("td_" + nome).style.backgroundColor = COR_ALERTA;
		} else if(!validaData("01/" + aux.value)){ //Danilo Sandim 04/03/2009 - 48963
			retorno = false;
			document.getElementById("td_" + nome).style.backgroundColor = COR_ERRO;
		} else {
			document.getElementById("td_" + nome).style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
		}
	}
	
	
//C O N S I G N A D O
	nome	= "cdc_fonte_pagadora";
	
	if ((aux = document.getElementById(nome)) != null) {
		if (aux.value == "-1") {
			retorno = false;
			document.getElementById("td_" + nome).style.backgroundColor = COR_ALERTA;
		} else {
			document.getElementById("td_" + nome).style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
		}
	}
	
	nome	= "cdc_tipo_beneficio";
	if ((aux = document.getElementById(nome)) != null) {
		if (aux.value == "-1") {
			retorno = false;
			document.getElementById("td_" + nome).style.backgroundColor = COR_ALERTA;
		} else {
			document.getElementById("td_" + nome).style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
		}
	}
	
	nome	= "cdc_aposentado_pensionista";
	if ((aux = document.getElementById(nome)) != null) {
		if (aux.value == "") {
			retorno = false;
			document.getElementById("td_" + nome).style.backgroundColor = COR_ALERTA;
		} else {
			document.getElementById("td_" + nome).style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
		}
	}
//C O N S I G N A D O

	var telefones	= 0;
	var ddd			= document.getElementById("cdc_cli_fone_res_ddd").value;
	var fone		= document.getElementById("cdc_cli_fone_res_numero").value;
	
	if ((ddd != "") || (fone != "")) {		
		if ((validaDDD(ddd)) && (validaTelefone(fone)) && (!isCelular(fone))) {
			telefones++;
			document.getElementById("td_cdc_cli_fone_res").style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
		} else {
			document.getElementById("td_cdc_cli_fone_res").style.backgroundColor = COR_ERRO;
			retorno = false;
		}
	} else {
		document.getElementById("td_cdc_cli_fone_res").style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
	}

	var foneAnt	= fone;
	ddd			= document.getElementById("cdc_ref1_fone_ddd").value;
	fone		= document.getElementById("cdc_ref1_fone_numero").value;
	nome		= "cdc_ref1_nome";

	if ((ddd != "") || (fone != "")) {		
		if ((fone != foneAnt) && (validaDDD(ddd)) && (validaTelefone(fone)) && (!isCelular(fone))) {
			telefones++;
			document.getElementById("td_cdc_ref1_fone_numero").style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
		} else {
			document.getElementById("td_cdc_ref1_fone_numero").style.backgroundColor = COR_ERRO;
			retorno = false;
		}
		
		
		if (((aux = document.getElementById(nome)) != null) && (aux.value == "")) {
			retorno = false;
			document.getElementById("td_" + nome).style.backgroundColor = COR_ALERTA;
		} else {
			document.getElementById("td_" + nome).style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
		}
	} else {
		document.getElementById("td_cdc_ref1_fone_numero").style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
		document.getElementById("td_" + nome).style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
	}

	foneAnt		= (fone != "")?fone:foneAnt;
	ddd			= document.getElementById("cdc_cli_fone_com_ddd").value;
	fone		= document.getElementById("cdc_cli_fone_com_numero").value;
	
	if ((ddd != "") || (fone != "")) {		
		if ((fone != foneAnt) && (validaDDD(ddd)) && (validaTelefone(fone)) && (!isCelular(fone))) {
			telefones++;
			document.getElementById("td_cdc_cli_fone_com").style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
		} else {
			document.getElementById("td_cdc_cli_fone_com").style.backgroundColor = COR_ERRO;
			retorno = false;
		}
	} else {
		document.getElementById("td_cdc_cli_fone_com").style.backgroundColor = COR_ALERTA;
		retorno = false;
	}

	ddd			= document.getElementById("cdc_cli_fone_cel_ddd").value;
	fone		= document.getElementById("cdc_cli_fone_cel_numero").value;
	
	if ((ddd != "") || (fone != "")) {		
		if ((validaDDD(ddd)) && (validaTelefone(fone)) && (isCelular(fone))) {
			document.getElementById("td_cdc_cli_fone_cel").style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
		} else {
			document.getElementById("td_cdc_cli_fone_cel").style.backgroundColor = COR_ERRO;
			retorno = false;
		}
	} else {
		document.getElementById("td_cdc_cli_fone_cel").style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
	}

	var i	= 1;
	nome	= "edtCheque";
	while ((aux = document.getElementById(nome + i)) != null) {
		var valor = aux.value;
		if (valor == "") {
			document.getElementById("td_" + nome + i).style.backgroundColor = COR_ALERTA;
			retorno = false;
		} else if (valor.length != 6) {
			document.getElementById("td_" + nome + i).style.backgroundColor = COR_ERRO;
			retorno = false;
		} else {
			document.getElementById("td_" + nome + i).style.backgroundColor = COR_LINHA_NAO_SELECIONADA;
		}
		i++;
	}

	var mensagem = "";
	
	if (telefones < QTD_FONE_FIXO) {
		retorno = false;
		mensagem = "\nA T E N Ç Ã O: É necessário " + QTD_FONE_FIXO + " telefone fixo!";
	}

	if (!retorno) {
		alert("Campos obrigatórios não foram preenchidos e foram destacados em amarelo!\nCampos preechidos com erros foram destacados em vermelho!" + mensagem);
	}

	return retorno;
}
function proximo() {
	retorno = false;

	if (retorno = validaForm()) {
		var form = document.getElementById("frmPrincipal");
		form.action = "cadastropf2Finaliza.jsp";
		form.submit();	
	}
	
	return retorno;
}
function anterior() {
	history.back();
	return true;
}
