/***
 * Twitter JS v2.0.0
 * http://code.google.com/p/twitterjs/
 * Copyright (c) 2009 Remy Sharp / MIT License
 * $Date$
 */
/*
  MIT (MIT-LICENSE.txt)
 */
typeof getTwitters != "function" &&
function () {
  var a = {},
      b = 0;
  !
  function (a, b) {
    function m(a) {
      l = 1;
      while (a = c.shift()) a()
    }
    var c = [],
        d, e, f = !1,
        g = b.documentElement,
        h = g.doScroll,
        i = "DOMContentLoaded",
        j = "addEventListener",
        k = "onreadystatechange",
        l = /^loade|c/.test(b.readyState);
    b[j] && b[j](i, e = function () {
      b.removeEventListener(i, e, f), m()
    }, f), h && b.attachEvent(k, d = function () {
      /^c/.test(b.readyState) && (b.detachEvent(k, d), m())
    }), a.domReady = h ?
    function (b) {
      self != top ? l ? b() : c.push(b) : function () {
        try {
          g.doScroll("left")
        } catch (c) {
          return setTimeout(function () {
            a.domReady(b)
          }, 50)
        }
        b()
      }()
    } : function (a) {
      l ? a() : c.push(a)
    }
  }(a, document), window.getTwitters = function (c, d, e, f) {
    b++, typeof d == "object" && (f = d, d = f.id, e = f.count), e || (e = 1), f ? f.count = e : f = {}, !f.timeout && typeof f.onTimeout == "function" && (f.timeout = 10), typeof f.clearContents == "undefined" && (f.clearContents = !0), f.twitterTarget = c, typeof f.enableLinks == "undefined" && (f.enableLinks = !0), a.domReady(function (a, b) {
      return function () {
        function f() {
          a.target = document.getElementById(a.twitterTarget);
          if ( !! a.target) {
            var f = {
              limit: e
            };
            f.includeRT && (f.include_rts = !0), a.timeout && (window["twitterTimeout" + b] = setTimeout(function () {
              twitterlib.cancel(), a.onTimeout.call(a.target)
            }, a.timeout * 1e3));
            var g = "timeline";
            d.indexOf("#") === 0 && (g = "search"), d.indexOf("/") !== -1 && (g = "list"), a.ignoreReplies && (f.filter = {
              not: new RegExp(/^@/)
            }), twitterlib.cache(!0), twitterlib[g](d, f, function (d, e) {
              clearTimeout(window["twitterTimeout" + b]);
              var f = [],
                  g = d.length > a.count ? a.count : d.length;
              f = ["<ul>"];
              for (var h = 0; h < g; h++) {
                d[h].time = twitterlib.time.relative(d[h].created_at);
                for (var i in d[h].user) d[h]["user_" + i] = d[h].user[i];
                a.template ? f.push("<li>" + a.template.replace(/%([a-z_\-\.]*)%/ig, function (b, c) {
                  var e = d[h][c] + "" || "";
                  c == "text" && (e = twitterlib.expandLinks(d[h])), c == "text" && a.enableLinks && (e = twitterlib.ify.clean(e));
                  return e
                }) + "</li>") : a.bigTemplate ? f.push(twitterlib.render(d[h])) : f.push(c(d[h]))
              }
              f.push("</ul>"), a.clearContents ? a.target.innerHTML = f.join("") : a.target.innerHTML += f.join(""), a.callback && a.callback(d)
            })
          }
        }
        function c(b) {
          var c = a.enableLinks ? twitterlib.ify.clean(twitterlib.expandLinks(b)) : twitterlib.expandLinks(b),
              d = "<li>";
          a.prefix && (d += '<li><span className="twitterPrefix">', d += a.prefix.replace(/%(.*?)%/g, function (a, c) {
            return b.user[c]
          }), d += " </span></li>"), d += '<span className="twitterStatus">' + twitterlib.time.relative(b.created_at) + "</span> ", d += '<span className="twitterTime">' + b.text + "</span>", a.newwindow && (d = d.replace(/<a href/gi, '<a target="_blank" href'));
          return d
        }
        typeof twitterlib == "undefined" ? setTimeout(function () {
          var a = document.createElement("script");
          a.onload = a.onreadystatechange = function () {
            typeof window.twitterlib != "undefined" && f()
          }, a.src = "http://remy.github.com/twitterlib/twitterlib.js";
          var b = document.head || document.getElementsByTagName("head")[0];
          b.insertBefore(a, b.firstChild)
        }, 0) : f()
      }
    }(f, b))
  }
}()
