$(function(){
    $("#error").hide();
    if($("#error > div").text() != "") {
        $("#error").show();
    }
    loadGames();
});

function loadGames() {
    $.get("/api/v0/game/list/", function(data) {
        $("#games").empty();
        for (var key in data) {
            var name = data[key]["id"];
            var s = "<li><a href='/ui/arena/?id=" + name + "'>join</a> " + name + "</li>";
            $("#games").append(s);
        }
    });
}
