// JavaScript Document
// prepare the form when the DOM is ready 
$(document).ready(function() { 

	var optionsLogin = { 
        success:       showResponseLogin  // post-submit callback 
    };
 

	
	$('#frmLogin').submit(function() { 
        $(this).ajaxSubmit(optionsLogin); 
        return false; 
    }); 
	
	 $("input").keypress(function (e) {
		$("#mensajeLogin").html("");						   
	 });
}); 
 

// post-submit callback 
function showResponseLogin(responseText, statusText)  { 
	if(responseText==""){
		$('#frmLogin').reset();
		$("#mensajeLogin").html("<h3>Correo o Contrase&ntilde;a Incorrecta</h3>");
		$('#txtCorreo').focus();
	}
	if(responseText=="1"){
		location.reload(true);
	}
	if(responseText=="2"){
		$('#frmLogin').reset();
		$("#mensajeLogin").html("<h3>Correo o Contrase&ntilde;a Incorrecta</h3>");
		$('#txtCorreo').focus();
	}
	if(responseText=="3"){
		$('#frmLogin').reset();
		$("#mensajeLogin").html("<h3>Su sesi&oacute;n ha sido bloqueada durante la siguiente hora por intentos fallidos.</h3>");
		$('#txtCorreo').focus();
	}
}


 jQuery.fn.reset = function () {
  $(this).each (function() { this.reset(); });
} 
