function CheckForm(){ 

if(!document.form1.radio[0].checked)
    {      
	  alert("同意するは必須入力です")
      return false; 
    }

  if(form1.username.value==""){
  alert("ユーザー名は必須入力です"); 
   form1.username.focus(); 
   return false;}else{
   reg=/^([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/gi;
   if(!reg.test(form1.username.value)){
      alert("正しいEmailアドレスを入力してください");
      form1.username.focus();
      return false; 
    }

   }
  if (document.form1.username.value.length<5){ 
  alert("ユーザー名は半角英数4～１0桁") 
  form1.username.focus(); 
  return false; 
  }   
  if (document.form1.regpassword.value==""){ 
  alert("パスワードは必須入力です") 
  form1.regpassword.focus();
  return false; 
  } 
  if (document.form1.regpassword.value.length<6){ 
  alert("パスワードは半角英数6～20桁") 
  form1.regpassword.focus();
  return false; 
  } 
  if (document.form1.regpassword2.value==""){ 
  alert("パスワードは必須入力です") 
  form1.regpassword2.focus();
  return false; 
  } 
  if (document.form1.regpassword.value!=document.form1.regpassword2.value){ 
  alert("パスワードが違います") 
  form1.regpassword2.focus();
  return false; 
  } 

} 

//XMLHttpRequest 
    var xmlhttp = false;
    try {
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
        try {
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (e2) {
            xmlhttp = false;
        }
    }
    if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
        xmlhttp = new XMLHttpRequest();
    }
    function Ajax(data){    
        xmlhttp.open("GET","reg_check.php?username="+escape(document.getElementById("username").value),true);
        xmlhttp.send(null);
    
        xmlhttp.onreadystatechange=function(){
            if (4==xmlhttp.readyState){
                if (200==xmlhttp.status){
                    document.getElementById("tip").innerHTML=xmlhttp.responseText;
                }else{
                    alert("erro!");
                }
            }
        }
    }

    function chkUserName(obj){
        if(obj.value.length<1){
            obj.style.backgroundColor="#efefef";
            alert("ユーザー名は必須入力です");
            obj.focus();
        }else{
            //调用Ajax函数,向服务器端发送查询
            Ajax(obj.value);
        }            

     

    }
//-->
