$(function(){
			$(".erro").hide();
		
			$(".button-submit").click(function() {
				$(".erro").hide();
					
				var curso_id = 	$("input#curso_id").val();
				
				//validacao de nome completo
				var nome = $("input#nome").val();
				if (nome == ""){
					$("label#nome_erro").show();
					$("input#nome").focus();
					return false;	
				}
				
				//validacao de email
				var email = $("input#email").val();
				if (email == ""){
					$("label#email_erro").show();
					$("input#email").focus();
					return false;	
				}
				
				var dataString = 'curso_id=' + curso_id + '&nome='+ nome + '&email='+ email;
				//alert(dataString); 
				
				$.ajax({
					type: 		"POST",
					url:  		"/avise-me",
					data: 		dataString,
					success:	function (html){
									$("#matricula_form").html("<div id='mensagem'></div>");
									$("#mensagem")
									.append(html)
									.hide()
									.fadeIn(1500, function () {}); 	
								} 
				});
				return false;
				
							
			});
		});