jQuery(function($){$("#fone").mask("(99) 9999-9999");$("#niver").mask("99/99/9999");});

$(document).ready(function()    {
$("#abre_form").click(function(){  $("#formulario").animate({"height": "toggle"}, { duration: 500 });});

$("a#btnNovaSenha").click(function(){  
$('.senha1').show();
$('.senha').hide();
});

$("input.btsenha").click(function(){  
$('form#recuperarform').submit();

});

});


function recuperar(){
	
	
}


//registrar
function SomenteNumero(e){
var tecla=(window.event)?event.keyCode:e.which;
if((tecla > 47 && tecla < 58)) return true;
else{
if (tecla != 8) return false;
else return true;
}
}

function submit_registrar_form(){

if (document.cadastro_form.email2.value.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1) {
alert("O campo E-mail deve conter um endereço eletronico!");
document.cadastro_form.email2.style.background="#FFc";
document.cadastro_form.email2.select();
return false;
} else {
document.cadastro_form.email2.style.background="#fff";
}

if (document.cadastro_form.crm.value == '' || document.cadastro_form.crm.value == 'INFORME O CRM') {
document.cadastro_form.crm.value = "INFORME O CRM";
document.cadastro_form.crm.style.background="#FFc";
document.cadastro_form.crm.select();
return false;
}else{
document.cadastro_form.crm.style.background="#fff";
$("#more_form").css('display','block');
$(".more").html('Após cadastrar verifique o seu e-mail');

}

if (document.cadastro_form.nome.value == '' || document.cadastro_form.nome.value == 'INFORME O SEU NOME') {
document.cadastro_form.nome.value = "INFORME O SEU NOME";
document.cadastro_form.nome.style.background="#FFc";
document.cadastro_form.nome.select();
return false;
}else{
document.cadastro_form.nome.style.background="#fff";
}

if (document.cadastro_form.especialidade.value == '') {
alert("Selecione sua Especialidade");
document.cadastro_form.especialidade.focus();
return false;
}else{

}

if (document.cadastro_form.fone.value == '' || document.cadastro_form.fone.value == 'INFORME O TELEFONE') {
document.cadastro_form.fone.value = "INFORME O TELEFONE";
document.cadastro_form.fone.style.background="#FFc";
document.cadastro_form.fone.select();
return false;
}else{
document.cadastro_form.fone.style.background="#fff";
}

if (document.cadastro_form.senha.value == '' || document.cadastro_form.senha.value == 'DIGITE UMA SENHA') {
document.cadastro_form.senha.value = "DIGITE UMA SENHA";
document.cadastro_form.senha.style.background="#FFc";
document.cadastro_form.senha.select();
return false;
} else{
document.cadastro_form.senha.style.background="#fff";
var valu = document.cadastro_form.senha.value;
}

if (document.cadastro_form.senha2.value == '' || document.cadastro_form.senha2.value == 'DIGITE DENOVO A SENHA') {
document.cadastro_form.senha2.value = "DIGITE DENOVO SENHA";
document.cadastro_form.senha2.style.background="#FFc";
document.cadastro_form.senha2.select();
return false;
} else{
document.cadastro_form.senha2.style.background="#fff";

}

if (document.cadastro_form.senha2.value != valu) {
alert( "As Senhas não são iguais.");
document.cadastro_form.senha2.style.background="#FFc";
document.cadastro_form.senha2.select();
return false;
}else{
document.cadastro_form.senha2.style.background="#fff";

cadastra();
return false;
}
}

function cadastra(){
var str_cadastra = $("#cadastro_form").serialize();
$(".more").html('<img src="images/loading.gif" />');
$.ajax ({
url: "add_medicos.php",
type: "post",
data: str_cadastra, 
success: function (resposta) {
$('.more').html(resposta);
$('input[type=text]').val('');
$("#more_form").css('display','none');
} 
});
}


function submit_contato(){if(document.form3.name.value==''||document.form3.name.value=='PREENCHA O CAMPO NOME'){document.form3.name.value="PREENCHA O CAMPO NOME";document.form3.name.style.background="#FFc";document.form3.name.select();return false}else{document.form3.name.style.background="#fff"}if(document.form3.email.value==''){document.form3.email.value="PREENCHA O CAMPO E-MAIL";document.form3.email.style.background="#FFc";document.form3.email.select();return false}else{document.form3.email.style.background="#fff"}parte3=document.form3.email.value.length;if(document.form3.email.value.indexOf("@")==-1||document.form3.email.value.indexOf(".")==-1||parte3<=5){alert('Este email parece ser um email inválido. Por favor digite outro!');document.form3.email.style.background="#FFc";document.form3.email.select();return false}if(document.form3.cidade.value==''||document.form3.cidade.value=='INFORME A SUA CIDADE'){document.form3.cidade.value="INFORME A SUA CIDADE";document.form3.cidade.style.background="#FFc";document.form3.cidade.select();return false}else{document.form3.cidade.style.background="#fff"}if(document.form3.mensagem.value==''||document.form3.mensagem.value=='DIGITE SUA MENSAGEM'){document.form3.mensagem.value="DIGITE SUA MENSAGEM";document.form3.mensagem.style.background="#FFc";document.form3.mensagem.select();return false}else{document.form3.mensagem.style.background="#fff"}if(document.form3.resposta.value==''||document.form3.resposta.value!='3'){alert('Errado, responda corretamente a ultima pergunta');document.form3.resposta.select();return false}else{document.form3.mensagem.style.background="#fff"}}


//autenticar

function submit_autentica_form(){

if (document.autentica_form.crm2.value == '' || document.autentica_form.crm2.value == 'PREENCHA O CAMPO') {
document.autentica_form.crm2.value = "PREENCHA O CAMPO";
document.autentica_form.crm2.style.background="#FFc";
document.autentica_form.crm2.select();
return false;
}else{
document.autentica_form.crm2.style.background="#fff";
}

if (document.autentica_form.pass.value == '') {
document.autentica_form.pass.style.background="#FFc";
document.autentica_form.pass.select();
return false;
}else{
document.autentica_form.pass.style.background="#fff";

}
}


