$(document).ready(function() {
	// validate signup form on keyup and submit
	var validator = $("#EsqueceuForm").validate({
		rules: {
			email: {
				required: true,
				email: true,
				remote: "class/password_email.php"
			}
		},
		messages: {
			email: {
				remote: "<br>Este e-mail não está cadastrado."
			}
		},
		// the errorPlacement has to take the table layout into account
		errorPlacement: function(error, element) {
			if ( element.is(":radio") )
				error.appendTo( element.parent().next().next() );
			else if ( element.is(":checkbox") )
				error.appendTo ( element.next() );
			else
				error.appendTo( element.parent().next() );
		},
		// specifying a submitHandler prevents the default submit, good for the demo
		/*submitHandler: function() {
			var nome = document.getElementById('CadastreseForm').nome.value;
			var login = document.getElementById('CadastreseForm').login.value;
			var senha = document.getElementById('CadastreseForm').senha.value;
			var cidade = document.getElementById('CadastreseForm').cidade.value;
			var sexo = document.getElementById('CadastreseForm').sexo.value;
			ajaxFunction("class/login_cadastro.php","","CadastreseReturn","&nome=" + nome +"&login=" + login + "&senha=" + senha +"&cidade=" + cidade +"&sexo=" + sexo);
			document.getElementById('LoginForm').login.value = login;
			document.getElementById('LoginForm').senha.value = senha;
			return false;
		},*/
		// set this class to error-labels to indicate valid fields
		success: function(label) {
			// set &nbsp; as text for IE
			label.html("&nbsp;").addClass("checked");
		}
	});
	
});

