function chkFrm(){
	        
			var gameusername = $('game_username').value;
			var gamepassword = $('game_password').value;
			var gamerepassword = $('game_repassword').value;
			//var lordname = $('game_lordname').value;
			$('f').value=getF();
			//check user
			if(checkspace(gameusername)){
					 alert('User name Cannot input null');
					 $('game_username').focus();
					 return false;
			}
			if(CKUserName(gameusername)){
					 alert('The format of Email is incorrect.');
					 $('game_username').focus();
					 return false;
			}
			
			//check password
			if(checkspace(gamepassword)){
						alert('Password Cannot input null');
						$('game_password').focus();
						return false;	
			}else if(CkPswd(gamepassword)){
						alert('Wrong password format');
						$('game_password').focus();
						return false;
			}
			
			//check password again  
			if(checkspace(gamerepassword)){
						alert('Password Cannot input null');
						$('game_repassword').focus();
						return false;	
			}else if(gamepassword != gamerepassword){
						alert('Two inputs do not match');
						$('game_repassword').focus();
						return false;
			}
			
			var pars = "game_username="+gameusername+"&fromurl="+fromurl;		
			var url = '/reg2_1/check.php';
			var response = MyAJAX(url,HTML_GET,pars);		
			if(response!='1'){
						alert(response);
						$('game_username').focus();
						return false;
			}	
			if($('game_email')==null){
                                var regform = $('regform');
                                if(regform!=null){
                                        var game_email = createInput('hidden','game_email',gameusername);
                                        regform.appendChild(game_email);
                                }
                        }	
			/*if(lordname==''){
				alert('Lord Name Cannot input null!');
				$('game_lordname').focus();
				return false;
			}
			var obj_gameurl=$('gameurl');
			var obj_gourl=$('gourl');
			var serurl=obj_gameurl.value.trim();
			//游戏URL不存在则随机生成一个
			if(serurl==''){
				
				serurl=go_server_url[Math.floor(Math.random()*go_server_url.length)];
				obj_gameurl.value=serurl;
			}
			var pars1 = "gameurl="+serurl+"&game_lordname="+lordname;		
			var url1 = '/reg2_1/check.php';
			var response = MyAJAX(url1,HTML_GET,pars1);		
			var result_tmp=response.split(':');
			if(result_tmp[0]=='ok'){
				obj_gourl.value='http://in.hithere.com/suc1.php?gameurl='+serurl+'&'+result_tmp[1];
				
				
			}else{
				if(result_tmp[1]=='1'){
					alert('Lord Name Cannot input null!');
					$('game_lordname').focus();
					return false;
				}else if(result_tmp[1]=='2'){
					alert('The lord`s name cannot be longer then 12 characters!');
					$('game_lordname').focus();
					return false;
					
				}else if(result_tmp[1]=='3'){
					alert('This name has existed!');
					$('game_lordname').focus();
					return false;
				}else if(result_tmp[1]=='6'){
					alert('The Lord Name is Invalid!');
					$('game_lordname').focus();
					return false;
				}
				obj_gourl.value='http://in.hithere.com/suc1.php?gameurl='+serurl;
				//$('game_lordname').focus();
				//return false;
			}*/
			return true;
}

function createInput(type,name,value){
	var element = document.createElement('input');
	element.setAttribute("id",name); 
        element.setAttribute("type",type);
        element.setAttribute("name",name);
        element.setAttribute("value",value);
	return element;
}
