function jsAjaxCurriculumSalvar(){

	//Validação Javascript
	var bnmCandidato		= ($Id('nmCandidato').value.search(/^[A-Za-zÀ-ú ]{3,70}$/gi) == 0);
	var bnuCpf				= ($Id('nuCpf').value != '' );
	var bdtNascimento		= ($Id('dtNascimento').value.search(/^(0[1-9]|[12][0-9]|3[01])\/(0[1-9]|1[012])\/([1][9][0-9]{2}|[2][0-9]{3})$/) == 0);
	var bdmSexo				= ($Id('dmSexo').value != '');
	var bedEmail			= ($Id('edEmail').value.search(/^[a-zA-Z0-9_.-]{2,}@[a-zA-Z0-9_.-]+\.([a-zA-Z]{2,4})$/) == 0);
	var bnuTelefonePre		= ((($Id('nuTelefonePre').value == '') && ($Id('nuTelefone').value == '')) || ($Id('nuTelefonePre').value.search(/^[1-9][0-9]$/) == 0));
	var bnuTelefone			= ((($Id('nuTelefonePre').value == '') && ($Id('nuTelefone').value == '')) || ($Id('nuTelefone').value.search(/^\d{8}$/) == 0));
	var bnuCelularPre		= ((($Id('nuCelularPre').value == '') && ($Id('nuCelular').value == '')) || ($Id('nuCelularPre').value.search(/^[1-9][0-9]$/) == 0));
	var bnuCelular			= ((($Id('nuCelularPre').value == '') && ($Id('nuCelular').value == '')) || ($Id('nuCelular').value.search(/^\d{8}$/) == 0));
	var bTelContato			= (($Id('nuTelefonePre').value != '' && $Id('nuTelefone').value != '') || ($Id('nuCelularPre').value != '' && $Id('nuCelular').value != ''));
	var bdsEndereco			= ($Id('dsEndereco').value.search(/^.{3,200}$/gi) == 0);
	var bnmBairro			= ($Id('nmBairro').value.search(/^[A-Za-zÀ-ú ]{3,100}$/gi) == 0);
	var bnmCidade			= ($Id('nmCidade').value.search(/^[A-Za-zÀ-ú ]{3,100}$/gi) == 0);
	var bsgEstado			= ($Id('sgEstado').value != '' );
	var bnuCep				= ($Id('nuCep').value.search(/^[0-9]{5}-[0-9]{3}$/gi) == 0);
	var dsQualificacoes		= $Id('dsQualificacoes').value.replace(/[&#]/g,"");
	var bdsQualificacoes	= (dsQualificacoes.search(/.{10,1000}/gi) == 0);
	//var bdsSenha			= ($Id('dsSenha').value.search(/^.{6,30}$/gi) == 0);
	//var bdsConfirmacao		= ($Id('dsSenha').value == $Id('dsConfirmacao').value);
	
	if(xmlhttp && bnmCandidato && bnuCpf && bdtNascimento && bdmSexo && bedEmail && bnuTelefonePre && bnuTelefone && bnuCelularPre && bnuCelular && bTelContato && bdsEndereco && bnmBairro && bnmCidade && bsgEstado && bnuCep && bdsQualificacoes ){
		jsCarregando(1);

		dsQualificacoes = jsURLAjaxDS('dsQualificacoes', dsQualificacoes);

		//Abre a url
		xmlhttp.open('GET', 'bin/AjaxCurriculum.asp?op=1&nmCandidato=' + $Id('nmCandidato').value + '&nuCpf=' + $Id('nuCpf').value + '&dtNascimento=' + $Id('dtNascimento').value + '&dmSexo=' + $Id('dmSexo').value + '&edEmail=' + $Id('edEmail').value + '&nuTelefonePre=' + $Id('nuTelefonePre').value + '&nuTelefone=' + $Id('nuTelefone').value + '&nuCelularPre=' + $Id('nuCelularPre').value + '&nuCelular=' + $Id('nuCelular').value + '&dsEndereco=' + $Id('dsEndereco').value + '&nmBairro=' + $Id('nmBairro').value + '&nmCidade=' + $Id('nmCidade').value + '&sgEstado=' + $Id('sgEstado').value + '&nuCep=' + $Id('nuCep').value + dsQualificacoes, true);

		//Executada quando o navegador obtiver o código
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4){
				//Lê o texto
				var texto = new String(xmlhttp.responseText);

				//Desfaz o urlencode
				texto=texto.replace(/\+/g," ");
				texto=unescape(texto);

				//Retorna o resultado;
				if (texto.search('Erro ao tentar incluir/editar registro') != -1)
					alert(texto);
				else if (texto != ''){
					var saida = 'ASP *** Erro de validação:\n';
					//alert(texto);
					if (texto.search('nmCandidato')!=-1)
						saida += '\nNome: ' + $Id('nmCandidato').title;
					if (texto.search('nuCpf')!=-1)
						saida += '\nCPF: ' + $Id('nuCpf').title;
					if (texto.search('dtNascimento')!=-1)
						saida += '\nData Nascimento: ' + $Id('dtNascimento').title;
					if (texto.search('dmSexo')!=-1)
						saida += '\nSexo: ' + $Id('dmSexo').title;
					if (texto.search('edEmail')!=-1)
						saida += '\nE-mail: ' + $Id('edEmail').title;
					if (texto.search('nuTelefonePre')!=-1)
						saida += '\nPrefixo do Telefone: ' + $Id('nuTelefonePre').title;
					if (texto.search('nuTelefone')!=-1)
						saida += '\nTelefone: ' + $Id('nuTelefone').title;
					if (texto.search('nuCelularPre')!=-1)
						saida += '\nPrefixo do Celular: ' + $Id('nuCelularPre').title;
					if (texto.search('nuCelular')!=-1)
						saida += '\nCelular: ' + $Id('nuCelular').title;
					if (texto.search('dsEndereco')!=-1)
						saida += '\nEndereço: ' + $Id('dsEndereco').title;
					if (texto.search('nmBairro')!=-1)
						saida += '\nBairro: ' + $Id('nmBairro').title;
					if (texto.search('nmCidade')!=-1)
						saida += '\nCidade: ' + $Id('nmCidade').title;
					if (texto.search('sgEstado')!=-1)
						saida += '\nEstado: ' + $Id('sgEstado').title;
					if (texto.search('nuCep')!=-1)
						saida += '\nCEP: ' + $Id('nuCep').title;
					if (texto.search('dsQualificacoes')!=-1)
						saida += '\nQualificações: ' + $Id('dsQualificacoes').title;
					/*if (texto.search('dsSenha')!=-1)
						saida += '\nSenha: ' + $Id('dsSenha').title;
					if (texto.search('dsConfirmacao')!=-1)
						saida += '\nConfirmar Senha: ' + $Id('dsConfirmacao').title;*/
					alert(saida);
				}
				else{
					alert("Curriculum cadastrado com sucesso!");
					window.location.href = 'Curriculum.asp';
				}

				jsCarregando(0);
			}
		}
		xmlhttp.send(null)
	}
	else{
		var saida = 'Erro de validação:\n';

		if (!bnmCandidato){
			saida += '\nNome: ' + $Id('nmCandidato').title;
			$Id('nmCandidato').focus();
		}
		else if (!bnuCpf){
			saida += '\nCPF: ' + $Id('nuCpf').title;
			$Id('nuCpf').focus();
		}
		else if (!bdtNascimento){
			saida += '\nData Nascimento: ' + $Id('dtNascimento').title;
			$Id('dtNascimento').focus();
		}
		else if (!bdmSexo){
			saida += '\nSexo: ' + $Id('dmSexo').title;
			$Id('dmSexo').focus();
		}
		else if (!bedEmail){
			saida += '\nE-mail: ' + $Id('edEmail').title;
			$Id('edEmail').focus();
		}
		else if (!bnuTelefonePre){
			saida += '\nPrefixo do Telefone: ' + $Id('nuTelefonePre').title;
			$Id('nuTelefonePre').focus();
		}
		else if (!bnuTelefone){
			saida += '\nTelefone: ' + $Id('nuTelefone').title;
			$Id('nuTelefone').focus();
		}
		else if (!bnuCelularPre){
			saida += '\nPrefixo do Celular: ' + $Id('nuCelularPre').title;
			$Id('nuCelularPre').focus();
		}
		else if (!bnuCelular){
			saida += '\nCelular: ' + $Id('nuCelular').title;
			$Id('nuCelular').focus();
		}
		else if (!bTelContato){
			saida += '\nContato: Preencha no mínimo um telefone de contato.';
			$Id('nuTelefonePre').focus();
		}
		else if (!bdsEndereco){
			saida += '\nEndereço: ' + $Id('dsEndereco').title;
			$Id('dsEndereco').focus();
		}
		else if (!bnmBairro){
			saida += '\nBairro: ' + $Id('nmBairro').title;
			$Id('nmBairro').focus();
		}
		else if (!bnmCidade){
			saida += '\nCidade: ' + $Id('nmCidade').title;
			$Id('nmCidade').focus();
		}
		else if (!bsgEstado){
			saida += '\nEstado: ' + $Id('sgEstado').title;
			$Id('sgEstado').focus();
		}
		else if (!bnuCep){
			saida += '\nCEP: ' + $Id('nuCep').title;
			$Id('nuCep').focus();
		}
		else if (!bdsQualificacoes){
			saida += '\nQualificações: ' + $Id('dsQualificacoes').title;
			$Id('dsQualificacoes').focus();
		}
		alert(saida);
	}
}


function jsCadastrar(){
	document.getElementById('fdCadastro').style.display = 'block';
	document.getElementById('fdLogar').style.display = 'none';
}

function jsLogar(){
	document.getElementById('fdCadastro').style.display = 'none';
	document.getElementById('fdLogar').style.display = 'block';
	jsLimparForm();
}	

function jsLimparForm(){
	var arInput		= document.getElementsByTagName('input');
	var arSelect	= document.getElementsByTagName('select');
	var arTextarea	= document.getElementsByTagName('textarea');

	for(i=0; i<arInput.length; i++){
		if (arInput[i].parentNode.className != 'dvBotoes'){
			arInput[i].value = '';
		}
	}
	for(j=0; j<arSelect.length; j++){
		arSelect[j].value = '';
	}
	for(k=0; k<arTextarea.length; k++){
		arTextarea[k].value = '';
	}
}