var getQuote = function() {
  if (document.getElementById('quote')) {
    var el = document.getElementById('quote');
    el.innerHTML = 'Retrieving quote...';
    new Ajax.Request('/quotes/json', {
      method: 'GET',
      onSuccess: function(xhr) {
        var response = eval('(' + xhr.responseText + ')');
        if (response && response['quote']) {
          var quote = response['quote'];
          el.innerHTML = quote.quote + '<br/>-- ' +
            (quote.link ? '<a href="' + quote.link + '">' + quote.author + '</a>' : quote.author);
        }
      }
    });
  }
};
