﻿				
				var isClientValidate = true;
				
				
				var regConfigs = {
					serverErrors : {
						/**
						  *  register errors
						  */
						
						// name errors
						NAME_NULL_ERROR : {code:101,content:"昵称不能为空"},
						NAME_LENGTH_ERROR : {code:102,content:"昵称长度超出范围，必须是6-16个英文字符或3-8个汉字"},
						NAME_SYMBOL_ERROR : {code:103,content:"昵称中含有非法字符。您的昵称必须由汉字、英文字母（A-Z,a-z）、数字（0-9）、'-'或'_'组成"},
						NAME_START_SYMBOL_ERROR : {code:104,content:"昵称不能以数字、'-'或'_'开头"},
						NAME_ALREADY_EXISTED_ERROR : {code:105,content:"此昵称已被占用，请重新输入"},
						NAME_FORBIDDEN_VOCABULARY_ERROR : {code:106,content:"此昵称已被占用，请重新输入"},
						
						// interName errors
						INTERNAME_NULL_ERROR : {code:111,content:"用户名不能为空"},
						INTERNAME_LENGTH_ERROR : {code:112,content:"用户名的长度必须是6到16个英文字符"},
						INTERNAME_SYMBOL_ERROR : {code:113,content:"用户名只能由英文字母、数字以及'_'和'-'组成"},
						INTERNAME_START_SYMBOL_ERROR : {code:114,content:"用户名首字符必须为英文字母"},
						INTERNAME_ALREADY_EXISTED_ERROR : {code:115,content:"此用户名已被占用，请重新输入"},
						INTERNAME_FORBIDDEN_VOCABULARY_ERROR : {code:116,content:"此用户名已被占用，请重新输入"},
						
						// password errors
						PASSWORD_NULL_ERROR : {code:121,content:"密码不能为空"},
						PASSWORD_LENGTH_ERROR : {code:122,content:"密码长度必须介于6-12之间"},
						PASSWORD_SYMBOL_ERROR : {code:123,content:"密码只能由英文字母、数字以及'_'和'-'组成"},
						
						// question errors
						QUESTION_NULL_ERROR : {code:131,content:"密码提示问题不能为空"},
						QUESTION_LENGTH_ERROR : {code:132,content:"密码提示问题过长，不要超过20个字符"},
						
						// answer errors
						ANSWER_NULL_ERROR : {code:141,content:"问题答案不能为空"},
						ANSWER_LENGTH_ERROR : {code:142,content:"问题答案过长，不要超过20个字符"},
						
						// actor errors
						ACTOR_NULL_ERROR  : {code:201,content:"请选择虚拟形象"},
						
						
						// email errors
						EMAIL_NULL_ERROR : {code:301,content:"邮件地址不能为空"},
						EMAIL_LENGTH_ERROR : {code:302,content:"邮件地址的长度超出范围"},
						EMAIL_SYMBOL_ERROR : {code:303,content:"邮件地址中含有非法字符"},
						
						// vercode errors
						VERCODE_NULL_ERROR : {code:311,content:"验证码不能为空"},
						VERCODE_LENGTH_ERROR : {code:312,content:"验证码长度不正确，请输入4位字符"},
						VERCODE_SYMBOL_ERROR : {code:313,content:"验证码只能由字母和数字组成"},
						VERCODE_NOT_MATCH_ERROR : {code:314,content:"验证码不匹配!"}, 
						
						// real name errors
						REAL_NAME_LENGTH_ERROR : {code:321,content:"真实姓名的长度超出范围，最多20个英文字符或10个汉字!"}, 
						
						// session errors
						SESSION_OVERTIME_ERROR : {code:361,content:"会话超时，或者验证码不匹配!"},
						
						
						/**
						  * old user renmae errors
						  */
						  
						// name errors （老用户名）
						OLDNAME_NULL_ERROR : {code:100,content:"老用户名不能为空"},
						
						// password errors
						PASSWORD_NOT_MATCH_ERROR : {code:124,content:"老用户名密码不匹配"},
						
						// interName errors
						OLDUSER_INTERNAME_NULL_ERROR : {code:1110,content:"新用户名不能为空"},
						OLDUSER_INTERNAME_LENGTH_ERROR : {code:1120,content:"新用户名的长度必须是6到16个英文字符"},
						OLDUSER_INTERNAME_SYMBOL_ERROR : {code:1130,content:"新用户名只能由英文字母、数字以及'_'和'-'组成"},
						OLDUSER_INTERNAME_START_SYMBOL_ERROR : {code:1140,content:"新用户名首字符必须为英文字母"},
						OLDUSER_INTERNAME_ALREADY_EXISTED_ERROR : {code:1150,content:"此新用户名已被占用，请重新输入"},
						OLDUSER_INTERNAME_FORBIDDEN_VOCABULARY_ERROR : {code:1160,content:"此新用户名已被占用，请重新输入"},
						
						// other errors
						OLDUSER_RENAME_SEC_ERROR  : {code:701,content:"已经改过名，不允许改第二次"}
						
					},
					serverErrorsEn : {
						/**
						  *  register errors
						  */
						
						// name errors
						NAME_NULL_ERROR : {code:101,content:"You cannot leave your nickname blank"},
						NAME_LENGTH_ERROR : {code:102,content:"Please limit your nickname length in 6-16 bits(or 3-8 Chinese characters)"},
						NAME_SYMBOL_ERROR : {code:103,content:"Invalid character in your nickname.Your nickname must consist of  Chinese Characters(Simplified Chinese characters are recommended),English letters, numbers(0-9) ,'-'or'_'"},
						NAME_START_SYMBOL_ERROR : {code:104,content:"Nickname should not start with number、'-'or'_'"},
						NAME_ALREADY_EXISTED_ERROR : {code:105,content:"The nickname is occupied, choose another one"},
						NAME_FORBIDDEN_VOCABULARY_ERROR : {code:106,content:"The nickname is occupied, choose another one"},
						
						// interName errors
						INTERNAME_NULL_ERROR : {code:111,content:"You cannot leave your username blank"},
						INTERNAME_LENGTH_ERROR : {code:112,content:"Please limit your username length within 6-16 bits"},
						INTERNAME_SYMBOL_ERROR : {code:113,content:"Your username must consist of English letters, numbers(0-9) ,'-'or'_'"},
						INTERNAME_START_SYMBOL_ERROR : {code:114,content:"Username should start with English letters"},
						INTERNAME_ALREADY_EXISTED_ERROR : {code:115,content:"The username is occupied, choose another one"},
						INTERNAME_FORBIDDEN_VOCABULARY_ERROR : {code:116,content:"The username is occupied, choose another one"},
						
						// password errors
						PASSWORD_NULL_ERROR : {code:121,content:"You cannot leave the password blank"},
						PASSWORD_LENGTH_ERROR : {code:122,content:"Please limit your password length within 6-12 bits"},
						PASSWORD_SYMBOL_ERROR : {code:123,content:"Your password must consist of English letters(case sensitive), numbers(0-9) ,'-'or'_'"},
						
						// question errors
						QUESTION_NULL_ERROR : {code:131,content:"You cannot leave your password retrive question blank"},
						QUESTION_LENGTH_ERROR : {code:132,content:"Please provide your password retrive question using 20 Chinese characters or 40 English letters"},
						
						// answer errors
						ANSWER_NULL_ERROR : {code:141,content:"You cannot leave your answer blank"},
						ANSWER_LENGTH_ERROR : {code:142,content:"Please provide your answer using 20 Chinese characters or 40 English letters"},
						
						// actor errors
						ACTOR_NULL_ERROR  : {code:201,content:"Please choose your avatar appearance"},
						
						
						// email errors
						EMAIL_NULL_ERROR : {code:301,content:"You cannot leave your email address blank"},
						EMAIL_LENGTH_ERROR : {code:302,content:"Email address length exceeds the limits"},
						EMAIL_SYMBOL_ERROR : {code:303,content:"Email address contains invalid characters"},
						
						// vercode errors
						VERCODE_NULL_ERROR : {code:311,content:"You cannot leave your verification code blank"},
						VERCODE_LENGTH_ERROR : {code:312,content:"Pleae type in the verification code(with 4 characters) correctly"},
						VERCODE_SYMBOL_ERROR : {code:313,content:"The verification code should consist of English letters and numbers"},
						VERCODE_NOT_MATCH_ERROR : {code:314,content:"Unmatched verification code!"}, 
						
						// real name errors
						REAL_NAME_LENGTH_ERROR : {code:321,content:"Your real name exceeds the length limits(20 bits)"}, 
						
						// session errors
						SESSION_OVERTIME_ERROR : {code:361,content:"Overtime, or Unmatched verification code!"},
						
						
						/**
						  * old user renmae errors
						  */
						  
						// name errors （老用户名）
						OLDNAME_NULL_ERROR : {code:100,content:"You cannot leave your old username blank"},
						
						// password errors
						PASSWORD_NOT_MATCH_ERROR : {code:124,content:"The password is not matched with your old username"},
						
						// interName errors
						OLDUSER_INTERNAME_NULL_ERROR : {code:1110,content:"You cannot leave your new username blank"},
						OLDUSER_INTERNAME_LENGTH_ERROR : {code:1120,content:"Please limit your new username length in 6-16 bits(or 3-8 Chinese characters"},
						OLDUSER_INTERNAME_SYMBOL_ERROR : {code:1130,content:"Your new username must consist of English letters, numbers(0-9) ,'-'or'_'"},
						OLDUSER_INTERNAME_START_SYMBOL_ERROR : {code:1140,content:"Username should start with English letters"},
						OLDUSER_INTERNAME_ALREADY_EXISTED_ERROR : {code:1150,content:"The username is occupied, choose another one"},
						OLDUSER_INTERNAME_FORBIDDEN_VOCABULARY_ERROR : {code:1160,content:"The username is occupied, choose another one"},
						
						// other errors
						OLDUSER_RENAME_SEC_ERROR  : {code:701,content:"You have already changed your username"}
						
					},
					clientErrors : {
						// 客户端的错误提示暂时不常量化
						
					}, 
					lengthRestricts : {
						min_name_length : 6,
						max_name_length : 16,
						min_interName_length : 6,
						max_interName_length : 16,
						min_password_length : 6,
						max_password_length : 12,
						
						max_question_length : 40,
						max_answer_length : 40,
						max_realName_length : 20,
						max_email_length : 48
					}
			};
			
			
			function getServerErrorInfo(index){
				var serverErrorContent = null;
				for (prop in regConfigs.serverErrors){
					if(regConfigs.serverErrors[prop].code  == index){
						serverErrorContent = regConfigs.serverErrors[prop].content;
					}
				}
				if( serverErrorContent == null )
					serverErrorContent = "未知错误";
				
				return serverErrorContent ;
			}
			
			
			function getServerErrorInfoEn(index){
				var serverErrorContent = null;
				for (prop in regConfigs.serverErrorsEn){
					if(regConfigs.serverErrorsEn[prop].code  == index){
						serverErrorContent = regConfigs.serverErrorsEn[prop].content;
					}
				}
				if( serverErrorContent == null )
					serverErrorContent = "Unknown error.";
				
				return serverErrorContent ;
			}
			
			
			function showServerErrorInfo(serverErrorInfo){
				var str = "<image src='images/icon_failed_new.gif' style='float:left;'>&nbsp;&nbsp;";
				str += "<ul style='padding:0; margin: 0em 0em 0em 6.5em;'><li style='height:auto;padding:0px;line-height:15px;'>";
				str += serverErrorInfo;
				//str += "!";
				str += "</li></ul>";
				
				document.write(str);
			}
			
			
			function IsDigit(cCheck) { return (('0'<=cCheck) && (cCheck<='9')); }
			function IsAlpha(cCheck) { return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z'))) }
			