function verificarFormulario(nomeFormulario,arrayNomeCampoFormulario)
{
	var estilo_erro = '2px solid #FF0000';
	var estilo = '1px solid #CCCCCC';
	msn = false;
	
	campos = arrayNomeCampoFormulario.split(",")
	
	for (x=0; x < campos.length; x++){
		
		verificar_valor = "document."+nomeFormulario+"."+campos[x]+".value";
		var UA = navigator.userAgent;
		if (UA.indexOf('MSIE') > -1) {
			
			if(eval(verificar_valor) == ""){
				msn = true;
				verificar_style = "document.getElementById('"+campos[x]+"').style.border=estilo_erro";
				eval(verificar_style); 
			} else {
				verificar_style = "document.getElementById('"+campos[x]+"').style.border=estilo";
				eval(verificar_style); 
			}
		
		} else{
		   if(eval(verificar_valor) == ""){
			msn = true;
				verificar_style = "document.getElementById('"+campos[x]+"').style.border=estilo_erro";
				eval(verificar_style); 
			} else {
				verificar_style = "document.getElementById('"+campos[x]+"').style.border=estilo";
				eval("verificar_style"); 
			}
		}
	}
	if (msn){
		document.getElementById("advCampos").style.visibility = "visible";
		document.getElementById("advCampos").style.position = "relative";
	} else {
		document.getElementById("advCampos").style.visibility = "hidden";
		document.getElementById("advCampos").style.position = "absolute";
	}
	return msn;
	
}
 
function verificarDP(){
	
	NameFormulario = "frmDP";
	campoPraValidar = "txtNacionalidade,txtFilhos,txtCep,txtEndereco,txtNumero,txtBairro,txtCidade,txtEstado,txtEstadoCV,txtQueSou,txtMeuObjetivo";
	
 	erro = verificarFormulario(NameFormulario,campoPraValidar);

	if (erro == false){	
		if (document.frmDP.txtQualidade[0].value == ""){
			document.getElementById("advCampos").style.visibility = "visible";
			document.getElementById("advCampos").style.position = "relative";
			document.getElementById("txtQualidade").style.border = '2px solid #FF0000';
		
		} else {
			
			var valor = document.frmDP.txtQualidade.length;
			for(i=0;i<valor;i++){
				var str = document.frmDP.txtQualidade[i].value;
				var ExpReg = /,/g;
				str2 = str.replace(ExpReg,"#");
				document.frmDP.txtQualidade[i].value = str2;
			}
			
			document.frmDP.submit();
		}
	
	}
	
	return false;
 }

function verificarVPExcluir(id){
	location.href = "codigos/vidaProfissionalExcluir.asp?id="+id;
}

function verificarVP(){
	
	NameFormulario = "frmEmpresa";
	campoPraValidar = "dt_entrada_01,dt_entrada_02,txtnome_empresa,txtperfil_empresa,txtcargo,txtperfil_cargo";
	
 	erro = verificarFormulario(NameFormulario,campoPraValidar);

	if (erro == false){	
		
		var objData = document.frmEmpresa.dt_saida_01.value;
		var objData2 = document.frmEmpresa.dt_saida_02.value;
		
		if(parseFloat(objData) > 12  || parseFloat(objData) < 1 ){
			
			document.getElementById("dt_saida_01").style.border = '2px solid #FF0000';
			
		}else if(parseFloat(objData2) > 2020  || parseFloat(objData2) < 1920 ){
			
			document.getElementById("dt_saida_02").style.border = '2px solid #FF0000';
			
		}else if (document.frmEmpresa.txtatribuicao[0].value == ""){
			
			document.getElementById("advCampos").style.visibility = "visible";
			document.getElementById("advCampos").style.position = "relative";
			document.getElementById("txtatribuicao").style.border = '2px solid #FF0000';
		
		}else if (document.frmI.it_int.checked){
			
			alert("Desabilite a opção\n \"Não tenho experiência profissional\".");
			document.getElementById("it_int").style.border = '2px solid #FF0000';
		}else{
			
			var valor = document.frmEmpresa.txtatribuicao.length;
			for(i=0;i<valor;i++){
				var str = document.frmEmpresa.txtatribuicao[i].value;
				var ExpReg = /,/g;
				str2 = str.replace(ExpReg,"#");
				document.frmEmpresa.txtatribuicao[i].value = str2;
			}
			
			var valor = document.frmEmpresa.txtrealizacao.length;
			for(i=0;i<valor;i++){
				var str = document.frmEmpresa.txtrealizacao[i].value;
				var ExpReg = /,/g;
				str2 = str.replace(ExpReg,"#");
				document.frmEmpresa.txtrealizacao [i].value = str2;
			}
			
			document.frmEmpresa.submit();
		}
	}
	
	return false;
 }

