var word_list = [];

function init_load() {
  $('#loading').html("Loading...");

  server = location.pathname.split('/')[1];
  $.ajax({
    url: "/api/v1/tags?server="+server+"&limit=15",
    dataType: "json",
    timeout: 30000,
    success: function(data){
      render(data);
    }
  });
}

function render(j) {
  document.charset='UTF-8';
  document.characterSet = 'UTF-8';

  word_list = j;
  cloud_start();
}

function cloud_start() {
  $('#tagcloud').jQCloud(word_list, { width: 1200, height: 900, shape: "rectangular", delay: 7, fontSize: [30, 20]})
  $('#loading').html("done.");
};

init_load();
