function chkFrm(){
	        
			var gameusername = $('game_username').value;
			var gamepassword = $('game_password').value;
			var gamerepassword = $('game_repassword').value;
			$('f').value=getF();
                        var isok=document.getElementById('isok');	
			var tag=document.getElementById('tag');
			//check user

                       if(tag==undefined){
				isok.value="1";
			}else{
				isok.value=tag.checked ? "1" : "0";	
				
			}
            var tgno = $('tgno');
            if(tgno != undefined) tgno.value=getTG();
            
			if(checkspace(gameusername)){
					 alert('Email is required.');
					 $('game_username').focus();
					 return false;
			}
			if(CKUserName(gameusername)){
					 alert('E-mail address is invalid.');
					 $('game_username').focus();
					 return false;
			}
			
			//check password
			if(checkspace(gamepassword)){
						alert('Password is required.');
						$('game_password').focus();
						return false;	
			}else if(CkPswd(gamepassword)){
						alert('Password must be 6-20 characters,numbers.');
						$('game_password').focus();
						return false;
			}
			
			//check password again  
			if(checkspace(gamerepassword)){
						alert('Confirm Password is required.');
						$('game_repassword').focus();
						return false;	
			}else if(gamepassword != gamerepassword){
						alert("Confirm password doesn't match password.");
						$('game_repassword').focus();
						return false;
			}
			if(isok.value=="0"){
				alert('I have read and argee the User Argeement');
				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);
                                }
                        }	

			var obj_gameurl=$('gameurl');
			var obj_gourl=$('gourl');
			var serurl=obj_gameurl.value.trim();

			if(serurl==''){
				serurl=go_server_url[Math.floor(Math.random()*go_server_url.length)];
				obj_gameurl.value=serurl;
			}
			obj_gourl.value=obj_gourl.value+'?gameurl='+serurl;
			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;
}
