function checkAuthor(author) {
  new Ajax.Request('/includes/search_process.php', {
    method: 'get',
    parameters: { keyword: author },
    onSuccess: function(transport) {
      $('search-results').update(transport.responseText);
    },
    onFailure: function() {
      alert("Something wrong");
    }
  });
}

function addRecipient() {
  var typeValue = $('recipient-id').value;
  new Ajax.Request('/includes/userfind.php', {
    method: 'get',
    parameters: { id: typeValue },
    onSuccess: function(transport) {
      $('recipientlist').insert('<label><input type="checkbox" name="users[]" value="'+typeValue+'" checked="checked" /> '+transport.responseText+'</label>');
      $('search-results').update();
      $('recipient-input').value = '';
    },
    onFailure: function() {
      alert("Something wrong");
    }
  });
}

