function isEmail(string) {
	if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1) {
		return true;
	}
	else return false;
}

function validate() {
	var pass	= true;
	var error	= "";
	
	
	if ($("#txtNome").val() == "") {
		pass = false;
		error = error + "- Nome é obrigatorio!\n";
	}
	
	if ($("#txtNascimento").val() == "") {
		pass = false;
		error = error + "- Nascimento é obrigatorio!\n";
	}
	
	if ($("#txtSexo").val() == "") {
		pass = false;
		error = error + "- Sexo é obrigatorio!\n";
	}
	
	if ($("#txtNaturalidade").val() == "") {
		pass = false;
		error = error + "- Naturalidade é obrigatorio!\n";
	}
	
	if ($("#txtRG").val() == "") {
		pass = false;
		error = error + "- RG é obrigatorio!\n";
	}
	
	if ($("#txtDataRG").val() == "") {
		pass = false;
		error = error + "- Orgão de Expedição do RG é obrigatorio!\n";
	}
	
	if ($("#txtCNH").val() == "") {
		pass = false;
		error = error + "- Carteira de Habilitação é obrigatorio!\n";
	}
	
	if ($("#txtDeficiencia").val() == "") {
		pass = false;
		error = error + "- Portador de Deficiência é obrigatorio!\n";
	}
	
	if ($("#txtEstadoCivil").val() == "") {
		pass = false;
		error = error + "- Estado Civil é obrigatorio!\n";
	}
	
	if ($("#txtFilhos").val() == "") {
		pass = false;
		error = error + "- Filhos é obrigatorio!\n";
	}
	
	if ($("#txtEndereco").val() == "") {
		pass = false;
		error = error + "- Endereço é obrigatorio!\n";
	}
	
	if ($("#txtNumero").val() == "") {
		pass = false;
		error = error + "- Numero é obrigatorio!\n";
	}
	
	if ($("#txtBairro").val() == "") {
		pass = false;
		error = error + "- Bairro é obrigatorio!\n";
	}
	
	if ($("#txtCidade").val() == "") {
		pass = false;
		error = error + "- Cidade é obrigatorio!\n";
	}
	
	if ($("#txtCEP").val() == "") {
		pass = false;
		error = error + "- CEP é obrigatorio!\n";
	}
	
	if ($("#txtTelResidencial").val() == "") {
		pass = false;
		error = error + "- Telefone Residencial é obrigatorio!\n";
	}
	
	if ($("#txtTelCelular").val() == "") {
		pass = false;
		error = error + "- Telefone Celular é obrigatorio!\n";
	}
	
	if ($("#txtPretensaoSalarial").val() == "") {
		pass = false;
		error = error + "- Pretensão salarial é obrigatorio!\n";
	}
	
	if ($("#txtInformatica").val() == "") {
		pass = false;
		error = error + "- Informatica é obrigatorio!\n";
	}
	
	if ($("#txtEmail").val() == "" || !isEmail($("#txtEmail").val())){
		pass = false;
		error = error + "- Email é obrigatorio!\n";
	}
	
	if ($("#txtSenha").val() == "") {
		pass = false;
		error = error + "- Senha é obrigatorio!\n";
	}
	
	if (!pass){
		alert("Verifique os campos: \n" + error);
	}

	return pass;
}


$(document).ready(function(){

	$("#txtNascimento").maskedinput("99/99/9999", " ");
	$("#txtCEP").maskedinput("99.999-999", " ");
	$("#txtTelResidencial").maskedinput("(99) 9999-9999", " ");
	$("#txtTelComercial").maskedinput("(99) 9999-9999", " ");
	$("#txtTelCelular").maskedinput("(99) 9999-9999", " ");
	
	$("#txtPretensaoSalarial").numeric({allow:"."});
	$("#txtPretensaoSalarial").floatnumber(".", 2);
	
	$("#frmContato").submit(function(){
		return validate();
	});
	
});