if (typeof renderTwitters != 'function')(function() {
  var j = (function() {
    var b = navigator.userAgent.toLowerCase();
    return {
      safari: /webkit/.test(b),
      opera: /opera/.test(b),
      msie: /msie/.test(b) && !(/opera/).test(b),
      mozilla: /mozilla/.test(b) && !(/(compatible|webkit)/).test(b)
    }
  })();
  var k = 0;
  var n = [];
  var o = false;
  window.renderTwitters = function(a, b) {
    function node(e) {
      return document.createElement(e)
    }
    function text(t) {
      return document.createTextNode(t)
    }
    var c = document.getElementById(b.twitterTarget);
    var d = null;
    var f = node('ul'),
    li,
    statusSpan,
    timeSpan,
    i,
    max = a.length > b.count ? b.count: a.length;
    for (i = 0; i < max && a[i]; i++) {
      d = getTwitterData(a[i]);
      if (b.ignoreReplies && a[i].text.substr(0, 1) == '@') {
        max++;
        continue
      }
      li = node('li');
      if (b.template) {
        li.innerHTML = b.template.replace(/%([a-z_\-\.]*)%/ig, function(m, l) {
          var r = d[l] + "" || "";
          if (l == 'text' && b.enableLinks) r = linkify(r);
          return r
        })
      } else {
        statusSpan = node('span');
        statusSpan.className = 'twitterStatus';
        timeSpan = node('span');
        timeSpan.className = 'twitterTime';
        statusSpan.innerHTML = a[i].text;
        if (b.enableLinks == true) {
          statusSpan.innerHTML = linkify(statusSpan.innerHTML)
        }
        timeSpan.innerHTML = relative_time(a[i].created_at);
        if (b.prefix) {
          var s = node('span');
          s.className = 'twitterPrefix';
          s.innerHTML = b.prefix.replace(/%(.*?)%/g, function(m, l) {
            return a[i].user[l]
          });
          li.appendChild(s);
          li.appendChild(text(' '))
        }
        li.appendChild(statusSpan);
        li.appendChild(text(' '));
        li.appendChild(timeSpan)
      }
      f.appendChild(li)
    }
    if (b.clearContents) {
      while (c.firstChild) {
        c.removeChild(c.firstChild)
      }
    }
    c.appendChild(f)
  };
  window.getTwitters = function(e, f, g, h) {
    k++;
    if (typeof f == 'object') {
      h = f;
			h.template = '<a href="http://twitter.com/%user_screen_name%/statuses/%id%/" class="twittime">%text% <span>%time%</span></a>';
      f = h.id;
      g = h.count
    }
    if (!g) g = 1;
    if (h) {
      h.count = g
    } else {
      h = {}
    }
    if (!h.timeout && typeof h.onTimeout == 'function') {
      h.timeout = 10
    }
    if (typeof h.clearContents == 'undefined') {
      h.clearContents = true
    }
    if (h.withFriends) h.withFriends = false;
    h['twitterTarget'] = e;
    if (typeof h.enableLinks == 'undefined') h.enableLinks = true;
    window['twitterCallback' + k] = function(a) {
      if (h.timeout) {
        clearTimeout(window['twitterTimeout' + k])
      }
      renderTwitters(a, h)
    };
    ready((function(c, d) {
      return function() {
        if (!document.getElementById(c.twitterTarget)) {
          return
        }
        var a = 'http://www.twitter.com/statuses/' + (c.withFriends ? 'friends_timeline': 'user_timeline') + '/' + f + '.json?callback=twitterCallback' + d + '&count=20';
        if (c.timeout) {
          window['twitterTimeout' + d] = setTimeout(function() {
            if (c.onTimeoutCancel) window['twitterCallback' + d] = function() {};
            c.onTimeout.call(document.getElementById(c.twitterTarget))
          },
          c.timeout * 1000)
        }
        var b = document.createElement('script');
        b.setAttribute('src', a);
        document.getElementsByTagName('head')[0].appendChild(b)
      }
    })(h, k))
  };
  DOMReady();
  function getTwitterData(a) {
    var b = a,
    i;
    for (i in a.user) {
      b['user_' + i] = a.user[i]
    }
    b.time = relative_time(a.created_at);
    return b
  }
  function ready(a) {
    if (!o) {
      n.push(a)
    } else {
      a.call()
    }
  }
  function fireReady() {
    o = true;
    var a;
    while (a = n.shift()) {
      a.call()
    }
  }
  function DOMReady() {
    if (j.mozilla || j.opera) {
      document.addEventListener("DOMContentLoaded", fireReady, false)
    } else if (j.msie) {
      document.write("<scr" + "ipt id=__ie_init defer=true src=//:><\/script>");
      var a = document.getElementById("__ie_init");
      if (a) {
        a.onreadystatechange = function() {
          if (this.readyState != "complete") return;
          this.parentNode.removeChild(this);
          fireReady.call()
        }
      }
      a = null
    } else if (j.safari) {
      var b = setInterval(function() {
        if (document.readyState == "loaded" || document.readyState == "complete") {
          clearInterval(b);
          b = null;
          fireReady.call()
        }
      },
      10)
    }
  }
  function relative_time(a) {
    var b = a.split(" ");
    a = b[1] + " " + b[2] + ", " + b[5] + " " + b[3];
    var c = Date.parse(a);
    var d = (arguments.length > 1) ? arguments[1] : new Date();
    var e = parseInt((d.getTime() - c) / 1000);
    e = e + (d.getTimezoneOffset() * 60);
    var r = '';
    if (e < 60) {
      r = 'a minute ago'
    } else if (e < 120) {
      r = 'a minute ago'
    } else if (e < (45 * 60)) {
      r = (parseInt(e / 60)).toString() + ' minutes ago'
    } else if (e < (2 * 90 * 60)) {
      r = 'an hour ago'
    } else if (e < (24 * 60 * 60)) {
      r = 'about ' + (parseInt(e / 3600)).toString() + ' hours ago'
    } else if (e < (48 * 60 * 60)) {
      r = 'one day ago'
    } else {
      r = (parseInt(e / 86400)).toString() + ' days ago'
    }
    return r
  }
  function linkify(s) {
    return s.replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&\?\/.=]+/g, function(m) {
      return m.link(m)
    }).replace(/@[\S]+/g, function(m) {
      return '<a href="http://twitter.com/' + m.substr(1) + '">' + m + '</a>'
    })
  }
})();

window.addEvent('domready',function() {
	getTwitters('tweet', {
		id: 'dreamdusters',
		count: 1,
		enableLinks: true,
		ignoreReplies: true,
		clearContents: true
	});
});