
//////////////////////////////////////////////////////////////////
//
//  ShoutEm script used in html widget
//  www.shoutem.com
//  
//  Author: Matija Smalcelj - matija@shoutem.com
//  ALL RIGHTS RESERVED ©ShoutEm 2009
//
//////////////////////////////////////////////////////////////////


function shoutEmCallback(obj) {
    var shouts = obj;
    var statusHTML = "";

    statusHTML += "<table id='statusEmbed_update_list' cellpadding='0' cellspacing='0' class='f'>";
    for (var i = 0; i < shouts.length; i++) {
        if (i == 0) statusHTML += '<tr class="first">';
        else statusHTML += '<tr>';
        if (shouts[i].text == "") shouts[i].text = "&raquo;";
        statusHTML += ('<td class="a"><a href="' + shouts[i].user.url + '"><img src="' + shouts[i].user.profile_image_url + '" alt="' + shouts[i].user.screen_name + '" title="' + shouts[i].user.name + '"/></a>');
        statusHTML += ('<td class="c"><span>' + shouts[i].text + '</span> - <a href="' + shouts[i].url + '" class="t">' + shouts[i].created_at + '</a></td></tr>')
    }
    statusHTML += "</table>";

    if (shouts.length > 0) {
        var temp = '<table cellpadding="0" cellspacing="0" class="m"><tr><td class="a"><a href="' + shouts[0].user.url + '"><img src="' + shouts[0].user.profile_image_url + '" alt="' + shouts[0].user.screen_name + '" title="' + shouts[0].user.name + '"/></a></td>';
        temp += '<td class="m"><a href="' + shouts[0].user.url + '">';
        temp += shouts[0].user.url.split("/")[2];
        temp += "/";
        temp += shouts[0].user.screen_name;
        temp += '</a></td></tr></table>';
        statusHTML += temp;
    }
    document.getElementById('statusEmbed_div').innerHTML = statusHTML;
}

