﻿// var lang=document.getElementById("ajax").getAttribute("lang");
function loadlogin(str){
	var url=sysdir+"user/ajaxlogin.asp?lang="+lang; // 构造服务器的地址URL
	var xmlHttp=CreateXMLHttpRequest(); //建立AJAX对象
    xmlHttp.open("GET", url, true);
	xmlHttp.onreadystatechange = function() 
{
		if (xmlHttp.readyState == 4 && xmlHttp.status == 200) 
	  {
		   document.getElementById('AjaxLogin').innerHTML=xmlHttp.responseText;
		}
	}
    xmlHttp.setRequestHeader("If-Modified-Since","0"); // 伪造报头
	xmlHttp.send(null);
}

function signin(){
	var sUserName = escape(document.getElementById('sUserName').value); // 根据id取得输入的内容
    var sPassword = escape(document.getElementById('sPassword').value);
	document.getElementById('sUserName').value=""; //清空输入
	document.getElementById('sPassword').value="";
    // 判断输入是否为空
	if (sUserName=="")
	{
	alert("用户名不能为空！");
	return false;
	}
	if (sPassword=="")
	{
	alert("密码不能为空！");
    return false;
	}
	var url=sysdir+"user/ajaxlogin.asp?lang="+lang+"&action=signin&UserName="+sUserName+"&Password="+sPassword;
	var xmlHttp=CreateXMLHttpRequest();
    xmlHttp.open("GET", url, true);
	xmlHttp.onreadystatechange = function() 
{
		if (xmlHttp.readyState == 4 && xmlHttp.status == 200) 
	  {
		   document.getElementById('AjaxLogin').innerHTML=xmlHttp.responseText;
		}
	}
    xmlHttp.setRequestHeader("If-Modified-Since","0");
	xmlHttp.send(null);
}

function loginout(){
	var url=sysdir+"user/ajaxlogin.asp?lang="+lang+"&action=loginout";
	var xmlHttp=CreateXMLHttpRequest();
    xmlHttp.open("GET", url, true);
	xmlHttp.onreadystatechange = function(){
		if (xmlHttp.readyState == 4 && xmlHttp.status == 200) 
	  {
		   document.getElementById('AjaxLogin').innerHTML=xmlHttp.responseText;
		}
	}
    xmlHttp.setRequestHeader("If-Modified-Since","0");
	xmlHttp.send(null);
}




// 登录验证
function ChkLoginAccount(){
    var ChkValue = escape(document.getElementById('LoginAccount').value);
	var url=sysdir+"user/userchk.asp?lang="+lang+"&action=ChkLoginAccount&ChkValue="+ChkValue;
	var xmlHttp=CreateXMLHttpRequest();
    xmlHttp.open("GET", url, true);
	xmlHttp.onreadystatechange = function(){
	  if (xmlHttp.readyState == 4 && xmlHttp.status == 200){
		 document.getElementById('mLoginAccount').innerHTML=xmlHttp.responseText;
      }
	}
    xmlHttp.setRequestHeader("If-Modified-Since","0");
	xmlHttp.send(null);
}

function ChkLoginPassword(){
    var ChkValue = escape(document.getElementById('LoginPassword').value);
    var ChkValueA = escape(document.getElementById('LoginAccount').value);
	var url=sysdir+"user/userchk.asp?lang="+lang+"&action=ChkLoginPassword&ChkValue="+ChkValue+"&ChkValueA="+ChkValueA;
	var xmlHttp=CreateXMLHttpRequest();
    xmlHttp.open("GET", url, true);
	xmlHttp.onreadystatechange = function(){
	  if (xmlHttp.readyState == 4 && xmlHttp.status == 200){
		 document.getElementById('mLoginPassword').innerHTML=xmlHttp.responseText;
      }
	}
    xmlHttp.setRequestHeader("If-Modified-Since","0");
	xmlHttp.send(null);
}

function ChkVerifyCode(){
    var ChkValue = escape(document.getElementById('VerifyCode').value);
	var url=sysdir+"user/userchk.asp?lang="+lang+"&action=ChkVerifyCode&ChkValue="+ChkValue;
	var xmlHttp=CreateXMLHttpRequest();
    xmlHttp.open("GET", url, true);
	xmlHttp.onreadystatechange = function(){
	  if (xmlHttp.readyState == 4 && xmlHttp.status == 200){
		 document.getElementById('mVerifyCode').innerHTML=xmlHttp.responseText;
      }
	}
    xmlHttp.setRequestHeader("If-Modified-Since","0");
	xmlHttp.send(null);
}







function ChkEmail(){
    var ChkValue = escape(document.getElementById('Email').value);
	var url=sysdir+"user/userchk.asp?lang="+lang+"&action=ChkEmail&ChkValue="+ChkValue;
	var xmlHttp=CreateXMLHttpRequest();
    xmlHttp.open("GET", url, true);
	xmlHttp.onreadystatechange = function(){
	  if (xmlHttp.readyState == 4 && xmlHttp.status == 200){
		 document.getElementById('mEmail').innerHTML=xmlHttp.responseText;
      }
	}
    xmlHttp.setRequestHeader("If-Modified-Since","0");
	xmlHttp.send(null);
}


function ChkGetPassEmail(){
    var ChkValue = escape(document.getElementById('Email').value);
	var url=sysdir+"user/userchk.asp?lang="+lang+"&action=ChkGetPassEmail&ChkValue="+ChkValue;
	var xmlHttp=CreateXMLHttpRequest();
    xmlHttp.open("GET", url, true);
	xmlHttp.onreadystatechange = function(){
	  if (xmlHttp.readyState == 4 && xmlHttp.status == 200){
		 document.getElementById('mEmail').innerHTML=xmlHttp.responseText;
      }
	}
    xmlHttp.setRequestHeader("If-Modified-Since","0");
	xmlHttp.send(null);
}

function ChkUserName(){
	var ChkValue = escape(document.getElementById('UserName').value);
    // 获取文本框中输入的内容，经过两次编码防止中文乱码  
	// ChkValue = encodeURI(encodeURI(ChkValue));
	var url=sysdir+"user/userchk.asp?lang="+lang+"&action=ChkUserName&ChkValue="+ChkValue+"";
	var xmlHttp=CreateXMLHttpRequest();
    xmlHttp.open("GET", url, true);
	xmlHttp.onreadystatechange = function(){
	  if (xmlHttp.readyState == 4 && xmlHttp.status == 200){
		 document.getElementById('mUserName').innerHTML=xmlHttp.responseText;
      }
	}
    xmlHttp.setRequestHeader("If-Modified-Since","0");
	xmlHttp.send(null);
}

function ChkCheckCode(){
    var ChkValue = escape(document.getElementById('CheckCode').value);
	var url=sysdir+"user/userchk.asp?lang="+lang+"&action=ChkCheckCode&ChkValue="+ChkValue;
	var xmlHttp=CreateXMLHttpRequest();
    xmlHttp.open("GET", url, true);
	xmlHttp.onreadystatechange = function(){
	  if (xmlHttp.readyState == 4 && xmlHttp.status == 200){
		 document.getElementById('mCheckCode').innerHTML=xmlHttp.responseText;
      }
	}
    xmlHttp.setRequestHeader("If-Modified-Since","0");
	xmlHttp.send(null);
}
