function limpaEspacos(valor) {
	return valor.replace(/^\s+|\s+$/g, "");
}
function validaEmail(email) {
	var filtro = /^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})$/;
	return filtro.test(email);
}
function validaForm(form) { // Valida os dados digitados no formulário
	var tamMin = 3;
	var s = limpaEspacos(form.nomep.value);
	var cc = 0;
	if (s.length != 0) {
//		cc++;
		if (s.length < tamMin) {
			alert("Para fazer uma busca pelo Nome do Profissional é necessário preencher o campo NOME com pelo menos " + tamMin + " letras.");
			form.nomep.focus();
			return false;
		}
	}
//	if (limpaEspacos(form.cidadep.value).length != 0) cc++;
//	if (form.ufp.selectedIndex != 0) cc++;
//	if (form.prof.selectedIndex != 0) cc++;
//	if (form.espec.selectedIndex != 0) cc++;
//	if (cc < 3) {
//		alert("Para fazer uma busca você deve fornecer pelo menos 3 campos.");
//		form.nomep.focus();
//		return false;
//	}
	return true;
}
function submeter(form) {
	if (!validaEmail(form.email.value)) {
	  alert('E-MAIL incorreto! Verifique-o e tente novamente.');
	  form.email.focus();
	  return false;
	}
	if (form.acao.selectedIndex==2) {
		if (form.senha.value.length==0) {
			alert('Tamanho da CHAVE incorreto! Verifique-a e tente novamente.');
			form.senha.focus();
			return false;
		}
	}
	return true;
}

function TestaAcao(campo) {
	$divSenha = document.getElementById('divSenha');
	$divOk = document.getElementById('divOk');
	document.fboletim.action = campo.options[campo.selectedIndex].value;
	if (campo.selectedIndex == 2) {
		$divSenha.style.display = '';
		$divOk.style.display = 'none';
	} else {
		$divSenha.style.display = 'none';
		$divOk.style.display = '';
	}
}

