// Adjust the markup of the tweets on the homepage 
function tweetStyling() {
    $(".aktt_more_updates").remove();
    var items = $('#sidebar .aktt_tweets li');
    $(items).each( function(i) {
    
    	// ID this item and the links in it.
        var item = items[i];
        links = $("a", item);
        linkNum = links.length;
        // remove the last link, always the twitter address.
        $(":last", links).remove;
        
        // If there's one link, make the whole thing link to it.
        if (linkNum == 2) { 
            $(links).empty();
            $(this).children('a').remove();
            $(this).wrapInner(links[0]);
        }
        
        // If there's more than one link, create a 'more' link for the last one.
        if (linkNum >= 3) { 
            $(links).each(function(j) {
            	if ((j + 1) < (linkNum -1)) {
            		$(this).css("display", "inline");
            	}
            	if ((j + 1) == (linkNum -1)) {
            		$(this).text("More >>");
            		$(this).css("display", "block");
            		$(this).css("text-align", "right");
            	}
            	if ((j + 1) == linkNum) $(this).remove();
            });
        }
    });   
}

$(document).ready(function(){
    tweetStyling();
});