(function ($) {
    function getSteam(id) {
        $.get('getstatus.php', { id: id }, function (data) {
            var text = '';
            text += '<img src="' + data.avatar + '" height="32" width="32" alt="' + data.name + '" />';
            text += '<strong>' + data.membername + '</strong>';
            text += ' - <a href="http://steamcommunity.com/profiles/' + data.friendid + '">View Steam Profile</a>';
            text += ' - <a href="steam://friends/add/' + data.friendid + '">Add</a>';
            text += '<br/>' + data.statustext;
            $('#member' + data.id).removeClass().addClass('steam_' + data.status).html(text);
        }, 'json');
    }
    function getSteamAll() {
        $('div[class^=steam]').each(function () {
            getSteam(this.id.substr(6));
        });
    }
    $(function () {
        getSteamAll();
        setInterval(getSteamAll, 300000);
    });
}(jQuery));
