var feeds = function (input) {
  var cmd = new Command('googlefeed -0'), result = [],
    hash_cmd = decodeURI(window.location.href.replace(/^(.*?)#/, ''));
  if (hash_cmd.indexOf('http://tako3.com/') != -1) {
    result.push('<p><a href="http://tako3.com/opml/'
                + hash_cmd.replace(/.*http:\/\/tako3.com\/([^ |]+).*/, '$1').escapeHTML() + '">opml</a></p>');
  }
  cmd.addEventListener('result', function (state) {
    result.push('<form id="form_edit" method="post" action="address/feed?post">'
                + '<textarea rows="' + String(input.length + 2) + '" cols="80" name="addresses" id="addresses" wrap="off"'
                + ' onchange="fixTextArea(this)">');
    for (var i = 0; i < state.result.length; ++i) {
      result.push(state.result[i] + '\n');
    }
    result.push('</textarea> <input type="submit" value="post" onmouseover="fixTextArea(document.getElementById(\'addresses\'))" />'
      + ' <a href="howtopostfeeds" title="posting methods to register feeds">howto</a></form>');
    delete result.loading;
  });
  result.loading = true;
  cmd.execute(input);
  return result;
};
