function openwin(){
	window.open ("login.php","newwin", "height=430, width=380, top=110, left=110,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, stat us=no,directories=no") 
}
function register(){
	window.open ("login.php?action=register","newwin", "height=400, width=380, top=110, left=110,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, stat us=no,directories=no") 
}
function userCheck(){
	var username=document.form1.username.value;
	var pwd=document.form1.password.value;
	var repwd=document.form1.repassword.value;
	if(username==''){
		alert('请输入用户名');
		document.form1.username.focus()
		return false;
	}
		if(pwd==''){
		alert('请输入密码');
		document.form1.password.focus()
		return false;
	}
		if(username.length<6||username.length>32){
		alert('用户名长度必须在6-32');
		document.form1.username.focus()
		return false;
	}
	if(pwd.length<6||pwd.length>32){
		alert('密码长度必须在6-32');
		document.form1.password.focus()
		return false;
	}
	return true;
}
function pwdchk(obj){
	if(document.form1.password.value==obj.value&&obj.value.length>5&&obj.value.length<18)
	document.getElementById("pwdchk2").innerHTML="<font color='red'>密码符合要求！</font>"
	else document.getElementById("pwdchk2").innerHTML="<font color='red'>密码不合要求！</font>"
}
function passwordchk(obj){
	if(obj.value.length<6||obj.value.length18)
	document.getElementById("pwdchk").innerHTML="<font color='red'>密码长度6-18位</font>"
	else document.getElementById("pwdchk").innerHTML="<font color='red'>密码符合要求！</font>"
}
function emailchk(obj){
	var pattern=/^[a-zA-Z_0-9]+@[a-zA-Z_0-9]+\.[a-zA-Z_0-9]+$/
	if(pattern.test(obj.value))
	document.getElementById("emailchk").innerHTML="<font color='red'>√</font>"
	else document.getElementById("emailchk").innerHTML="<font color='red'>email格式不正确</font>"
}	
function qqchk(obj){
	var pattern=/^[0-9]{4,20}$/
	if(pattern.test(obj.value))
	document.getElementById("qqchk").innerHTML="<font color='red'>√</font>"
	else document.getElementById("qqchk").innerHTML="<font color='red'>qq格式不正确</font>"
}
function notempty(obj,id){
	if(obj.value!="")
	document.getElementById(id).innerHTML="<font color='red'>√</font>"
	else document.getElementById(id).innerHTML="<font color='red'>×</font>"
}

function secBoard(n){
 for(var i=0;i<document.getElementById("menu").childNodes.length;i++)
  document.getElementById("menu").childNodes[i].className="sec1";
  document.getElementById("menu").childNodes[n].className="sec2";
 for(var i=0;i<document.getElementById("maincontent").childNodes.length;i++)
  document.getElementById("maincontent").childNodes[i].className="unblock"
  document.getElementById("maincontent").childNodes[n].className="block"
} 

function ajaxFunction(obj)
 {
 var xmlHttp;
 try
    {
   // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
 catch (e)
    {

  // Internet Explorer
   try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
   catch (e)
      {

      try
         {
         xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
         }
      catch (e)
         {
         alert("您的浏览器不支持AJAX！");
         return false;
         }
      }
    }
xmlHttp.onreadystatechange=function(){
      if(xmlHttp.readyState==4){
	  if(xmlHttp.status==200){
         document.getElementById("userchk").innerHTML=xmlHttp.responseText;
		   }
		else document.getElementById("userchk").innerHTML="<font color='red'>你请求的页面存在错误，请刷新</font>"
      }
	  else document.getElementById("userchk").innerHTML="<font color='red'>正在检测,请梢后</font>"
}
	var p=obj.value
    xmlHttp.open("GET","action.php?action="+p+"&c="+Math.random(),true);
    xmlHttp.send(null);
}


function accountchk(){
var filter=/^\s*([A-Za-z0-9_-]+(\.\w+)*@(\w+\.)+\w{2,3})\s*$/;
 if (document.account.email.value =="" || !filter.test(document.account.email.value)){
 alert("电子邮件格式不正确！");
		  document.account.email.focus();
		  return false
  }
if (document.account.password.value!=document.account.pwd1.value){
	      alert("两次密码输入不一致！");
		  document.account.password.focus();
		  return false
		  } 
if (document.account.password.value==""||document.account.password.value.length<6||document.account.password.value.length>32){
	      alert("密码长度6-32");
		  document.account.password.focus();
		  return false
		  }  
if (document.account.number.value==""){
	      alert("请输入验证码！")
		  document.account.number.focus();
		  return false
		    }
if (document.account.question.value==""){
	      alert("请选择密码问题！")
		  document.account.question.focus();
		  return false
		    }
if (document.account.fullname.value==""){
	      alert("请输入您的真是名字！")
		  document.account.fullname.focus();
		  return false
		    }
if (document.account.birth.value==""){
	      alert("出生日期不能为空！");
		  document.account.birth.focus();
		  return false
}

if (document.account.address.value==""){
	      alert("联系地址不能为空！");
		  document.account.address.focus();
		  return false
 } 
if (document.account.postcode.value==""){
	      alert("邮政编码不能为空！");
		  document.account.postcode.focus();
		  return false
} 
if (document.account.id_verification.value==""){
	      alert("请选择您要上传的证件类型！");
		  document.account.id_verification.focus();
		  return false
} 
if (document.account.authenticatenumber.value==""){
	      alert("请输入您的证件号码！");
		  document.account.authenticatenumber.focus();
		  return false
} 
if (document.account.userfile.value==""){
	      alert("请上传您的证书复印件！");
		  document.account.userfile.focus();
		  return false
} 
	return true
   }
function display(id){
	if(document.getElementById(id).style.display=="block")
	document.getElementById(id).style.display="none"
	else
	document.getElementById(id).style.display="block"
}