function getRequest() {
	http_request = false;

	if (window.XMLHttpRequest) {
		//对于Mozilla、Netscape、Safari等浏览器，创建XMLHttpRequest

		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			//如果服务器响应的header不是text/xml，可以调用其它方法修改该header
			http_request.overrideMimeType('text/xml');
		}
	} else if (window.ActiveXObject) {
		// 对于Internet Explorer浏览器，创建XMLHttpRequest
		try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	return http_request;
}
//获得Url 的responseText

function getResponseText(url)
{
	http_request=getRequest();
	http_request.open('GET', url, false);
	http_request.send(null);
	if (http_request.readyState == 4)
		　　 {
			　　　// 收到完整的服务器响应
				　　　if (http_request.status == 200) {
					　　  	//HTTP服务器响应的值OK
						　　　　  requestdoc = http_request.responseText;
					　　　　  //将服务器返回的字符串写到页面中ID为message的区域
				}
			　　　   else {
				　　　　  requestdoc = http_request.status;
				　　　   }
			　　  }
			return requestdoc;
}



//POST 提交数据

function posthttp(str,url){
	http_request=getRequest();
	http_request.open('POST',url,false);
	http_request.setRequestHeader("Content-Length",str.length);
	http_request.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded");
	http_request.send(str);
	if (http_request.readyState == 4)
	{
	　　　// 收到完整的服务器响应
	　　　if (http_request.status == 200) {
			//HTTP服务器响应的值OK
		　　　  requestdoc = http_request.responseText;
		　　　  //将服务器返回的字符串写到页面中ID为message的区域
			return requestdoc;
	}else{
	　　　　  //requestdoc = http_request.status;
		return false;
	　　 }
	}
}

//获得Url 的responseXML
function getXMLResponseText(url)
{
	http_request=getRequest();
	http_request.open('GET', url, false)
	http_request.send(null);
	if (http_request.readyState == 4)
		　　 {
			　　　// 收到完整的服务器响应
				　　　if (http_request.status == 200) {
					　　　　  //HTTP服务器响应的值OK
						　　　　  requestdoc = http_request.responseXML;
					　　　　  //将服务器返回的字符串写到页面中ID为message的区域

				}
			　　　   else {
				　　　　  requestdoc = http_request.status;
				　　　   }
				　　  }
				return requestdoc;
}



var msg	;
var li_ok='../images/li_ok.gif';
var li_err='../images/li_err.gif'
var bname_m=false;
function init_reg(){

	msg=new Array(

	"请输入4-20位字符(中文8个)。",

	"请输入4-20位字符，英文、数字的组合。",

	"请输入6-16位字符。",

	"请重复输入上面的密码。",

	"请输入您的E-mail,忘记密码需用到。",

	"请填写验证码。",

	"还没有选择喔,难道来自火星? ",

	"您已同意注册条款，可以注册。"

	)

	/*
	document.getElementById("d_username").innerHTML=msg[0];
	document.getElementById("d_password1").innerHTML=msg[2];
	document.getElementById("d_password2").innerHTML=msg[3];
	document.getElementById("d_email").innerHTML=msg[4];
	document.getElementById("d_code").innerHTML=msg[5];
	document.getElementById("d_area").innerHTML=msg[6];
	document.getElementById("d_passregtext").innerHTML=msg[7];
	*/

}

init_reg();
function on_input(objname){
	var strtxt;
	var obj=document.getElementById(objname);
	obj.className="d_on";
	//alert(objname);
	switch (objname){
		case "d_username":
			strtxt=msg[0];
			break;
		case "d_userdomain":
			strtxt=msg[1];
			break;
		case "d_password1":
			strtxt=msg[2];
			break;
		case "d_password2":
			strtxt=msg[3];

			break;

		case "d_email":

			strtxt=msg[4];

			break;

		case "d_code":

			strtxt=msg[5];

			break;

		case "d_area":

			strtxt=msg[6];

			break;

		case "d_passregtext":

			strtxt=msg[7];

			break;

	}

	obj.innerHTML=strtxt;

}

function reset_code(){
	try{
		var obj=document.getElementById("ob_codeimg");
		obj.src=obj.src;
	}
	catch(e){
		}

}

