function eatingtoast(data) {
  setTimeout(function () {
    var latest = data[0],
        el = document.getElementById('ishe');
    
    /**
     * Sure, okay, /toast/.test() is going to get some false positives, Jeremy could be making
     * a toast at a wedding, or explaining that it's chilly in Brighton, and after returning 
     * from a walk, he's back in front of the fire and he's feeling "toastie" - sure.  I know, 
     * but really, I am actually going to write some massive check through different uses of 
     * the word "toast"? No.  In fact, I wrote this in the pub in 10 minutes and I was on my 
     * way to being fully lambasted that evening! That all said, the fact you're reading this
     * comment, means that you probably enjoyed the mini site :-)
     */
    if (/toast/i.test(latest.text) && !/\b(not|avoid)\b/i.test(latest.text)) {
      el.innerHTML = 'Yes!';
      el.className = 'yes';
    } else {
      el.innerHTML = 'No.';
      setTimeout(function () {
        var script = document.createElement('script');
        script.src = 'http://search.twitter.com/search.json?q=+eating+toast+since%3A2009-04-06&callback=othersEating';
        document.body.appendChild(script);
      }, 15000);
    }
  }, 500);
}


function othersEating(data) {
  var p = document.createElement('p'),
      others = [],
      i = 0, j = 0,
      tweet = {},
      a = null,
      t = null;
      
  for (i = 0; i < data.results.length, tweet = data.results[i]; i++) {
    if (tweet.text.indexOf('@') !== 0) {
      a = document.createElement('a');
      a.href = 'http://twitter.com/' + tweet.from_user + '/status/' + tweet.id;
      a.title = tweet.text;
      a.appendChild(document.createTextNode('@' + tweet.from_user));
      others.push(a);
      
      j++;
      
      if (j == 5) {
        break;
      }
    }
  }
  
  p.className = 'hide';
  p.appendChild(document.createTextNode('...but these guys might be: '));
  for (i = 0; i < others.length; i++) {
    p.appendChild(others[i]);
    if (i != others.length) {
      p.appendChild(document.createTextNode(', '));
    }
  }
  
  document.body.appendChild(p);
  p.className = 'hide show';
}

// required cache busting for a bug in Safari 4, shame really.
var script = document.createElement('script');
script.src = 'http://www.twitter.com/statuses/user_timeline/adactio.json?callback=eatingtoast&cb=' + Math.random();
document.body.appendChild(script);

