$(document).ready(function() {    
						   
   $("a#boxRecuperaAccao").toggle(
	function() {
	
	    $("div#boxRecupera").slideDown("normal");
	},
	function() {
	    $("div#boxRecupera").slideUp("fast");
	}
    );

    var validator = $("#formValida").validate({
            rules: {
                    bxLemail: {
                            required: true,
                            email: true
                    },
                    bxPassword: {
                            required: true
                    }   
            },
            messages: {
                    bxLemail: {
                            required: lngJSEmailInvalido,
                            minlength: lngJSEmailInvalido,
                            email: lngJSEmailInvalido
                    },
                    bxPassword: {
                            required: lngJSPpreencher
                    }
            },
            errorPlacement: function(error, element) {
                error.appendTo(element.parent());
            },
            submitHandler: function(form) {
                form.submit();
            },
            success: function(label) {
                    // set &nbsp; as text for IE
                    //label.html("&nbsp;").addClass("checked");
            }
    });
    var validator = $("#formRecupera").validate({
            rules: {
		bxEmail: {
		    required: true,
		    email: true,
		    remote: "/comunidade/registo/v.email/?inverso=y"
		}
            },
            messages: {
		bxEmail: {
		    required: lngJSEmailInvalido,
		    minlength: lngJSEmailInvalido,
		    email: lngJSEmailInvalido,
		    remote: lngJSEmailInexistente
		}
            },
            errorPlacement: function(error, element) {
                error.appendTo("#recuperaMsg");
            },
            submitHandler: function() {
                    var $inputs = $('#formRecupera input');
                    $.ajax({
			type: "POST",
			url: "/comunidade/validar/e.senha/",
			data: $inputs,
			success: function(msg){
			    $('#boxRecupera').hide();
			    $('#recuperaMsgSucesso').show();
			}
                    });
            },
            success: function(label) {
                    // set &nbsp; as text for IE
                    //label.html("&nbsp;").addClass("checked");
            }
    });
});