
				$('h2').append('&nbsp;<span>(logged as ' + username + ')</span>');
			} else {
			  alert('Problem on connecting. Retry please...');
			}
		});
	}

function htmlEntities(str) {
    return String(str).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
}

function receive() {
 $.ajax({
					url: "/messages",
					type: "GET",
					async: true,
					success: function(data) {
						errcount = 0;
						console.log(JSON.stringify(data));
						var s, msg;
						var ar