
function checkLogin() {

	if(!$("#authLogin").val()) { $("#authLogin").focus(); return false; }
	if(!$("#authPassword").val()) { $("#authPassword").focus(); return false; }

	$("#notice > span").html(wait_message);
	$("#notice").show();

	$.ajax({
		type: "POST",
		url: "/engine/signin.php",
		data: "Type=ajax&Login=" + $("#authLogin").val() + "&PasswordType=md5&PasswordHash=" + $.md5($("#authPassword").val()),
		success: function(msg) {
			if(msg == "ok") {
				$("#authPasswordHash").val($.md5($("#authPassword").val()));
				$("#authPasswordType").val("md5");
				$("#authPassword").val("");
				$("#authForm").submit();
			} else {
				var message = img_error + ((msg == 'banned') ? "Attempt of password attack, your IP is blocked" : "Authorization error");

				$("#notice").hide();
				$("#notice > span").html(message);
				$("#notice").fadeIn(200);

				if(msg != 'banned') {
					$("#authLogin").select();
					$("#authLogin").focus();
				}
			}
		}
	});

	return false;
}

