function mailcheck(str) {
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
		return false
	}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		return false
	}
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		return false
	}
	if (str.indexOf(at,(lat+1))!=-1){
    	return false
	}
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		return false
	}
	if (str.indexOf(dot,(lat+2))==-1){
		return false
	}
	if (str.indexOf(" ")!=-1){
		return false
	}
	return true					
}

function check_my_form_contato(){ 	
	fm_nome = $("fm_nome").value;
	if(fm_nome.length < 3){
		alert("prencha o campo Nome corretamente");
		return (false);
	}		
	email = $("fm_email").value;
	if(!mailcheck(email)){
		alert("digite um endereço de email válido");
		return (false);
	}	
	fm_assunto = $("fm_assunto").value;
	if(fm_assunto.length < 2){
		alert("prencha o campo Assunto corretamente");
		return (false);
	}
	fm_mensagem = $("fm_mensagem").value;
	if(fm_mensagem.length < 2){
		alert("prencha o campo Mensagem corretamente");
		return (false);
	}
}

function check_my_form_curso(){ 
	fm_curso = $("fm_curso").value;
	if(fm_curso.length < 2){
		alert("prencha o campo Curso corretamente");
		return (false);
	}
	fm_data_inicio = $("fm_data_inicio").value;
	if(fm_data_inicio.length < 6){
		alert("prencha o campo Data do Curso corretamente");
		return (false);
	}		
	fm_local_curso = $("fm_local_curso").value;
	if(fm_local_curso.length < 2){
		alert("prencha o campo Local do Curso corretamente");
		return (false);
	}		
	fm_nome = $("fm_nome").value;
	if(fm_nome.length < 3){
		alert("prencha o campo Nome corretamente");
		return (false);
	}		
	fm_cpf = $("fm_cpf").value;
	if(fm_cpf.length < 11){
		alert("prencha o campo CPF corretamente");
		return (false);
	}		
	fm_rg = $("fm_rg").value;
	if(fm_rg.length < 6){
		alert("prencha o campo RG corretamente");
		return (false);
	}		
	fm_endereco = $("fm_endereco").value;
	if(fm_endereco.length < 2){
		alert("prencha o campo Endereço corretamente");
		return (false);
	}		
	fm_cidade = $("fm_cidade").value;
	if(fm_cidade.length < 2){
		alert("prencha o campo Cidade corretamente");
		return (false);
	}		
	fm_cep = $("fm_cep").value;
	if(fm_cep.length < 8){
		alert("prencha o campo CEP corretamente");
		return (false);
	}		
	fm_telefones = $("fm_telefones").value;
	if(fm_telefones.length < 8){
		alert("prencha o campo Telefones corretamente");
		return (false);
	}
	email = $("fm_email").value;
	if(!mailcheck(email)){
		alert("digite um endereço de email válido");
		return (false);
	}	
	fm_profissao = $("fm_profissao").value;
	if(fm_profissao.length < 2){
		alert("prencha o campo Profissão corretamente");
		return (false);
	}		
	fm_aniversario = $("fm_aniversario").value;
	if(fm_aniversario.length < 6){
		alert("prencha o campo Aniversário corretamente");
		return (false);
	}		
	fm_sabendo = $("fm_sabendo").value;
	if(fm_sabendo.length < 2){
		alert("prencha o campo Como ficou sabendo do curso?");
		return (false);
	}
	/*		
	fm_observa = $("fm_observa").value;
	if(fm_observa.length < 2){
		alert("prencha o campo Observações");
		return (false);
	}	
	*/			
	fm_pagamento_cheque = $("fm_pagamento_deposito").checked;
	fm_pagamento_deposito = $("fm_pagamento_deposito").checked;
	if(fm_pagamento_deposito == false && fm_pagamento_cheque == false){
		alert("escolha uma Forma de Pagamento");
		return (false);
	}		
	fm_hoje = $("fm_hoje").value;
	if(fm_hoje.length < 6){
		alert("prencha o campo Data de Hoje");
		return (false);
	}		
	fm_confirmo = $("fm_confirmo").checked;
	if(fm_confirmo != 1){
		alert("é preciso marcar Aceito");
		return (false);
	}
}