// $Id: social_statistics.js,v 1.1.4.4 2008/04/07 10:34:09 njt1982 Exp $
Drupal.socialStatisticsInit = function() {
  $('.block-social_statistics .content').empty().append('<div class="throbber"><!-- --></div>');
  
  $.ajax({
    type: 'GET',
    url: '/social_statistics/block',
    data: "url=" + ss_url,
    success: function (xml) {
      $('#social_stats_content').fadeOut('slow', function() {
        
        $('#social_stats_content').empty().append('<div style="clear: both;"><!-- --></div>');

        $('items item', xml).each( function() {
          var title = $('title', this).text();
          var img_path = $('img_path', this).text();
          var value = $('value', this).text();
          var link = $('link', this).text();
          
          $('#social_stats_content').prepend('<div class="social_stat">  <div class="img"><img src="' + img_path + '" /></div>  <div class="title"><a href="' + link + '" title="' + title + '" target="_blank">' + title + '</a></div>  <div class=stat>' + value + '</div>  </div>');
        });
        
        $('#social_stats_content').fadeIn('slow');
      });
    }
  });
}


if (Drupal.jsEnabled) {
  $(document).ready(Drupal.socialStatisticsInit);
}