function out_username(){

	var obj=document.getElementById("d_username");

	var str=document.getElementById("login_name").value;

	var chk=true;

	if (DataLength(str)<4 || DataLength(str)>20){chk=false;}

	//if (str==''|| !str.match(/^-$/ig)){chk=false}

	//if (str.length<4 || str.length>16){chk=false;}

	if (chk){

		var username=escape(str);

		var rn=parseInt(Math.random()*1000);

		var usrurl="/api/user_ajax.php?do=user&username="+username+"&r="+rn;

		//document.write(usrurl);

		sta=getResponseText(usrurl);

		if (sta==1){

				chk=true;

				obj.className="d_ok";

				obj.innerHTML='该会员名可以注册。';

		}else if (sta==-1) {

				chk=false;

				obj.className="d_err";

				obj.innerHTML='用户名不合法。';

		}else if (sta==-2) {

				chk=false;

				obj.className="d_err";

				obj.innerHTML='包含不允许注册的词语。';

		}else if (sta==-3) {

				 chk=false;

				obj.className="d_err";

				obj.innerHTML='用户名已经存在。';

		}



	}else{

		obj.className="d_err";

		obj.innerHTML=msg[0];

	}

	return chk;

}

function out_username_getpass(){

	var str = document.getElementById("username").value;

	var obj = document.getElementById("d_username");

	//alert(str)

	var chk=true;

	if (DataLength(str)<4 || DataLength(str)>32){chk=false;}

	if (chk){

		var username=escape(str);

		var rn=parseInt(Math.random()*1000);

		var usrurl="/api/user_ajax.php?do=user&username="+username+"&r="+rn;

		 //document.write(usrurl);

		sta=getResponseText(usrurl);

		//alert(sta);

		if (sta==-3){

				chk=true;

				obj.className="d_ok";

				obj.innerHTML='用户名填写正确。';

		}else{

				chk=false;

				obj.className="d_err";

				obj.innerHTML='用户名不存在。';



		}



	}else{

		obj.className="d_err";

		obj.innerHTML='请输入您的用户名。';

	}

	return chk;

}
function out_password1(){
	var obj=document.getElementById("d_password1");
	var str=document.getElementById("login_pwd").value;
	var chk=true;
	if (str=='' || str.length<6 || str.length>16){chk=false;}
	if (chk){
		obj.className="d_ok";
		obj.innerHTML='密码已经输入。';
	}else{
		obj.className="d_err";
		obj.innerHTML=msg[2];
	}
	return chk;
}

function out_password2(){
	var obj=document.getElementById("d_password2");
	var str=document.getElementById("repassword").value;
	var chk=true;
	if (str!=document.getElementById("login_pwd").value||str==''){chk=false;}
	if (chk){
		obj.className="d_ok";
		obj.innerHTML='重复密码输入正确。';
	}else{
		obj.className="d_err";
		obj.innerHTML=msg[2];
	}

	return chk;

}
function out_password3(){
	var obj=document.getElementById("d_password1");
	var str=document.getElementById("reg_password").value;
	var chk=true;
	if (str=='' || str.length<6 || str.length>16){chk=false;}
	if (chk){
		//obj.className="d_ok";
		obj.innerHTML='密码已经输入。';
	}else{
		//obj.className="d_err";
		obj.innerHTML=msg[2];
	}
	return chk;
}
function out_password4(){
	var obj=document.getElementById("d_password2");
	var str=document.getElementById("repassword").value;
	var chk=true;
	if (str!=document.getElementById("reg_password").value||str==''){chk=false;}
	if (chk){
		//obj.className="d_ok";
		obj.innerHTML='重复密码输入正确。';
	}else{
		//obj.className="d_err";
		obj.innerHTML="请输入6-16位字符。";
		//window.alert("重复密码："+msg[3]);
	}
	return chk;

}
function out_code(){

	var obj=document.getElementById("d_code");

	var str=document.getElementById("code").value;

	var chk=true;

	str=str.replace(/ /g,"")

	if (str==''){chk=false}

	if (chk){

		var code=str;

		var rn=parseInt(Math.random()*1000);

		var usrurl="/api/user_ajax.php?do=code&code="+code+"&r="+rn;

		// document.write(usrurl);

		sta=getResponseText(usrurl);
		if(sta==false){
			chk=true;
			obj.className="d_ok";
			obj.innerHTML='验证码为检测，可以尝试注册。';
		}else{
			if(sta!=-1){
				chk=true;
				obj.className="d_ok";
				obj.innerHTML='验证码填写正确。';
			}else{
				chk=false;
				obj.className="d_err";
				obj.innerHTML='验证码错误,请重新填写';
			}
		}

	}else{
		obj.className="d_err";
		obj.innerHTML=msg[5];
		//window.alert("验证码："+msg[5]);
	}
	return chk;
}



