var g_requestQueue = new RequestQueue();

function codificate(elem) {
  var text = getTextAreaSelection(elem);
  if (!text) return;
  if (text.indexOf('\n') == -1) {
    setTextAreaSelection(elem, '`' + text + '`');
  }

  lines = text.split(/\n/);
  text = lines.map(function (line) {
    return '    ' + line + '\n';
  }).inject('', function (text, line) {
    return text + line;
  });
  setTextAreaSelection(elem, text);
}

function call() {
  var args = $A(arguments);
  var callback = args.shift();
  var xmlRpcPost = xrpcBuild.apply(null, args);
  var request = new Request('POST', '/ajax', xmlRpcPost, callback);
  Global.g_requestQueue.sendRequest(request);
  return request;
}

function flashMessage(arg) {
  return true;
}

function main() {
  g_components.each(function (f) { f(); });
}

document.observe('dom:loaded', this.main.bind(this));
// vim: set sts=2 sw=2 expandtab:
