anchor.diff:  
     function addlist() {
       $.post('api/', {list: $('#add input').val()}, function(data) {
  -      reload();
  +      reload(function() {
  +        var link = $('a[title="' + data + '"]');
  +        var myid = link.attr('href');
  +        tabs.tabs('option', 'selected', myid);
  +      });
         //tabs.tabs('select', $('a[title="' + data + '"]').attr('href'));
  -      var link = $('a[title="' + data + '"]');
  -      var myid = link.attr('href');
  -      tabs.tabs('option', 'selected', $('a[title="' + data + '"]').attr('href'));
       });
     }
   
  -  function reload() {
  +  function reload(oncomplete) {
       $.getJSON('api/', function(data) {
         while (tabs.tabs('length') > 0) {
           tabs.tabs('remove', 0);
  
positive.code:             .append($('<button>Rename</button>').click(function() {
                $.post('api/' + $(ui.tab).attr('title'),
                  {newname: $('input', $(this).parent()).val(), _method: 'put'},
                  function() { reload(); });
              }))
              .append($('<button>Delete</button>').click(function() {
                $.post('api/' + $(ui.tab).attr('title'), { _method: 'delete'},
                  function() { reload(); });
              }))
              .hide())
            .appendTo($(ui.panel));
  
negative.code:         }
        });
        $('#add button').click(function() { addlist(); });
        oncomplete();
      });
    }
    reload(function() { tabs.tabs('select', -1); });
  });
  /* ]]> */
  </script>
  