function out_email(){

	var obj=document.getElementById("d_email");

	var str=document.getElementById("email").value;

	var chk=true;

	str=str.replace(/ /g,"")

	if (str==''|| !str.match(/^[\w\.\-]+@([\w\-]+\.)+[a-z]{2,4}$/ig)){chk=false}

	if (chk){

				obj.className="d_ok";

				obj.innerHTML='该邮件地址可以注册。';

	}else{

		obj.className="d_err";

		obj.innerHTML='邮件地址填写错误!';

	}

	return chk;

}



function out_email_getpass(){

	var obj=document.getElementById("d_email");

	var str=document.getElementById("email").value;

	var username=document.getElementById("username").value;

	var username=escape(username);

	var chk=true;

	str=str.replace(/ /g,"")

	if (str==''|| !str.match(/^[\w\.\-]+@([\w\-]+\.)+[a-z]{2,4}$/ig)){chk=false}

	if (chk){

		var email=str;

		var rn=parseInt(Math.random()*1000);

		var usrurl="/api/user_ajax.php?do=getpass&email="+email+"&username="+username+"&r="+rn;

		sta=getResponseText(usrurl);

		if(sta==1){

				chk=true;

				obj.className="d_ok";

				obj.innerHTML='邮件地址填写正确!';

			}else{

				chk=false;

				obj.className="d_err";

				obj.innerHTML='该邮件地址不正确!';

			}

	   }else{



				chk=false;

				obj.className="d_err";

				obj.innerHTML='该邮件地址不正确!';

		}





	return chk;

}

function out_passregtext(){
	var obj=document.getElementById("d_passregtext");
	var chk=true;
	if (document.form1.passregtext.checked){chk=false}
	//alert(chk);
	if (chk){
		obj.className="d_err";
		obj.innerHTML='只有同意注册条款后，才能注册。';
		chk=false;

	}else{
		obj.className="";
		obj.innerHTML='';
		chk=true;
	}
	return chk;
}

function chk_reg(){
	//var chk=true
    if (!out_username()){alert("该用户名己经注册或不符规则");return false;}
	if (!out_password1()){alert("请输入6-16位字符");return false;}
	if (!out_password2()){alert("二次用户名输入不一致");return false;}
	if (!out_email()){alert("邮件地址填写错误");return false;}  
	if (!out_code()){alert("验证码错误,请重新填写");return false;}
	if (!out_passregtext()){alert("只有同意注册条款后，才能注册");return false;}
	//if(chk){
	//document.getElementById('loginsubmit').disabled='disabled';
	//return(true);
	//}else
	//{
	//var obj=document.getElementById("submit_err");
	//obj.innerHTML='<img src="images/li_err.gif"> <font color="#ff0000">还有选项没有填写正确!';
	//return(false);
	//}

}


function chk_getpass(){
	var chk=true
    if (!out_username_getpass()){chk=false}
	if (!out_email_getpass()){chk=false}
	if (!out_code()){chk=false}
	if(chk){
	//document.getElementById('regbotton').disabled='disabled';
	return(true);
	}
	return(false);
}



function chk_getpass_2(){

	var chk=true

    if (!out_password3()){chk=false}

	if (!out_password4()){chk=false}

	if (!out_code()){chk=false}

	if(chk){

	//document.getElementById('regbotton').disabled='disabled';

	return(true);

	}

	return(false);

}



function chk_getpass_my(){

	var chk=true

    if (!out_password3()){chk=false}

	if (!out_password4()){chk=false}

	if(chk){

	//document.getElementById('regbotton').disabled='disabled';

	return(true);

	}

	return(false);

}





function show_returnssn(arrobj){

	if (arrobj){

		var oDialog = new dialog("/");

		oDialog.init();

		//alert(arrobj[1]);

		oDialog.set('src',arrobj[1]);

		oDialog.event(arrobj[0],'');

		oDialog.button('dialogOk',"document.getElementById('ssnbotton').disabled=''");

		document.getElementById('chkssn_stat').innerHTML='';

	}

}


