function topsyCallback(json) {
    res = json.response;
    if ( !res.total ) {
        return false;
    }
    html = '（' + res.total + ' ReTweet）';
    if ( document.getElementById('topsy_counter') ) {
        document.getElementById('topsy_counter').innerHTML = html;
    }
    html = '';
    for ( var i=0; i<res.list.length; i++ ) {
        tweet     = res.list[i];
        thumb     = tweet.author.photo_url.replace(/(normal)\.([a-z]{3,4})$/i,'mini.$2');
        author_id = tweet.author.url.replace('http://twitter.com/','');
        html
            += '<div class="twitterLine clearfix">'
            +  '<div class="twitterImg"><a href="'+tweet.author.url+'" target="_blank">'
            +  '<img src="'+thumb+'" alt="'+tweet.author.name+'" />'
            +  '</a></div>'
            +  '<div class="twitterTxt"><a href="'+tweet.author.url+'" target="_blank">'
            +  author_id
            +  '</a>'
            +  tweet.content.replace(/(\r\n|\r|\n)/g,'')
            +  '</div></div>';
    }
    html += '';
    if ( res.total > 10 ) {
        html
            += '<div id="twitterMore">'
            +  '<a href="'+res.topsy_trackback_url+'" target="_blank">'
            +  'つぶやきをもっと読む'
            +  '</a>'
            +  '</div>';
    }
    if ( document.getElementById('topsy_trackbacks') ) {
        document.getElementById('topsy_trackbacks').innerHTML = html;
    }
}
 
script = document.createElement('script');
script.type = 'text/javascript';
script.src  = 'http://otter.topsy.com/trackbacks.js?callback=topsyCallback&url='+encodeURIComponent(document.URL);
document.getElementsByTagName('head')[0].appendChild(script);
