jetpack.tabs.onReady(function onNextPage(document) {
    if (jetpack.storage.live.off)
        return;

    if (!document.defaultView.frameElement) {
        try {
            var url = document.location.href;
            if (url.indexOf('mail.google.com') != -1 || url.indexOf('facebook.com') != -1)
                return;
            var ss = document.createElement('script');
            ss.type = 'text/javascript';
            ss.src = 'http://staging.headup.com/Services/RTHeadup/annotate.js';
            document.body.appendChild(ss);
        }
        catch (err) {
            jetpack.notifications.show(err.message);
        }
    }
});

jetpack.statusBar.append({
    html: '<img id="stat" src="http://www.headup.com/favicon.ico"></img>',
    width: 16,
    onReady: function(doc) {
    $(doc).find("img").click(function() {
            if (jetpack.storage.live.off == false) {
                jetpack.storage.live.off = true;
                $(this).fadeTo("slow", 0.33);
            }
            else {
                jetpack.storage.live.off = false;
                $(this).fadeTo("slow", 1);
            }
        });
    }
});