function validarI(x){
	if(x == 0){
		if (document.frmI.it_int.checked){
			
			document.frmI.submit();
		
		}else{
			alert("Se não cadastrou nenhuma empresa  \n Habilite o campo \"não tenho experiência profissional\" ");
			document.getElementById("it_int").style.border = '2px solid #FF0000';
		}
	}else{
		location.href="meusInteresses.asp";	
	}
 }
 
 
function recuperSenha(){
	
	NameFormulario = "frmEmail";
	campoPraValidar = "txtEmail";
	
 	erro = verificarFormulario(NameFormulario,campoPraValidar);
	if (erro == false){
		
		
	if ((document.frmEmail.txtEmail.value.indexOf('@') == -1) || (document.frmEmail.txtEmail.value.indexOf('.') == -1)){
			document.getElementById("advCampos2").style.visibility = "visible";
			document.getElementById("advCampos2").style.position = "relative";
			document.getElementById("txtEmail").style.border = '2px solid #FF0000';

		} else {
			document.frmEmail.submit();
		}
		
	}
	return false;
 }
 
 function alterarSenha(){
	
	NameFormulario = "frmAlt";
	campoPraValidar = "vc_senhaAtual,vc_novaSenha";
	
 	erro = verificarFormulario(NameFormulario,campoPraValidar);
	if (erro == false){
		
		if (document.frmAlt.vc_novaSenha.value != document.frmAlt.vc_novaSenha2.value){
			document.getElementById("advCampos2").style.visibility = "visible";
			document.getElementById("advCampos2").style.position = "relative";
			document.getElementById("vc_novaSenha").style.border = '2px solid #FF0000';
			document.getElementById("vc_novaSenha2").style.border = '2px solid #FF0000';
		}else{
			document.frmAlt.submit();
		}
		
	}
	return false;
 }

function verificarCadastro(){

	if (document.getElementById("loginExistente").value == '1'){
		document.frmCadastro.txtLoginCadastro.value = "";
	}
	
	NameFormulario = "frmCadastro";
	campoPraValidar = "txtSenhaCadastro,txtNome,txtSobrenome,txtProfissao,txtCpf,txtDDD,txtTel,txtNascimento,txtEmail,txtCep,txtLoginCadastro";
			
 	erro = verificarFormulario(NameFormulario,campoPraValidar);

	if (erro == false){
		
		var objData = document.frmCadastro.txtNascimento.value .split('/');
		if(parseFloat(objData[0]) > 31 || parseFloat(objData[0]) < 1 || 
			parseFloat(objData[1]) > 12  || parseFloat(objData[1]) < 1 ||
			parseFloat(objData[2]) < 1920 || parseFloat(objData[2]) > 2010){
		
			document.getElementById("txtNascimento").style.border = '2px solid #FF0000';
		
		}else if (document.frmCadastro.contrato.checked == false){
			document.getElementById("advCampos").style.visibility = "visible";
			document.getElementById("advCampos").style.position = "relative";
			document.getElementById("spanContrato").style.border = '2px solid #FF0000';

		} else {
			document.frmCadastro.submit();
		}
		
	}
	
	return false;
 }
 
 function cadastroEmpresa(){
	
	if (document.getElementById("loginExistente").value == '1'){
		document.frmCEmpresa.txtEmail.value = "";
	}
	
	NameFormulario = "frmCEmpresa";
	campoPraValidar = "txtRazao,txtEstado,txtContato,txtCNPJ,txtCidade,txtEmail,txtSenha1";
		
		//txtEndereco,txtNumero,txtBairro,txtCidade,txtEstado,
	
 	erro = verificarFormulario(NameFormulario,campoPraValidar);

	if (erro == false){
		
		var senha1 = document.frmCEmpresa.txtSenha1.value;	
		var senha2 = document.frmCEmpresa.txtConfirmarSenha.value;
		if(document.frmCEmpresa.txtEmail.value.indexOf('@') == -1 || document.frmCEmpresa.txtEmail.value.indexOf('.') == -1 ){
			alert("Exemplo de E-Mail Válido \n\n email@email.com.br");
		}else if (senha1 != senha2){
			document.getElementById("advCampos").style.visibility = "visible";
			document.getElementById("advCampos").style.position = "relative";
			document.getElementById("txtSenha1").style.border = '2px solid #FF0000';
			document.getElementById("txtConfirmarSenha").style.border = '2px solid #FF0000';

		} else {
			document.frmCEmpresa.submit();
		}
		
	}
	
	return false;
 }
 
 function mudarEmpresa(){
	
	NameFormulario = "frmEmpresaM";
	campoPraValidar = "txtRazao,txtEstado,txtContato,txtCNPJ,txtCidade";
		
		//txtEndereco,txtNumero,txtBairro,txtCidade,txtEstado,
	
 	erro = verificarFormulario(NameFormulario,campoPraValidar);

	if (erro == false){
	
			document.frmEmpresaM.submit();
		
	}
	
	return false;
 }
 
 function verificarVA(){
			
			var valor = document.frmVA.txtpos.length;
			for(i=0;i<valor;i++){
				var str = document.frmVA.txtpos[i].value;
				var ExpReg = /,/g;
				str2 = str.replace(ExpReg,"#");
				document.frmVA.txtpos[i].value = str2;
			}
			
			var valor = document.frmVA.txtgra.length;
			for(i=0;i<valor;i++){
				var str = document.frmVA.txtgra[i].value;
				var ExpReg = /,/g;
				str2 = str.replace(ExpReg,"#");
				document.frmVA.txtgra[i].value = str2;
			}
			
			var valor = document.frmVA.txtcursos.length;
			for(i=0;i<valor;i++){
				var str = document.frmVA.txtcursos[i].value;
				var ExpReg = /,/g;
				str2 = str.replace(ExpReg,"#");
				document.frmVA.txtcursos[i].value = str2;
			}
			
			var valor = document.frmVA.txtidiomas.length;
			for(i=0;i<valor;i++){
				var str = document.frmVA.txtidiomas[i].value;
				var ExpReg = /,/g;
				str2 = str.replace(ExpReg,"#");
				document.frmVA.txtidiomas[i].value = str2;
			}

		document.frmVA.submit();
	
	return false;
 }
 
 function verificarFC(){
	
	NameFormulario = "frmFala";
	campoPraValidar = "vc_email,dddtele,tele";
	
 	erro = verificarFormulario(NameFormulario,campoPraValidar);

	if(erro == false){
		if(document.frmFala.vc_email.value.indexOf('@')== -1 || document.frmFala.vc_email.value.indexOf('.')== -1){
			document.getElementById("vc_email").style.border = '2px solid #FF0000';
		}else{
			document.frmFala.submit();
		}
	}
	return false;
 }
 
