function chkForm1()
{
	var iUserName=document.getpwdForm.USER_NAME

	if (iUserName.value=="")
	{
		alert("Please enter your username!");
		iUserName.focus();
		return false
	}

	if (iUserName.value.length<3 || iUserName.value.length>16)
	{
		alert("The length of username must be 3-16 bytes!");
		iUserName.focus();
		return false
	}

	return true;
}

function chkForm2()
{
	var iUserAnswer=document.getpwdForm.USER_ANSWER

	if (iUserAnswer.value=="")
	{
		alert("Please enter the reminder answer!");
		iUserAnswer.focus();
		return false
	}
}

function chkForm3()
{
	var iUserPasswordNew1=document.getpwdForm.USER_PASSWORD_NEW1
	var iUserPasswordNew2=document.getpwdForm.USER_PASSWORD_NEW2

	if (iUserPasswordNew1.value=="")
	{
		alert("Please enter your new password!");
		iUserPasswordNew1.focus();
		return false
	}

	if (iUserPasswordNew1.value.length<6 || iUserPasswordNew1.value.length>16)
	{
		alert("The length of password must be 6-16 bytes!");
		iUserPasswordNew1.focus();
		return false
	}

	if (!isPasswordOK(iUserPasswordNew1.value))
	{
		alert("The password can only be composed of letters, numbers and special characters!");
		iUserPasswordNew1.focus();
		return false
	}

	if (iUserPasswordNew2.value=="")
	{
		alert("Please re-enter your new password!");
		iUserPasswordNew2.focus();
		return false
	}

	if (iUserPasswordNew2.value.length<6 || iUserPasswordNew2.value.length>16)
	{
		alert("The length of password must be 6-16 bytes!");
		iUserPasswordNew2.focus();
		return false
	}

	if (!isPasswordOK(iUserPasswordNew2.value))
	{
		alert("The new password can only be composed of letters, numbers and special characters!");
		iUserPasswordNew2.focus();
		return false
	}

	if (iUserPasswordNew1.value!=iUserPasswordNew2.value)
	{
		alert("The second password is not same as the first!");
		iUserPasswordNew2.focus();
		return false
	}

	return true;
}

function isPasswordOK(str)
{
	var i;
	for (i=0; i<str.length; i++) {
		if (str.charCodeAt(i)>255) return false;
	}
	return true;
}