
var socket = io.connect();

$(function() {

    // $("#chatControls").hide();
    $("#pseudoSet").click(function() {
    	setPseudo()
    });

    $("#submit").click(function() {
    	sentMessage();
    });
   
});

socket.on('connect', function() {
	cospansole.log('connected');span});

function addMessage(msg, pseudo, date, self) {
    if(self)
        var divClass = 'sent_msg';
    else
        var divClass = 'received_msg';

    $("#chatEntries").append('<div><span class=' + divClass +'>' 
        + pseudo + ' : ' + msg + '</span></div>');
}


function sentMessage() {
	console.log("message sent");
    if ($('#messageInput').val() != "") 
    {
        socket.emit('message', $('#messageInput').val());
        addMessage($('#messageInput').val(), "Me", new Date().toISOString(), true);
        $('#messageInput').val('');
    }
}

function setPseudo() {
    if ($("#pseudoInput").val() != "") {
        socket.emit('pseudo', $("#pseudoInput").val());
        $('#chatControls').show();
        $('#pseudoInput').hide();
        $('#pseudoSet').hide();
    }
}

socket.on('message', function(data) {
    addMessage(data['message'], data['pseudo'], new Date().toISOString(), false);
});
@@ -1100,24 +1100,109 @@
 ion(data) %7B%0A
+    console.log(%22Message received from%22 + data%5B'pseudo'%5D + %22 : %22 + data%5B'message'%5D);%0A
     addMessa

Debug statements