$(function() {
	$("#userID").focus();
	$("#loginForm").submit(function() {
		$(this).ajaxSubmit({
			beforeSubmit: function() {
				if ( $.trim($("#userID").val()) == "" ) {
					alert("아이디를 입력해주세요.");
					$("#userID").focus();
					return false;
				}
				if ( $.trim($("#userPW").val()) == "" ) {
					alert("패스워드를 입력해주세요.");
					$("#userPW").focus();
					return false;
				}
			},
			success: function(retValue) {
				if ( retValue != 0 ) {
					location.href=retValue;
				}
			}
		});
		return false;
	});

	$("#logout").click(function() {
		$.get($(this).attr("href"), function(retValue) {
			if ( retValue == 1 ) {
				location.href='/aing';
			}
		});
		return false;
	});
});