


if (!window.twttr) {
    var _tmp = {};
    var twttr = (function () {
        var rtn = {
            timeouts: {},
            processJson: function (json) {
                if (typeof(json) == "object") {
                    var evals = [];
                    $.each(json, function (selector, content) {
                        var c = selector.charAt(0);
                        if (c == "$") {
                            evals.push(content)
                        } else { if (c == "!") {
                                var notification = window[selector.substring(1) + "Notification"];
                                if (notification) {
                                    (new notification()).setMessage(content).show()
                                }
                            } else {
                                var contentPadded = "<div>" + content + "</div>";
                                var $content = $(selector, $(contentPadded));
                                if ($content.length == 1) {
                                    $(selector).replaceWith($content)
                                } else {
                                    $(selector).html(content)
                                }
                                $(selector).show()
                            }
                        }
                    });
                    $.each(evals, function (index, js) {
                        if (js) {
                            eval(js)
                        }
                    })
                }
            },


            NON_CHAR_KEY_CODES: [8, 9, 16, 17, 18, 19, 20, 27, 33, 34, 35, 36, 37, 38, 39, 40, 45, 46, 91, 92, 93],
            isNonCharKeyCode: function (event) {
                return $.inArray(event.keyCode, twttr.NON_CHAR_KEY_CODES) != -1 || ((event.ctrlKey || event.metaKey) && $.inArray(event.keyCode, [67, 88]) != -1)
            }
        };
        return rtn
    })()
}
var T = {};