function sl(st){

	sl1=st.length;

	strLen=0;

	for(i=0;i<sl1;i++){

		if(st.charCodeAt(i)>255) strLen+=2;

	 else strLen++;

	}

	return strLen;

}

//检测来自哪里

function out_area(){

	var obj=document.getElementById("d_area");

	var str=document.getElementById("area").value;

	var chk=true;

	if (str==''){chk=false;}

	if (chk){

		obj.className="d_ok";

		obj.innerHTML='您来自哪里已选择。';

	}else{

		obj.className="d_err";

		obj.innerHTML=msg[6];

	}

	return chk;

}

function checkerr(string)

{

var i=0;

for (i=0; i<string.length; i++)

{

if((string.charAt(i) < '0' || string.charAt(i) > '9')  &&  (string.charAt(i) < 'a' || string.charAt(i) > 'z') &&  (string.charAt(i)!='-'))

{

return 1;

}

}

return 0;//pass

}



//汉字长度判断

function DataLength(fData)

{

    var intLength=0

    for (var i=0;i<fData.length;i++)

    {

        if ((fData.charCodeAt(i) < 0) || (fData.charCodeAt(i) > 255))

            intLength=intLength+2

        else

            intLength=intLength+1

    }

    return intLength

}





function GEId(id){return document.getElementById(id);}

function DispPwdStrength(iN,sHL){

	if(iN>3){ iN=3;}

	for(var i=1;i<4;i++){

		var sHCR="ob_pws0";

		if(i<=iN){ sHCR=sHL;}

		if(iN>0){

		GEId("idSM"+i).className=sHCR;

		}

		//GEId("idSMT"+i).className="ob_pwfont2";

		if (iN>0){

			if (i<=iN){

			GEId("idSMT"+i).style.display=((i==iN)?"inline":"none");

			}

		}

		else{

		GEId("idSMT"+i).style.display=((i==iN)?"none":"inline");

		}

	}

}

//密码强度;

function PasswordStrength(showed)

{

    this.showed = (typeof(showed) == "boolean")?showed:true;

    this.styles = new Array();

    this.styles[0] = {backgroundColor:"#EBEBEB",borderLeft:"solid 1px #FFFFFF",borderRight:"solid 1px #BEBEBE",borderBottom:"solid 1px #BEBEBE"};

    this.styles[1] = {backgroundColor:"#FF4545",borderLeft:"solid 1px #FFFFFF",borderRight:"solid 1px #BB2B2B",borderBottom:"solid 1px #BB2B2B"};

    this.styles[2] = {backgroundColor:"#FFD35E",borderLeft:"solid 1px #FFFFFF",borderRight:"solid 1px #E9AE10",borderBottom:"solid 1px #E9AE10"};

    this.styles[3] = {backgroundColor:"#95EB81",borderLeft:"solid 1px #FFFFFF",borderRight:"solid 1px #3BBC1B",borderBottom:"solid 1px #3BBC1B"};

    this.labels= ["弱","中","强"];

    this.divName = "pwd_div_"+Math.ceil(Math.random()*100000);

    this.minLen = 1;//

    this.width = "155px";

    this.height = "18px";

    this.content = "";

    this.selectedIndex = 0;

    this.init();

}

PasswordStrength.prototype.init = function()

{

    var s = '<table cellpadding="0" id="'+this.divName+'_table" cellspacing="0" style="width:'+this.width+';height:'+this.height+';">';

    s += '<tr>';

    for(var i=0;i<3;i++){

        s += '<td id="'+this.divName+'_td_'+i+'" width="33%" align="center" style="padding-top:3px;"><span style="font-size:1px">&nbsp;</span><span id="'+this.divName+'_label_'+i+'" style="display:none;font-family: Courier New, Courier, mono;font-size: 12px;color: #000000;">'+this.labels[i]+'</span></td>';

    }

    s += '</tr>';

    s += '</table>';

    this.content = s;

    if(this.showed)

    {

        document.write(s);

        this.copyToStyle(this.selectedIndex);

    }

}

PasswordStrength.prototype.copyToObject = function(o1,o2)

{

    for(var i in o1)

    {

        o2[i] = o1[i];

    }

}

