<!--
//Copyright 1998. ZYX Productions. All rights reserved.
//**开始编码**
var xmlhttp = null;

if(typeof(XMLHttpRequest) == undefined && window.ActiveXObject) {
function XMLHttpRequest() {
var arrSignatures = ['MSXML2.XMLHTTP.5.0','MSXML2.XMLHTTP.4.0','MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP','Microsoft.XMLHTTP'];
for(var i = 0; i < arrSignatures.length; i++) {
try {
var orequest = new ActiveXObject(arrSignatures[i]);
return orequest;
}
catch (oError) {
}
}
return null;
}
}

function iniXMLHTTP() {
if(null == xmlhttp) {
xmlhttp = new XMLHttpRequest();
}
if(null == xmlhttp) {
alert("Your browser does not support asynchronous communication");
return false;
}
return true;
} 

function checkusername()
{
	var strText;
	var username;
	var id;
	
	if(!iniXMLHTTP()) return false;
	username = document.myform.username.value;
	if( username == "" )
	{
		alert("Please enter the login name.");
		document.myform.username.focus();
	}
	else
	{
		xmlhttp.open("GET","checkusername.asp?username="+username,false);
		xmlhttp.send(null);
		//strText = bytes2BSTR(xmlhttp.responseBody);
		strText=xmlhttp.responseText;
		if(strText=="1")
		{
			alert("This account can be used。");
		}
		else
		{
			alert("This account has been used。")
		}
		//OpenWin( "../checkusername.asp?username="+username, 2500,2500, 0, 0 );
	}
	
	return false;
}
function isEmail(strEmail) {
  if (strEmail.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
   return true;
  else
   return false;
 }

function check_value(){
	var usernamelength;
	var usernameevalue;
	usernamevalue=document.myform.username.value;
	usernamelength=document.myform.username.value.length;
	if(usernamelength<4 || usernamelength>16)
	{
		alert("Username must be:\n4 to 16 letters or numbers");
		document.myform.username.focus();
		return false;
	}

    var jgpattern =/^[A-Za-z0-9]+$/; 
	if(!jgpattern.test(usernamevalue)){ 
			alert("Username contains an error character must be a combination of letters and numbers!");
			document.myform.username.select();
			return false;
		}
	//-------------------------------------
		if(document.myform.mailbox.value=="")
	{
		alert("Please enter your E-mail Address");
		document.myform.mailbox.focus();
		return false;
	}
    if(!isEmail(document.myform.mailbox.value)){
        alert('E-mail address format incorrect!');
        document.myform.mailbox.focus();
        return false;
	}
    if(document.myform.mobile.value=="")
	{
		alert("Please fill out your call phone!");
		document.myform.mobile.focus();
		return false;
	}
	var reg = /^0*(13|15)\d{9}$/;
	if(!reg.test(document.myform.mobile.value)){
		alert("Mobile format is incorrect!");
		document.myform.mobile.select;
		return false;
		}
	var passwordlength;
	var passwordvalue;
	passwordvalue=document.myform.password.value;
	passwordlength=document.myform.password.value.length;
	if(passwordlength==0)
	{
		alert("Please enter your password");
		document.myform.password.focus();
		return false;
	}
	if(passwordlength<6 || passwordlength>20)
	{
		alert("Password must be:\n6 to 20 letters or numbers");
		document.myform.password.select();
		return false;
	}

	if(!jgpattern.test(passwordvalue))
		{
			alert("Your password contains an error character must be a combination of letters and numbers!");
			document.myform.password.select();
			return false;
		}
	if(document.myform.password2.value=="")
	{
	    alert("Please enter your password to confirm!");
		document.myform.password2.focus();
		document.myform.password2.focus();
		return false;
	}
	if(document.myform.password.value!=document.myform.password2.value)
	{
		alert("You enter the second password inconsistent, please re-enter");
		document.myform.password.focus();
		return false;
	}
	//if(document.myform.company.value=="")
	//{
		//alert("请输入您的公司全称");
		//document.myform.company.focus();
		//return false;
	//}
//if(document.myform.name1.value.length<2)
	//{
		//alert("请输入联系人姓名!");
		//document.myform.name1.focus();
		//return false;
	//}
	//--------------------------------------
	//-------------------------------------
	//if(document.myform.telephone.value=="")
	//{
		//alert("请输入你的电话号码");
		//document.myform.telephone.focus();
		//return false;
	//}
    //var reg=/^(\d{3,4}-)?\d{7,9}$/; 
    //if(!reg.test(document.myform.telephone.value))
	//{
	    //alert("电话号码格式错误,请正确输入你的电话号码");
		//document.myform.telephone.select();
		//return false;	
	//}
	//-------------------------------------
	//if(document.myform.fax.value=="")
	//{
		//alert("请输入你的传真");
		//document.myform.fax.focus();
		//return false;
	//}
	//if(!reg.test(document.myform.fax.value))
	//{
	    //alert("传真格式错误,请正确输入你的传真号码");
		//document.myform.fax.select();
		//return false;	
	//}
	//-------------------------------------
	//if(document.myform.address.value=="")
	//{
		//alert("请输入你的联系地址");
		//document.myform.address.focus();
		//return false;
	//}
	//-------------------------------------
	if(document.myform.vcode.value==""){
		alert("Please enter the validate code!");
		document.myform.vcode.focus();
		return false;
		}
	document.myform.submit();
	return true;
}
//-->
