$(document).ready(function(){
    $("#btn_logar_minha_conta").click(function(){
        var email 		= $("#email").val();
        var log_senha = $("#log_senha").val();

        if (email.length == 0){
            alert('Campo e-mail é obrigatório!');
            $("#email").focus();
            return false;
        }
	    if (!checkEmail(email)) {
	      alert("E-mail está inválido"); 
	      $("#email").focus();
	      return false;
	    }

        if (log_senha.length == 0){
            alert('Campo senha é obrigatório!');
            $("#log_senha").focus();
            return false;
        }        
        $("#lbl_loader_minha_conta").html('<img src="img/loader.gif" />').show();
        $.ajax({
	        url         : "actions/cliente.php",
	        dataType    : "xml",
	        type        : "POST",
	        data        : "act=1&senha="+log_senha+"&email="+email, 
	        success:function (xml) 
	        {
//				alert(xml)
	            $("#lbl_loader_minha_conta").hide().html("");
		        if ($(xml).find('codigo').text() == 0)
		        {
			        alert("Usuário ou senha inválidos.");
			        $("#email").focus();
		        }
		        else 
		            location.href = "cliente-index.php";
	        }, 
	        error: function(XMLHttpRequest, textStatus, errorThrown) { alert("Error: " + textStatus + " - " + errorThrown); }
        });        
    })
})

