$('form').submit(false);

$("#GameAll").css({
    'display': 'none'
});
$("#enter").click(function() {
    //if ($('#inputEmail').val() != "" && $('#inputPassword').val() != "") {
    var send_data = {
        Account: $('#inputEmail').val(),
        Password: $("#inputPassword").val()
    }
    $.ajax({
        type: 'post',
        url: "login",
        dataTpye: "json",
        data: send_data,
        success: function(JSONData) {
            console.log(JSONData.msg);

            if (JSONData.msg == "success") {

                var socket = io.connect();
                socket.emit('join', {
                    roomID: JSONData.id
                });

                // console.log("ID=",id);
                //document.getElementById("Black").style.display = "inline";
                $("#Black").css({
                    'display': 'inline'
                });
                $("#Black").animate({
                    'opacity': '1'
                }, 2000, function() {
                    $("#SignInPage").css({
                        'display': 'none'
                    });
                    console.log("1234");
                    $("#GameAll").css({
                        'display': 'inline'
                    });
                    console.log("000");

                    // TODO: Kick the user while he is logined;
                    var username = JSONData.id;
                    var roomID = JSONData.id;

                    ////////////////////
                    //////SOCKET////////
                    ////////////////////
                    var Users = {};
                    var game;
                    var player;
                    var world;


                    var socket = io.connect("/", {query: "username="+username});
                    socket.on('sys', function(data){
                        console.log('sys:' + data);
                    });

                    socket.on('create game', function(data){
                        player = eval("new "+data.character+"()");
                        // player = new Character();
                        game = new Game("GamePlay", player, socket);

                        //to create gotoroomwindow
                        var goToRoomWindow = new GoToRoomWindow(500, 200, socket);
                        console.log(funcitonListWindow);
                        functionListWindow.AppendItem("GoToRoom", "GoToRoom1", goToRoomWindow);
                        //console.log("socket id" + socket.)
                        console.log(socket);
                    });

                    socket.on('start game', function(){
                        game.start();
                        console.log(game.scene);
                    });

                    socket.on('render item', function(data){
                        switch (data.item.type) {
                            case "script":
                                var scripts = "var item = ";
                                scripts += data.item.data.scripts.join();
                                eval(scripts);
                                item.position.set(data.position.x, data.position.y, data.position.z);
                                item.rotation.set(data.rotation.x, data.rotation.y, data.rotation.z);
                                game.add(item);
                                if(item.ObjectsToMoveOn){
                                    player.canMoveOn(item.ObjectsToMoveOn);
                                }
                                break;
                            case "file":
                                var loader = new THREE.ObjectLoader();
                                loader.load(data.item.data.path, function(item) {
                                    item.position.set(data.position.x, data.position.y, data.position.z);
                                    item.rotation.set(data.rotation.x, data.rotation.y, data.rotation.z);
                                    game.add(item);
                                });
                                break;
                        }


                    });


                    socket.on('add user', function(userdata){
                        console.log(userdata.name + " has joined");
                        console.log(Users);
                        Users[userdata.name] = userdata;
                        // Users[userdata.name].object = (new Character()).model;
                        Users[userdata.name].object = eval('new '+userdata.type+'()');
                        Users[userdata.name].object.name = userdata.name;
                        game.add(Users[userdata.name].object);
                        console.log(userdata);
                        // because pos,rot is all 0 , so we don't set them
                    })
                    socket.on('remove user', function(username){
                        console.log('remove user');
                        console.log(Users);
                        game.remove(Users[username].object);
                        delete Users[username];
                    });

                    socket.on('fetch userdata', function(receiver){
                        console.log("send data to"+receiver);
                        socket.emit('update user to one',{
                            receiver: receiver,
                            position:game.Controller.position,
                            rotation:game.Controller.rotation
                        });
                    })



                    socket.on('update user', function(userdata){
                        if(Users[userdata.name]){
                            Users[userdata.name].object.position.x = userdata.position.x;
                            Users[userdata.name].object.position.y = userdata.position.y;
                            Users[userdata.name].object.position.z = userdata.position.z;
                            Users[userdata.name].object.rotation.y = userdata.rotation._y;
                            // Users[userdata.name].object.rotation.x = userdata.rotation.x;
                            // Users[userdata.name].object.rotation.y = userdata.rotation.y;
                            // Users[userdata.name].object.rotation.z = userdata.rotation.z;
                        }
                    });
                    socket.on('destroy game', function(){
                        console.log("YO");
                        game.stop();
                        delete game;
                    });


                    ////////////////////
                    ////////MAIN////////
                    ////////////////////


                    socket.emit('join', {
                        roomID:roomID
                    });



                    console.log("12345");
                    $("#Black").animate({
                        'opacity': "0"
                    }, 3000, function() {
                        $("#Black").css({
                            'display': 'none'
                        });
                        console.log("123456");
                    });
                });
            } else {
                alert("Wrong In Username Or Password");
                window.location = "/";
            }
        }

    });
//  }
});

@@ -4284,83 +4284,81 @@
     
-console.log(Users);%0A                        Users%5Buserdata.name%5D = userdata
+Users%5Buserdata.id%5D = userdata;%0A                        console.log(Users)
 ;%0A  
@@ -4389,36 +4389,34 @@
  Users%5Buserdata.
-name
+id
 %5D.object = (new 
@@ -4466,36 +4466,34 @@
  Users%5Buserdata.
-name
+id
 %5D.object = eval(
@@ -4551,36 +4551,34 @@
  Users%5Buserdata.
-name
+id
 %5D.object.name = 
@@ -4632,36 +4632,34 @@
 (Users%5Buserdata.
-name
+id
 %5D.object);%0A     
@@ -4852,24 +4852,18 @@
 unction(
-username
+id
 )%7B%0A     
@@ -4995,24 +4995,18 @@
 e(Users%5B
-username
+id
 %5D.object
@@ -5532,39 +5532,128 @@
 on('
-update user', function(
+zzz', function(userdata)%7B%0A                        console.log('zzz');%0A                        console.log(Users%5B
 userdata
 )%7B%0A 
@@ -5640,34 +5640,38 @@
 g(Users%5Buserdata
-)%7B
+.id%5D);
 %0A               
@@ -5697,20 +5697,18 @@
 serdata.
-name
+id
 %5D)%7B%0A    
@@ -5738,36 +5738,34 @@
  Users%5Buserdata.
-name
+id
 %5D.object.positio
@@ -5826,36 +5826,34 @@
  Users%5Buserdata.
-name
+id
 %5D.object.positio
@@ -5914,36 +5914,34 @@
  Users%5Buserdata.
-name
+id
 %5D.object.positio
@@ -6002,36 +6002,34 @@
  Users%5Buserdata.
-name
+id
 %5D.object.rotatio

Fix bias bug