﻿//用户登陆	
function BeginLogin(){
    var strName = document.getElementById("txtName").value;
    var strPwd = document.getElementById("txtPwd").value;
    var strchk = document.getElementById("checkcode").value;
	if (strName.trim() == ""){
		alert('请输入用户名！');
		getFocus('txtName');
	    return false;
	}
	if (strPwd.trim() == ""){
		alert('请输入密码！');
		getFocus('txtPwd');
	    return false;
	}
	if (strchk.trim() == ""){
		alert('请输入验证码！');
		getFocus('checkcode');
	    return false;
	}
    var option={
         parameters:"&time="+Math.random()+"&type=UserLogin&strName="+strName+"&strPwd="+strPwd+"&Chkcode="+strchk,
         method:"get",
         onSuccess:function(transport){
    		var result=transport.responseText;
             if(result==3){
                  window.location.href='index.asp';
             }
             else if(result==2){
         		alert('用户信息不正确，请仔细检查！');
				getFocus('txtName');
	            return false;
             }
             else if(result==0){
         		alert('请不要输入非法字符！！');
				getFocus('txtName');
	            return false;
             }
             else if(result==1){
         		alert('数据库错误，请联系管理员！！');
				getFocus('txtName');
	            return false;
             }
             else if(result==4){
         		alert('验证码填写错误！！');
				getFocus('checkcode');
	            return false;
             }
             else{
         		alert('登陆发生错误！');
				getFocus('txtName');
	            return false;
             }
          },
          onFailure:function(transport){
             alert("内部错误，请重新刷新网页！");
          }
      }
      var request = new Ajax.Request("SeoAjax.asp",option);
 }