﻿function CheckUserName(theform)		//----Choose an account ID and check if it is usable.
{
	if (!checkvalue(theform.txtAccount,4,15,32,"Account ID"))	return false;
	if (!CheckIfEnglish4Reg(theform.txtAccount.value))
	{
		alert("账号应该由 a-z, A-Z , 0-9 组成!");
		theform.txtAccount.focus();
		theform.txtAccount.select();
		return false;
	}
}

function selectQue()
{
//alert(document.getElementById("selectQuestion").value);
if(document.getElementById("selectQuestion").value=="1")
{
document.getElementById("txtQuestion").value="";
document.getElementById("divquestion").style.display="block";
}
else
{
document.getElementById("txtQuestion").value=document.getElementById("selectQuestion").value;
document.getElementById("divquestion").style.display="none";
}
}
function CheckRegStep1(theform)
{
	if( typeof(theform.isAgreement)!="undefined" && theform.isAgreement.checked==false )
	{
		alert("请选择同意.");
		return false;
	}	
	
	
	if (!checkvalue(theform.txtAccount,4,70,32,"账号"))	return false;
	if (!CheckIfEnglish4Reg(theform.txtAccount.value))
	{
		alert("账号应该由 a-z, A-Z , 0-9 或邮箱组成!");
		theform.txtAccount.focus();
		theform.txtAccount.select();
		return false;
	}
if (document.getElementById('yes18').checked==true)
	{
 
	}
	else if (document.getElementById('no18').checked==true)
	{
 
	}
	else
	{
	alert("请选择是否已满18周岁");
 
		return false;
	}

	if (!checkvalue(theform.txtPassword,7,14,32,"密码"))	return false;
	if (!CheckIfEnglish(theform.txtPassword.value))
	{
		alert("7-14位数字和字母!");
		theform.txtPassword.focus();
		theform.txtPassword.select();
		return false;
	}
	if (!checkvalue(theform.txtConfirmPassword,7,14,32,"确认密码"))	return false;
	if (!CheckIfEnglish(theform.txtConfirmPassword.value))
	{
		alert("7-14位数字和字母!");
		theform.txtConfirmPassword.focus();
		theform.txtConfirmPassword.select();
		return false;
	}	
	if(theform.txtPassword.value!=theform.txtConfirmPassword.value)
	{
		alert("Your passwords don't match!");
		theform.txtPassword.focus();
		theform.txtPassword.select();
		return false;
	}
	
	if (!checkvalue(theform.txtRealName,1,12,32,"真实姓名"))	return false;
	if (!checkvalue(theform.txtEmail,1,40,32,"邮箱地址"))	return false;
	
	if (!checkemail(theform.txtEmail.value))
	{
		alert("邮箱地址错误 ");
		theform.txtEmail.focus();
		theform.txtEmail.select();
		return false;
	}
	if (theform.txtEmail.value.toLowerCase()!=theform.txtConfirmEmail.value.toLowerCase())
	{
		alert("确认邮箱不正确!");
		theform.txtEmail.focus();
		theform.txtEmail.select();
		return false;
	}
	
  

	if(!checkvalue(theform.txtQuestion,4,30,32,"密保问题"))	return false;
	if(!checkvalue(theform.txtAnswer,4,30,32,"密保答案"))	return false;
	if(!checkvalue(theform.txtConfirmAnswer,0,0,1,"确认密保答案"))	return false;
	if(theform.txtAnswer.value.toLowerCase()!=theform.txtConfirmAnswer.value.toLowerCase())
	{
		alert("确认密保答案不正确!");
		theform.txtAnswer.focus();
		theform.txtAnswer.select();
		return false;
	}	
}

function CheckRegStep2(theform)
{
	if (!checkvalue(theform.txt_country,0,16,32,"Residence Country"))	return false;
	if (!checkvalue(theform.txt_teltphone,0,20,32,"Telephone"))	return false;
	if (!checkvalue(theform.txt_zipcode,0,7,32,"Zip Code"))	return false;
	if (!checkvalue(theform.txt_address,0,50,32,"Address"))	return false;
}


function CheckResetPassword(theform)
{
	if (!checkvalue(theform.txtPassword,10,14,32,"密码"))	return false;
	if (!CheckIfEnglish(theform.txtPassword.value))
	{
		alert("密码应该是7-14位数字和字母!");
		theform.txtPassword.focus();
		theform.txtPassword.select();
		return false;
	}
	if (!checkvalue(theform.txtCPassword,10,14,32,"确认密码"))	return false;
	if (!CheckIfEnglish(theform.txtCPassword.value))
	{
		alert("确认密码应该是7-14位数字和字母!");
		theform.txtCPassword.focus();
		theform.txtCPassword.select();
		return false;
	}	
	if(theform.txtPassword.value!=theform.txtCPassword.value)
	{
		alert("确认密码不对!");
		theform.txtPassword.focus();
		theform.txtPassword.select();
		return false;
	}
}
function rediect()
		{
		 
		if(document.getElementById("lblUrl")!=null)
		{
		window.setTimeout("rediectUrl()",30000);
		}	
		}
		 
		function rediectUrl()
		{ 
		window.location.href=document.getElementById("lblUrl").innerHTML;
		}
 