function verificarMI(){

		var valor = document.frmMI.txtparticipa.length;
		for(i=0;i<valor;i++){
			var str = document.frmMI.txtparticipa[i].value;
			var ExpReg = /,/g;
			str2 = str.replace(ExpReg,"#");
			document.frmMI.txtparticipa[i].value = str2;
		}
		
		var valor = document.frmMI.txtinteresse.length;
		for(i=0;i<valor;i++){
			var str = document.frmMI.txtinteresse[i].value;
			var ExpReg = /,/g;
			str2 = str.replace(ExpReg,"#");
			document.frmMI.txtinteresse[i].value = str2;
		}
		
		var valor = document.frmMI.txthobbies.length;
		for(i=0;i<valor;i++){
			var str = document.frmMI.txthobbies[i].value;
			var ExpReg = /,/g;
			str2 = str.replace(ExpReg,"#");
			document.frmMI.txthobbies[i].value = str2;
		}
		
		var valor = document.frmMI.txtatividade.length;
		for(i=0;i<valor;i++){
			var str = document.frmMI.txtatividade[i].value;
			var ExpReg = /,/g;
			str2 = str.replace(ExpReg,"#");
			document.frmMI.txtatividade[i].value = str2;
		}
		
		var valor = document.frmMI.txtlivros.length;
		for(i=0;i<valor;i++){
			var str = document.frmMI.txtlivros[i].value;
			var ExpReg = /,/g;
			str2 = str.replace(ExpReg,"#");
			document.frmMI.txtlivros[i].value = str2;
		}
		
		var valor = document.frmMI.txtclasse.length;
		for(i=0;i<valor;i++){
			var str = document.frmMI.txtclasse[i].value;
			var ExpReg = /,/g;
			str2 = str.replace(ExpReg,"#");
			document.frmMI.txtclasse[i].value = str2;
		}
		
		var valor = document.frmMI.txtpesquisa.length;
		for(i=0;i<valor;i++){
			var str = document.frmMI.txtpesquisa[i].value;
			var ExpReg = /,/g;
			str2 = str.replace(ExpReg,"#");
			document.frmMI.txtpesquisa[i].value = str2;
		}
		
		document.frmMI.submit();
}


 function validarCont(){
	
	NameFormulario = "frmC";
	campoPraValidar = "vc_nome,vc_email,tx_assunto";
	
 	erro = verificarFormulario(NameFormulario,campoPraValidar);

	if(erro == false){
		if ((document.frmC.vc_email.value.indexOf('@') == -1) || (document.frmC.vc_email.value.indexOf('.') == -1)){
			document.getElementById("advCampos2").style.visibility = "visible";
			document.getElementById("advCampos2").style.position = "relative";
			document.getElementById("vc_email").style.border = '2px solid #FF0000';

		} else {
			document.frmC.submit();
		}
	}
	return false;
 }