PasswordStrength.prototype.copyToStyle = function(id)

{

    this.selectedIndex = id;

    for(var i=0;i<3;i++)

    {

        if(i == id-1)

        {

            this.$(this.divName+"_label_"+i).style.display = "inline";

        }

        else

        {

            this.$(this.divName+"_label_"+i).style.display = "none";

        }

    }

    for(var i=0;i<id;i++)

    {

        this.copyToObject(this.styles[id],this.$(this.divName+"_td_"+i).style);

    }

    for(;i<3;i++)

    {

        this.copyToObject(this.styles[0],this.$(this.divName+"_td_"+i).style);

    }

}

PasswordStrength.prototype.$ = function(s)

{

    return document.getElementById(s);

}

PasswordStrength.prototype.setSize = function(w,h)

{

    this.width = w;

    this.height = h;

}

PasswordStrength.prototype.setMinLength = function(n)

{

    if(isNaN(n))

    {

        return ;

    }

    n = Number(n);

    if(n>1){

        this.minLength = n;

    }

}

PasswordStrength.prototype.setStyles = function()

{

    if(arguments.length == 0)

    {

        return ;

    }

    for(var i=0;i<arguments.length && i < 4;i++)

    {

        this.styles[i] = arguments[i];

    }

    this.copyToStyle(this.selectedIndex);

}

PasswordStrength.prototype.write = function(s)

{

    if(this.showed)

    {

        return ;

    }

    var n = (s == 'string') ? this.$(s) : s;

    if(typeof(n) != "object")

    {

        return ;

    }

    n.innerHTML = this.content;

    this.copyToStyle(this.selectedIndex);

}

PasswordStrength.prototype.update = function(s)

{

    if(s.length < this.minLen)

    {

        this.copyToStyle(0);

        return;

    }

    var ls = -1;

    if (s.match(/[a-z]/ig))

    {

        ls++;

    }

    if (s.match(/[0-9]/ig))

    {

        ls++;

    }

     if (s.match(/(.[^a-z0-9])/ig))

     {

        ls++;

    }

    if (s.length < 6 && ls > 0)

    {

        ls--;

    }

     switch(ls)

     {

         case 0:

             this.copyToStyle(1);

			 document.getElementById('pwd_qd').value=1;

             break;

         case 1:

             this.copyToStyle(2);

			 document.getElementById('pwd_qd').value=2;

             break;

         case 2:

             this.copyToStyle(3);

			 document.getElementById('pwd_qd').value=3;

             break;

         default:

             this.copyToStyle(0);

			 document.getElementById('pwd_qd').value=1;

     }

}






