/*********************************\
|* 阿假笨笨表单注册认证JS           *|
|* www.webhulian.com             *|
|* @author songs@webhulian.com   *|
|* QQ:79648914                   *|
|* Email:ss423@163.com           *|
\*********************************/
var registerForm = new Form();

registerForm.checkForm = function(theform) {
	var _parent = this;
	_parent.form = theform;
	_parent.hiddenAll();
	
	theform['subtn'].disabled = true;
	
	var _bool = true;
	
	var _username = _parent.getText('username');
	if (_username == '') {
		_parent.writeErr(Language.Register.err_username,'username');
		_bool = false;
	}
	
	if (!_parent.isUsername(_username)) {
		_parent.writeErr(Language.Register.err_username2,'username');
		_bool = false;
	}
	
	if (_parent.getXML('./duplicate.php?t=username&v='+_username) == '1') {
		_parent.writeErr(Language.Register.err_username3,'username');
		_bool = false;
	}
	
	var _email = _parent.getText('email');
	if (_email == '') {
		_parent.writeErr(Language.Register.err_email,'email');
		_bool = false;
	}
	
	var _password = _parent.getText('password');
	if (_password == '') {
		_parent.writeErr(Language.Register.err_password,'password');
		_bool = false;
	}
	
	if (!_parent.isPassword(_password)) {
		_parent.writeErr(Language.Register.err_password2,'password');
		_bool = false;
	}
	
	var _confirm_password = _parent.getText('confirm_password');
	if (_confirm_password != _password) {
		_parent.writeErr(Language.Register.err_confirm_password,'confirm_password');
		_bool = false;
	}
	
	var _checkcode = _parent.getText('checkcode');
	if (!_parent.isCheckcode(_checkcode)) {
		_parent.writeErr(Language.Register.err_checkcode,'checkcode');
		_bool = false;
	}
	
	theform['subtn'].disabled = false;
	
	return _bool;
};