T.augment = function (B, C) {
    for (var A in C) {
        B.prototype[A] = C[A]
    }
    return T
};
T.each = function (A, B) {
    if (A instanceof Array) {
        A.forEach(function (E, D, C) {
            B(E)
        })
    } else {
        B(A)
    }
};
T.$ = $;
T.EventManager = function (B) {
    this.events = this.events || [];
    for (var A in B) {
        this.events[A] = B[A]
    }
};
T.augment(T.EventManager, {
    add: function (B, A) {
        this.events[B] = A
    }
});
T.createEvents = function (A, B) {
    if (B instanceof T.EventManager) {
        A.prototype.Event = B
    }
};
T.Component = function () {};
T.augment(T.Component, {
    attach: function (B, A) {
        if (A) {
            this._els.concat(T.query(B))
        } else {
            this._els = T.$(B)
        }
        return this
    },
    listen: function (A, B) {
        if (!this.Event.events[A]) {
            throw new Error('Twitter Error: Event type "' + A + '" is not supported for this component');
            return this
        }
        this.Event.events[A].call(this, B);
        return this
    },
    bind: function (A, B) {
        this._els.bind(A, B);
        return this
    },
    unbind: function (A, B) {
        this._els.unbind(A, B);
        return this
    }
});
$.fn.isLoading = function () {
    $(this).addClass("loading")
};
$.fn.isLoaded = function () {
    $(this).removeClass("loading")
};
$.fn.replace_text = function (C, B) {
    var A = $(this).html();
    if (A) {
        $(this).html(A.replace(C, B))
    }
};
var pluralize = function (C, B, A) {
    return C == 1 ? B : A
};
var setDocumentTitle = function (A) {
    document.title = unh(A) || ""
};
var sessionUserIsPageUser = function () {
    try {
        return $('meta[name="session-user-screen_name"]:first').get(0).content == $('meta[name="page-user-screen_name"]:first').get(0).content
    } catch(A) {
        return false
    }
};
$.fn.focusEnd = function () {
    return this.each(function () {
        var A = this;
        if (A.style.display != "none") {
            if ($.browser.msie) {
                A.focus();
                var B = A.createTextRange();
                B.collapse(false);
                B.select()
            } else {
                A.setSelectionRange(A.value.length, A.value.length);
                A.focus()
            }
        }
    })
};
$.fn.focusFirstTextField = function () {
    return this.find("input[type=text]:visible:enabled:first").focus().length > 0
},
$.fn.focusFirstTextArea = function () {
    return this.find("textarea:visible:enabled:first").focus().length > 0
};
$.fn.focusFirstTextElement = function () {
    return this.focusFirstTextField() || this.focusFirstTextArea()
};
$.fn.maxLength = function (A) {
    return this.each(function () {
        $(this).keydown(function (B) {
            return this.value.length <= A || twttr.isNonCharKeyCode(B)
        })
    })
};
$.fn.isSelectAll = function (A) {
    return this.each(function () {
        var B = $(this);
        if (typeof(A) == "string") {
            var D = $(A).find("input[type=checkbox]")
        } else {
            var D = A
        }
        function C() {
            var E = true;
            D.each(function () {
                if (!this.checked) {
                    E = false;
                    return false
                }
            });
            B.get(0).checked = E
        }
        B.click(function () {
            var E = B.get(0).checked;
            D.each(function () {
                this.checked = E
            });
            $(this).trigger("select-all-changed", E)
        });
        D.click(function () {
            C();
            $(this).trigger("checkbox-changed", this.checked)
        })
    })
};
$.fn.isHomeSearchForm = function () {
    return this.each(function () {
        var B = $(this);
        var A = $(B.find('input[type="text"]')[0]);
        var C = B.find("#home_search_submit");
        C.click(function () {
            B.submit();
            return false
        });
        B.submit(function () {
            var D = A.val();
            if (D != "") {
                C.addClass("loading");
                searchSummize(D, B, "processHomepageSearch")
            }
            return false
        });
        B.bind("loaded", null, function (D) {
            C.removeClass("loading")
        })
    })
};
function processHomepageSearch(A) {
    $(".wrapper, .wrapper-footer-ie").show();
    $("#signin_q").val(page.query);
    $(".logo").unbind();
    $("#trends, #trend_info span").remove();
    var B = page.trendDescriptions[page.query];
    if (B) {
        $("#trend_info").hide();
        $("#trend_description span").text(_("%{trend} is a popular topic on Twitter right now.", {
            trend: B[0]
        }));
        $("#trend_description p").html(B[1]);
        $("#trend_description").show()
    } else {
        $("#trend_description").hide();
        $("#trend_info").show()
    }
    $("#big_signup").remove();
    processSummize(A)
}
window.SEARCH_CALLBACKS = {
    summize: "processHomepageSearch",
    load: "pageHomepageLoadSearch",
    searchLink: "processHomepageSearchLink",
    trendLink: "processHomepageTrendLink",
    searchForm: "processHomepageSearchForm",
    hashtagLink: "processHomepageHashtagLink",
    inResultsLink: "processHomepageInResultsLink",
    more: "processHomepageSearchMore",
    refresh: "processHomepageSearchRefresh"
};
$.each(window.SEARCH_CALLBACKS, function () {
    window[this] = window.processHomepageSearch
});
function initializeSidebar() {}
twttr.updateLocation = function (A) {
    if (A) {
        A.replace(/^https?:\/\/.+?\//, "").replace(/\"/gi, "%22").replace(/#/gi, "%23").replace(/\s/gi, "+");
        var B = document.location.search;
        B.replace(/\"/gi, "%22").replace(/#/gi, "%23").replace(/\s/gi, "+");
        if ("search" + B != A) {
            document.location.hash = A
        }
    }
};

$.fn.isLanguageMenu = function () {
    return this.each(function () {
        var C = $(this);
        var A = $("#lf");
        var B = $(".language-select li + li");
        B.click(function (D) {
            var E = B.offset();
            if ($(window).height() < $("body").height()) {
                C.css({
                    top: E.top - C.height() - 10,
                    left: E.left
                })
            } else {
                C.css({
                    top: E.top + B.height() - 8,
                    left: E.left
                })
            }
            C.toggle();
            return false
        });
        $(document).click(function () {
            C.hide()
        });
        C.find("li").click(function () {
            A.find("#lang").val(this.id);
            A.submit()
        })
    })
};
$.fn.isSigninMenu = function () {
    return this.each(function () {
        var A = $(this);
        $(".signin").click(function () {
            var B = $(this);
            var C = B.offset();
            A.css({
                top: C.top + B.height(),
                left: C.left - A.width() + B.width()
            });
            B.toggleClass("menu-open");
            A.toggle();
            if (B.hasClass("menu-open")) {
                A.find("#username").focusEnd()
            } else {
                $("#home_search_q").focusEnd()
            }
            return false
        });
        A.mouseup(function () {
            return false
        });
        $(document).mouseup(function (B) {
            if ($(B.target).parent("a.signin").length == 0) {
                $(".signin").removeClass("menu-open");
                A.hide()
            }
        })
    })
};
$(function () {
    $("#home_search_q").focusEnd();
    $("#home_search").isHomeSearchForm();
    $(".language-menu").isLanguageMenu();
    $("#signin_menu").isSigninMenu();
    $("#trend_info img").tipsy({
        gravity: "s",
        offsetTop: -7
    });
    $("#trend_description img").tipsy({
        gravity: "s",
        offsetTop: -22
    });
    var A = $("#forgot_username_link");
    A.tipsy({
        gravity: "w",
        offsetLeft: 7
    });
    A.bind("click", function (B) {
        $("#username").focus();
        B.preventDefault()
    });

    
});




function processSummizeRefresh(A) {
    if (unescape(A.query).replace(/\+/g, " ") == page.query && A.total) {
        page.maxId = A.max_id;
        page.summizeRefreshResults = (page.summizeRefreshResults || 0) + A.total;
        $("#results_update").replace_text(/results? /, pluralize(page.summizeRefreshResults, "result ", "results "));
        $("#new_results_count").html(page.summizeRefreshResults);
        $("#results_update:hidden").slideDown();
        $("#search_refresh_link").attr("title", page.query).attr("href", "/search?q=" + encodeURIComponent(page.query)).isSearchLink(SEARCH_CALLBACKS.refresh);
        page.newResults = true
    } else {
        page.newResults = false
    }
}
$.fn.isSearchMoreButton = function (A) {
    return this.each(function () {
        var B = $(this);
        B.click(function () {
            B.blur();
            var D = B.attr("href");
            D.match(/\?.*page=([0-9]+)/gi);
            var C = RegExp.$1;
            page.retainTimeline = true;
            searchSummize(page.query, B, SEARCH_CALLBACKS.more, C);
            B.addClass("loading").html("");
            return false
        })
    })
};
function onPageChange(A) {
    var B = $("body").attr("id");
    setTitleAndHeading(B);
    if (!A) {
        if (page.summizeRefresh) {
            page.summizeRefresh.stop();
            page.summizeRefresh = null;
            page.summizeRefreshResults = null
        }
        $("#results_update").hide();
        $(".no-results").remove();
        $("#new_results_count").html("0")
    }
    twttr.trackPageView(B, (page.query && page.query.length > 0 ? page.query : null), A ? null : "/ajax")
}
$.fn.isSearchLink = function (A) {
    return this.each(function () {
        var B = $(this);
        B.click(function () {
            if ($.browser.msie) {
                this.hideFocus = true
            }
            if (page.isTimelineChange && page.currentTimelineChange) {
                page.currentTimelineChange.abort();
                page.$oldTimelineLink.trigger("aborted");
                page.isTimelineChange = false
            }
            page.isTimelineChange = true;
            page.currentTimelineChange = searchSummize(B.attr("name") ? B.attr("name") : B.attr("title"), B, A);
            if (B.parents("#side").length > 0) {
                $("#side ul.sidebar-menu li").removeClass("active");
                B.parent("li").addClass("active")
            }
            return false
        })
    })
};
$.fn.isSearchForm = function () {
    return this.each(function () {
        var B = $(this);
        var A = $(B.find('input[type="text"]')[0]);
        var C = B.find("#sidebar_search_submit");
        A.Watermark(_("Search")).focus(function () {
            A.select();
            return true
        });
        C.click(function () {
            B.submit()
        });
        B.submit(function () {
            var D = A.val();
            if (D != "") {
                C.addClass("loading");
                searchSummize(D, B, SEARCH_CALLBACKS.searchForm)
            }
            $("#side ul.sidebar-menu li").removeClass("active");
            $("#side #custom_search").addClass("active");
            return false
        });
        B.bind("loaded", null, function (D) {
            C.removeClass("loading")
        })
    })
};
$(document).ready(function () {
    $("#tweet_search_submit").click(function () {
        $("#tweet_search").submit()
    });
    if ($("body").attr("id") == "search") {
        onCondition(function () {
            return page.summizeResults
        },
        function () {
            window[SEARCH_CALLBACKS.summize](page.summizeResults)
        })
    }
});
(function () {
    jQuery.inherits = function (A, C) {
        function B() {}
        B.prototype = C.prototype;
        A.prototype = new B();
        A.prototype.constructor = A
    }
})();
(function () {
    jQuery.fn.equals = function (A) {
        return this.get(0) == A.get(0)
    }
})();
(function () {
    jQuery.fn.hasParent = function (A) {
        var B = false;
        this.parents().map(function () {
            if ($(this).equals(A)) {
                B = true
            }
        });
        return B
    }
})();
function Notification(B) {
    this.$bar = jQuery('<div class="notification-bar"></div>');
    this.$barContainer = jQuery('<div class="notification-bar-container"></div>');
    this.$barContents = jQuery('<div class="notification-bar-contents"></div>');
    this.$barBackground = jQuery('<div class="notification-bar-bkg"></div>');
    this.$message = jQuery('<div class="message"></div>');
    this.$bar.hide();
    this.$barBackground.hide();
    var A = this;
    this.$bar.click(function (C) {
        A.removeAfterEvent(C)
    });
    this.className = B
}
Notification.SLIDE_SPEED_IN_MS = 300;
Notification.prototype.remove = function () {
    var A = this;
    this.slideUp(function () {
        A.$bar.remove();
        A.$barBackground.remove();
        window.clearTimeout(A.timeout)
    })
};
Notification.prototype.removeAfterEvent = function (B) {
    var A = $(B.target);
    if (A.get(0).nodeName.toLowerCase() == "a" && A.hasParent(this.$message)) {
        return
    }
    this.remove()
};
Notification.prototype.setMessage = function (A) {
    this.msg = A;
    return this
};
Notification.prototype.show = function () {
    this.$message.addClass(this.className).html(this.msg);
    this.$barContainer.append(this.$barBackground).append(this.$bar.append(this.$barContents.append(this.$message)));
    jQuery("#notifications").append(this.$barContainer);
    this.$barBackground.height(this.$bar.height());
    this.showBar();
    if (this.onShow) {
        this.onShow()
    }
    return this
};
Notification.prototype.removeInMilliseconds = function () {
    var A = this;
    this.timeout = window.setTimeout(function () {
        A.remove()
    },
    A.timeoutInMilliseconds)
};
Notification.prototype.showBar = function () {
    this.$bar.show();
    this.$barBackground.show()
};
Notification.prototype.onShow = function () {
    this.removeInMilliseconds()
};
Notification.prototype.slideUp = function (A) {
    this.$bar.slideUp(Notification.SLIDE_SPEED_IN_MS);
    this.$barBackground.slideUp(Notification.SLIDE_SPEED_IN_MS, A)
};
function ShortNotification() {
    Notification.call(this, "message-info");
    this.timeoutInMilliseconds = 3000
}
jQuery.inherits(ShortNotification, Notification);
ShortNotification.prototype.showBar = function () {
    this.$bar.slideDown(Notification.SLIDE_SPEED_IN_MS);
    this.$barBackground.slideDown(Notification.SLIDE_SPEED_IN_MS)
};
function InfoNotification() {
    Notification.call(this, "message-info");
    this.timeoutInMilliseconds = 6000
}
jQuery.inherits(InfoNotification, Notification);
InfoNotification.prototype.showBar = function () {
    this.$bar.slideDown(Notification.SLIDE_SPEED_IN_MS);
    this.$barBackground.slideDown(Notification.SLIDE_SPEED_IN_MS)
};
function ProgressNotification() {
    Notification.call(this, "message-progress");
    this.timeoutInMilliseconds = 1000
}
jQuery.inherits(ProgressNotification, Notification);
ProgressNotification.prototype.setProgressMessage = function (A) {
    return this.setMessage(A)
};
ProgressNotification.prototype.setCompletedMessage = function (A) {
    this.completedMsg = A;
    return this
};
ProgressNotification.prototype.onShow = function () {};
ProgressNotification.prototype.cancel = function () {
    this.timeoutInMilliseconds = 0;
    this.removeInMilliseconds()
};
ProgressNotification.prototype.done = function () {
    this.$message.addClass("message-progress-done").removeClass(this.className).html(this.completedMsg);
    this.removeInMilliseconds()
};
function ErrorNotification() {
    Notification.call(this, "message-error");
    this.timeoutInMilliseconds = 12000
}
jQuery.inherits(ErrorNotification, Notification);
function Occasionally(A, D, C, B) {
    this.interval = A;
    this.maxDecayTime = D;
    this.job = C;
    this.decayCallback = B;
    this.timesRun = 0;
    this.decayRate = 1;
    this.decayMultiplier = 1.25;
    this.maxRequests = 360
}
Occasionally.prototype.start = function () {
    this.stop();
    this.run()
};
Occasionally.prototype.stop = function () {
    if (this.worker) {
        window.clearTimeout(this.worker)
    }
};
Occasionally.prototype.run = function () {
    var A = this;
    if (this.timesRun >= this.maxRequests) {
        this.stop()
    }
    this.decayRate = this.decayCallback() ? Math.max(1, this.decayRate / this.decayMultiplier) : this.decayRate * this.decayMultiplier;
    var B = this.interval * this.decayRate;
    B = (B >= this.maxDecayTime) ? this.maxDecayTime : B;
    this.worker = window.setTimeout(function () {
        A.execute()
    },
    Math.floor(B))
};
Occasionally.prototype.execute = function () {
    this.job();
    this.timesRun++;
    this.run()
};