function userLogin()
{
	var frm = document.getElementById("loginForm");
	var check = inputCheck(frm);
	if(!check) return ;

	var ajaxObj      = new AjaxFrame;
	ajaxObj.url      = "index.php";
	ajaxObj.method   = "POST";
	ajaxObj.content  = "username=" + frm.username.value + "&password=" + frm.password.value + "&authNum=" + frm.authNum.value;
	ajaxObj.callback = loginResult;
	ajaxObj.sendReq();

}

function inputCheck(frm)
{
	var username = frm.username.value;
	var password = frm.password.value;
	var authNum  = frm.authNum.value;


	if(username == "")
	{
		alert("请输入用户名称!");
		frm.username.focus();
		return false;
	}

	if(password == "")
	{
		alert("请输入用户密码!");
		frm.password.focus();
		return false;
	}
	
	if(authNum == "")
	{
		alert("请输入验证码!");
		frm.authNum.focus();
		return false;
	}
	return true;
}

function loginResult(httpReq,objId)
{
	if(httpReq.responseText == 1)
	{
		top.location.href = "index.php";
	}
	else
	{
		alert(httpReq.responseText);
		getAuthCode();
	}
}

function getAuthCode()
{
	document.getElementById("authCode").src = "AuthImg.php";
}