//此处用在注册时的阅读注册协议处
/*
函数说明：
url   移动层内的内容地址
title  标题
css   移动层的样式（不用包含TOP和LEFT）
cajax  是采用AJAX还是iframe方式调用内容 1为不采用AJAX 0为采用AJAX
scrolling 如果采用iframe 是否启用滚动条，默认为自动 有三个值 no yes auto
top 顶坐标 默认居中
left 顶坐标 默认居中
注意 使用前应引入/imgedit/manipulate.js
请在页面中加入 <div id='movediv' style="display:none;"></div>这个 一般加在最底部
*/
function movediv(url,title,css,cajax,scrolling,top,left,cssid)
{
	if(!cssid)
	{
		cssid="movediv";
	}
	document.getElementById(cssid).style.display='';
	
	if(!scrolling){scrolling='auto';}
	
	var infos='<div class="clear" id=move_div_info style="clear: both;text-align:center;height:100%"><\/div>';
	
	if(!title)
	{
		title='';
	}
	
	document.getElementById(cssid).innerHTML = '<div id="movediv_">'+
		'<div class="movediv clear" onmousedown="canmove(document.getElementById(\'movediv_\'),event)">'+
				'<div style="float:left;height:25px;clear: both;margin-top:8px;margin-left:5px;font-size: 12px;font-weight: bold;color: #FF9900;width:75%;text-align:left;">'+title+'<\/div>'+
				'<div style="float: right;cursor:pointer;height:25px;margin-top:5px;margin-right:3px;width:21px;text-align:right;" title="关闭" onClick="logoutdiv();"><img src="/images/move/close.jpg" width="21" height="21" \/><\/div>'+
		'<\/div>'+
		infos+
	'<\/div>';
	
	//loading('move_div_info','big');//载入

	//var ss=new shade_show("movediv_");
	//ss.show_fade();//渐变显示调用 
	
	var mobj=document.getElementById("movediv_");
	
	mobj.className=css;
	
	document.documentElement.scrollTop = 0; 

	var yw = document.documentElement.clientWidth; 
	
	var yh = document.documentElement.clientHeight; 
	
	var w = mobj.clientWidth||mobj.offsetWidth;
	
	var h = mobj.clientHeight||mobj.offsetHeight;
		
	if(!top && !left)
	{
		mobj.style.top=((yh/2)-(h/2))+"px";
			
		mobj.style.left=((yw/2)-(w/2))+"px";
	}else{
		if(!top)
		{
			mobj.style.top=((yh/2)-(h/2))+"px";
				
			mobj.style.left=left+"px";
		}else if(!left)
		{
			mobj.style.top=top+"px";
				
			mobj.style.left=((yw/2)-(w/2))+"px";
		}else{
			mobj.style.top=top+"px";
				
			mobj.style.left=left+"px";
		}

	}
	
	if(Number(cajax))
	{
		var str=document.getElementById("move_div_info");
		//var rn=parseInt(Math.random()*1000);
		//var usrurl="d_msg.php?r="+rn;
		sta=getResponseText(url);
		str.innerHTML=sta;
		//ajax_ultimate(url,'','','','move_div_info');
	}else{
		document.getElementById("move_div_info").innerHTML='<iframe src="'+url+'" hspace="0" vspace="0" frameborder="0" scrolling="'+scrolling+'" height="100%" width="100%"><\/iframe>';
	}
}







function logoutdiv(cssid)
{
	if(!cssid)
	{
		cssid="movediv";
	}
	document.getElementById(cssid).style.display='none';
}


