
sunrise.announcementsList = function() {
    var ret = [];
    dojo.xhrPost({
        url: "/announcements.lua",
        content: {c: "list"},
        sync: true,
        handleAs: "json",
        load: function(result, args) {
                //result = data.split("\n");
                ret = result.data;
            },
        error: function(error, args) {
        	   sunrise.showError("Unable to retrieve announcements list"); 
        	}
    });
    return ret;
};
sunrise.announcementsGet = function(date) {
    var ret = null;
    dojo.xhrPost({
        url: "/announcements.lua",
        content: {c: "get", date: date},
        sync: true,
        handleAs: "json",
        load: function(result, args) {
                //var lines = data.split("\n");
                if (result.status)
                //if (lines[0] === "ok")
                    ret = result.data;
                    //result = lines.slice(1).join("\n");
                else 
                    sunrise.showError("Unable to retrieve announcement; " +
                        "server message: " + result.data);  
            },
        error: function(error, args) {
                sunrise.showError("Unable to retrieve announcement"); 
            }
    });
    return ret;
};