function canmove(elementToDrag, event)
{
	var deltaX = event.clientX - parseInt(elementToDrag.style.left);
	var deltaY = event.clientY - parseInt(elementToDrag.style.top);
	
	elementToDrag.style.cursor = "move";
	
	if (document.addEventListener)
	{//2 级 DOM事件模型
		document.addEventListener("mousemove", moveHandler, true);
		document.addEventListener("mouseup", upHandler, true);
	}else if (document.attachEvent){//IE5+事件模型
	
		document.attachEvent("onmousemove", moveHandler);
		document.attachEvent("onmouseup", upHandler);
	}else {//IE4事件模型
		document.onmousemove = moveHandler;
		document.onmouseup = upHandler;
	}
	
	//禁止起泡
	if (event.stopPropagation)//DOM2
	event.stopPropagation();
	else event.cancelBubble = true;//IE
	
	if (event.preventDefault)
	event.preventDefault();
	else event.cancelBubble = true;
	
	function moveHandler(e)
	{
		if (!e)
		e = window.event;
		
		elementToDrag.style.left = (e.clientX - deltaX) + "px";
		elementToDrag.style.top = (e.clientY - deltaY) + "px";
		
		if (e.stopPropagation)
		e.stopPropagation();
		else e.cancelBubble = true;
	}
	
	function upHandler(e)
	{
		if (!e)
		e = window.event;
		
		elementToDrag.style.cursor = "default";
		
		if (document.removeEventListener)
		{ //DOM2
			document.removeEventListener('mousemove', moveHandler, true);
			document.removeEventListener('mouseup', upHandler, true);
			
		}else if (document.detachEvent) 
		{ //IE5+
			document.detachEvent("onmousemove", moveHandler);
			document.detachEvent("onmouseup", upHandler);
			
			
		}else {//IE4
			document.onmousemove = moveHandler;
			document.onmouseup = upHandler;
		}
		
		if (e.stopPropagation)
		e.stopPropagation();
		else e.cancelBubble = true;
	}
}
//*************移动层结束*********************************************/
function chkUsrIdCard(aIdCard){//aIdCard  身份证号码        
    num = aIdCard.toUpperCase();           //身份证号码为15位或者18位，15位时全为数字，18位前17位为数字，最后一位是校验位，可能为数字或字符X。        
    var obj=document.getElementById("d_sfz");
	  var chk=true;
	if (!(/(^\d{15}$)|(^\d{17}([0-9]|X)$)/.test(num))) {     
        alert('身份证号长度不对 或 不符合规定！\n(温馨提示您：15位身份证应全为数字，18位身份证末位可以为数字或X。)');              
        chk=false;        
    } //校验位按照ISO 7064:1983.MOD 11-2的规定生成，X可以认为是数字10。
    //下面分别分析出生日期和校验位
    var len, re; 
	len = num.length; 
	if (len == 15) {
        re = new RegExp(/^(\d{6})(\d{2})(\d{2})(\d{2})(\d{3})$/);
        var arrSplit = num.match(re);  //检查生日日期是否正确
        var dtmBirth = new Date('19' + arrSplit[2] + '/' + arrSplit[3] + '/' + arrSplit[4]);
        var bGoodDay; bGoodDay = (dtmBirth.getYear() == Number(arrSplit[2])) && ((dtmBirth.getMonth() + 1) == Number(arrSplit[3])) && (dtmBirth.getDate() == Number(arrSplit[4]));
        if (!bGoodDay) {         
            alert('身份证号的出生日期不对！请您检查');            
            chk=false;
        } else { //将15位身份证转成18位 //校验位按照ISO 7064:1983.MOD 11-2的规定生成，X可以认为是数字10。        
            var arrInt = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);         
            var arrCh = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');      
            var nTemp = 0, i;            
            num = num.substr(0, 6) + '19' + num.substr(6, num.length - 6);           
            for(i = 0; i < 17; i ++) {                 
                nTemp += num.substr(i, 1) * arrInt[i];        
            }
            num += arrCh[nTemp % 11];
            chk=true; 
        }
    }
    if (len == 18) {
        re = new RegExp(/^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X)$/);
        var arrSplit = num.match(re);  //检查生日日期是否正确
        var dtmBirth = new Date(arrSplit[2] + "/" + arrSplit[3] + "/" + arrSplit[4]);
        var bGoodDay; bGoodDay = (dtmBirth.getFullYear() == Number(arrSplit[2])) && ((dtmBirth.getMonth() + 1) == Number(arrSplit[3])) && (dtmBirth.getDate() == Number(arrSplit[4]));
        if (!bGoodDay) {
            alert('身份证号的出生日期不对！请您检查');
            chk=false; 
        }else { //检验18位身份证的校验码是否正确。 //校验位按照ISO 7064:1983.MOD 11-2的规定生成，X可以认为是数字10。
            var valnum;
            var arrInt = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
            var arrCh = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
            var nTemp = 0, i;
            for(i = 0; i < 17; i ++) {
                nTemp += num.substr(i, 1) * arrInt[i];
            }
            valnum = arrCh[nTemp % 11];
            if (valnum != num.substr(17, 1)) {
                alert('18位身份证的校验码不正确！请联系我们的客服帮您解忧。');
				//出现这个问题，到 http://qq.ip138.com/idsearch/ 这里生成玩家的18位身份证即可；
                chk=false; 
            }
            chk=true; 
        }
    } 
    if(chk)
    {
		obj.className="d_ok";
    	obj.innerHTML='该身份证有效';
    }
    else{
		obj.className="d_err";
    	obj.innerHTML='该身份证无效';
    }
    return chk;
}
function checkName(name)
{
var obj=document.getElementById("d_cnname");
var chk=true;
if(name.length <2){
	alert('真实姓名不能为空');
	chk=false;
	}	
	else{
		chk=true;
	}
	if(chk)
	{
		obj.className="d_ok";
		obj.innerHTML='该姓名有效';
	}
	else{
		obj.className="d_err";
		obj.innerHTML='该姓名无效';
	}
	return chk;
}


function on_answer(){
	var obj=document.getElementById("d_answer");
    var str=document.getElementById("answer").value;
	 var username=document.getElementById("username").value;
		var answer=str;
		var rn=parseInt(Math.random()*1000);
		var usrurl="/api/get_answer.php?answer="+answer+"&username="+username+"&r="+rn;
		
		//document.write(usrurl);
		sta=getResponseText(usrurl);
		if(sta==1)
		{
			
			obj.innerHTML='<font color="green">问题答案正确。</font>';
		}
		else
		{
			alert('问题答案错误');
			obj.innerHTML='<font color="red">问题答案错误。</font>';
		}
}
