var ytPlayer;
function onYouTubePlayerReady(playerId) {
    ytPlayer = document.getElementById('ytplayer');
}

vanilla.md_preview = function() {
    var html = '<div id="preview_wrapper">';
    html += '<h2>Dear ' + jQuery('#friend_name1').val() + ',</h2>';
    html += '<p>' + jQuery('#message').val() + '</p>';
    html += '<p>' + jQuery('#first_name').val() + '</p>';
    html += '</div>';
    
    jQuery.fancybox(html, {
        autoDimensions: false,
        width: 759,
        height: 409
    });
    
    jQuery('#preview_wrapper').css('background', 'url(/images/md2011_card' + vanilla.md2011card + '_preview.png) no-repeat');
};

jQuery(document).ready(function($) {

    // fade out error message bg color
    $("#messages, #comment_errors, #comment_msgs").animate({opacity: 1.0}, 3000).animate({backgroundColor: '#ffffff'}, 3000);


    // share bookmarks on thankyou pages
    if (location.href.indexOf('?') == -1) {
        vanilla.baseUrl = location.href;
    } else {
        vanilla.baseUrl = location.href.substring(0, location.href.indexOf('?'));
    }
    $(".thankyoubookmarks").bookmark({
        icons: "/images/bookmarks.png",
        url: vanilla.baseUrl,
        sites: ["delicious", "digg", "facebook", "fark", "google", "kaboodle", "mixx", "propeller", "reddit", "stumbleupon", "technorati", "twitthis", "yahoobuzz"]
    });
    $(".thankyoubookmarks").prepend('<p><strong>Share this with your friends:</strong></p>');
    
    // share bookmarks in general
    $(".bookmarks").bookmark({
        icons: "/images/bookmarks.png", 
        sites: ["delicious", "digg", "facebook", "google", "kaboodle", "mixx", "propeller", "reddit", "stumbleupon", "technorati", "twitthis", "yahoobuzz"]
    });
    $('#tools ul li.share a').click(function() {
        //$('#tools .bookmarks').toggle();
        if ($('#tools .bookmarks').css('left') == '-8888px') {
            $('#tools .bookmarks').css('left', 0);
        } else {
            $('#tools .bookmarks').css('left', '-8888px');
        }
    });
        
    
    // opacity effect for bookmarks
    $(".hasBookmark ul a").animate({opacity: .6}, 0);
    $(".hasBookmark ul a").hover(
        function() {
            $(this).animate({opacity: 1}, 0);
        },
        function() {
            $(this).animate({opacity: .6}, 0);
        }
    );
    
    // hide preview bars
    $('.preview_notice a.hide_preview').click(function() {
        $('.preview_notice').hide();
    });

    // get the line behind h2
    $('h2.scala').css('background', 'url(/images/horz_cbe5e6.gif) repeat-x 0 50%');
    $('h2.scala span.cufon').css('background', '#fff');
    
    // link up featured article/featured video headers on home
    if ($('#home_bottom .home_video iframe').length > 0) {
        var vidLink = $('#home_bottom .home_video iframe').attr('src');
        vidLink = vidLink.replace('embed/', 'watch?v=');
        $('#home_bottom .home_video h2').wrapInner($('<a />').attr('href', vidLink));
    }
    
    if ($('#home_bottom .featured_article p.readmore a').length > 0) {
        var storyLink = $('#home_bottom .featured_article p.readmore a').attr('href');
        $('#home_bottom .featured_article h2').wrapInner($('<a />').attr('href', storyLink));
    }
    
    if ($('#sidebar .support .sidebarinset h3.title a').length > 0) {
        var spotLink = $('#sidebar .support .sidebarinset h3.title a').attr('href');
        $('#sidebar .support .sidebarinset h2').wrapInner($('<a />').attr('href', spotLink));
    }
    
    
    // homepage slideshow
    $('#home_features .listeditem').wrapAll('<div id="fade" />');
    $('#fade').css('background', '#fff');
        var featureCt = $('#fade .listeditem').length;
    $('#home_features').each(function() {
        var controlDiv = $('<div />').attr('id', 'switcher');
        for (var i = 1; i <= featureCt; i++) {
            var control = $('<a href="#" class="ir selector" id="s' + i + '">' + i + '</a>');
            if (i == 1) control.addClass('selected first');
            if (i == featureCt) control.addClass('last');
            controlDiv.append(control);
        }
        $(this).append(controlDiv);
    });
    
    $("#fade").innerfade({
        speed: 2000,
        timeout: 10000,
        containerheight: 270,
        tracker: "switcher",
        trackerclass: "selected",
        repeat: 1
    });
    $(".selector").click(function() {
        if($("#fade").data("timer")) {
            clearTimeout($("#fade").data("timer"));
            $("#fade").removeData("timer");
        }
    
        var id = Number(this.id.substr(1));
        $(".selector").removeClass("selected");
        $(this).addClass("selected");
        $("#fade>div:visible").fadeOut(2000);
        $("#fade>div").eq(id - 1).fadeIn(2000);
        return false;
    });

    // video section cover
    
    // don't send them off the page if they click on these
    $('body.videocover #video_top .leftcell h3.title a').click(function() { return false; });
    
    // only the "watch video" link and teaser image works top right
    $('#video_top .rightcell .videoitem h3.title a, #video_top .videoitem .img a').click(function() {
        $('body.videocover #video_top .leftcell h3.title a').html(
            $(this).parent().parent().find('h3').text()
        );
        $('body.videocover #video_top .leftcell p.date').html(
            $(this).parent().parent().find('.date').text()
        );
        $('body.videocover #video_top .leftcell .teaser').html(
            $(this).parent().parent().find('.teaser').html()
        );
        
        var vid = $(this).parent().parent().find('.video_url').text();
        ytPlayer.loadVideoByUrl(vid);
        ytPlayer.playVideo();
        
        return false;
    });
    
    // carousel links
    $('#videocarousel h3.title a, #videocarousel .img a').click(function() {
        $('body.videocover #video_top .leftcell h3.title a').html(
            $(this).parent().parent().find('h3').text()
        );
        $('body.videocover #video_top .leftcell p.date').html(
            $(this).parent().parent().find('.date').text()
        );
        $('body.videocover #video_top .leftcell .teaser').html(
            $(this).parent().parent().find('.teaser').html()
        );
        
        var vid = $(this).parent().parent().find('.video_url').text();
        ytPlayer.loadVideoByUrl(vid);
        ytPlayer.playVideo();
        
        return false;
    });
    
    //video carousel, with a consistent height
    if ($('#videocarousel').length > 0) {
        var maxHt = 0;
        $('#videocarousel ul li').each(function() {
            if ($(this).height() > maxHt) maxHt = $(this).height();
        });
        $('#videocarousel').jCarouselLite({
            btnPrev: 'button.prev',
            btnNext: 'button.next',
            speed: 2000,
            visible: 4,
            scroll: 4,
            circular: true
        });
        $('#videocarousel ul li').css('height', maxHt);
    }
    
    //home carousel, with a consistent height
    if ($('#homecarousel').length > 0) {
        var maxHt = 0;
        $('#homecarousel ul li').each(function() {
            if ($(this).height() > maxHt) maxHt = $(this).height();
        });
        $('#homecarousel').jCarouselLite({
            btnPrev: 'button.prev',
            btnNext: 'button.next',
            speed: 2000,
            visible: 4,
            scroll: 1,
            circular: true
        });
        $('#homecarousel ul li').css('height', maxHt);
    }
    
    
    // upsell on pac pages
    if ($('body.do_upsell').length > 0) {
        vanilla.doUpsell = true;
        if ($("#messages").length > 0) vanilla.doUpsell = false;
        $("#upsell").dialog({
            autoOpen: false,
            modal: true,
            closeOnEscape: false,
            width: 450,
            buttons: {
                "Yes": function() {
                    vanilla.doUpsell = false;
                    $("#amount_other65").val(10);
                    $(this).dialog("close");
                },
                "No Thanks": function() {
                    $(this).dialog("close");
                }
            },
            close: function() {
                vanilla.doUpsell = false;
                $("form#recipients").submit();
            }
                
        });
        $("body.do_upsell form#recipients").submit(function() {
            if (!vanilla.doUpsell) return true;
            if (($("#amount_other65").val().length == 0) && ($("#amount65").val().length == 0)) {
                $("#upsell").dialog("open");
                return false;
            }
        });
    }


    // feed selector on homepage
    if ($('body.is_home').length > 0 ) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news/index.html',
            blogUrl: '/ssi/select_blog/index.html',
            twitterUrl: '/ssi/select_twitter/index.html',
            count: 3,
            minBlog: 1
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news/index.html',
                blogUrl: '/ssi/select_blog/index.html',
                twitterUrl: '/ssi/select_twitter/index.html',
                count: 3,
                minBlog: 1
            });
        });
    }
    // feed selector service page
    if ($('body.service').length > 0 ) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/service_news/index.html',
            blogUrl: '/ssi/service_blog/index.html',
            twitterUrl: 'http://search.twitter.com/search.json?q=%23standuptoserve&rpp=5',
            count: 3,
            minBlog: 1
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/service_news/index.html',
                blogUrl: '/ssi/service_blog/index.html',
                twitterUrl: 'http://search.twitter.com/search.json?q=%23standuptoserve&rpp=5',
                count: 3,
                minBlog: 1
            });
        });
    }

// candidate news feeds
    if ($('body.what_candidates_kathy_hochul').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_kathy_hochul/index.html',
            blogUrl: '/ssi/select_blog_kathy_hochul/index.html',
            twitterUrl: '/ssi/select_twitter_kathy_hochul/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_kathy_hochul/index.html',
                blogUrl: '/ssi/select_blog_kathy_hochul/index.html',
                twitterUrl: '/ssi/select_twitter_kathy_hochul/index.html',
                count: 3
            });
        });
    }
    
    // candidate news feeds
    if ($('body.what_candidates_maria_cantwell').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_maria_cantwell/index.html',
            blogUrl: '/ssi/select_blog_maria_cantwell/index.html',
            twitterUrl: '/ssi/select_twitter_maria_cantwell/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_maria_cantwell/index.html',
                blogUrl: '/ssi/select_blog_maria_cantwell/index.html',
                twitterUrl: '/ssi/select_twitter_maria_cantwell/index.html',
                count: 3
            });
        });
    }
// candidate news feeds
    if ($('body.what_candidates_natalie_tennant').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_natalie_tennant/index.html',
            blogUrl: '/ssi/select_blog_natalie_tennant/index.html',
            twitterUrl: '/ssi/select_twitter_natalie_tennant/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_natalie_tennant/index.html',
                blogUrl: '/ssi/select_blog_natalie_tennant/index.html',
                twitterUrl: '/ssi/select_twitter_natalie_tennant/index.html',
                count: 3
            });
        });
    }

// candidate news feeds
    if ($('body.what_candidates_ann_kirkpatrick').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_ann_kirkpatrick/index.html',
            blogUrl: '/ssi/select_blog_ann_kirkpatrick/index.html',
            twitterUrl: '/ssi/select_twitter_ann_kirkpatrick/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_ann_kirkpatrick/index.html',
                blogUrl: '/ssi/select_blog_ann_kirkpatrick/index.html',
                twitterUrl: '/ssi/select_twitter_ann_kirkpatrick/index.html',
                count: 3
            });
        });
    }

// candidate news feeds
    if ($('body.what_candidates_ann_mclane_kuster').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_ann_mclane_kuster/index.html',
            blogUrl: '/ssi/select_blog_ann_mclane_kuster/index.html',
            twitterUrl: '/ssi/select_twitter_ann_mclane_kuster/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_ann_mclane_kuster/index.html',
                blogUrl: '/ssi/select_blog_ann_mclane_kuster/index.html',
                twitterUrl: '/ssi/select_twitter_ann_mclane_kuster/index.html',
                count: 3
            
});
        });
    }
   

// candidate news feeds
    if ($('body.what_candidates_lois_frankel').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_lois_frankel/index.html',
            blogUrl: '/ssi/select_blog_lois_frankel/index.html',
            twitterUrl: '/ssi/select_twitter_lois_frankel/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_lois_frankel/index.html',
                blogUrl: '/ssi/select_blog_lois_frankel/index.html',
                twitterUrl: '/ssi/select_twitter_lois_frankel/index.html',
                count: 3
            });
        });
    } 

// candidate news feeds
    if ($('body.what_candidates_christie_vilsack').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_christie_vilsack/index.html',
            blogUrl: '/ssi/select_blog_christie_vilsack/index.html',
            twitterUrl: '/ssi/select_twitter_christie_vilsack/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_christie_vilsack/index.html',
                blogUrl: '/ssi/select_blog_christie_vilsack/index.html',
                twitterUrl: '/ssi/select_twitter_christie_vilsack/index.html',
                count: 3
            });
        });
    } 

    // candidate news feeds
    if ($('body.what_candidates_dianne_feinstein').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_dianne_feinstein/index.html',
            blogUrl: '/ssi/select_blog_dianne_feinstein/index.html',
            twitterUrl: '/ssi/select_twitter_dianne_feinstein/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_dianne_feinstein/index.html',
                blogUrl: '/ssi/select_blog_dianne_feinstein/index.html',
                twitterUrl: '/ssi/select_twitter_dianne_feinstein/index.html',
                count: 3
            });
        });
    }
    // candidate news feeds
    if ($('body.what_candidates_amy_klobuchar').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_amy_klobuchar/index.html',
            blogUrl: '/ssi/select_blog_amy_klobuchar/index.html',
            twitterUrl: '/ssi/select_twitter_amy_klobuchar/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_amy_klobuchar/index.html',
                blogUrl: '/ssi/select_blog_amy_klobuchar/index.html',
                twitterUrl: '/ssi/select_twitter_amy_klobuchar/index.html',
                count: 3
            });
        });
    }
// candidate news feeds
    if ($('body.what_candidates_claire_mccaskill').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_claire_mccaskill/index.html',
            blogUrl: '/ssi/select_blog_claire_mccaskill/index.html',
            twitterUrl: '/ssi/select_twitter_claire_mccaskill/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_claire_mccaskill/index.html',
                blogUrl: '/ssi/select_blog_claire_mccaskill/index.html',
                twitterUrl: '/ssi/select_twitter_claire_mccaskill/index.html',
                count: 3
            });
        });
    }
    // candidate news feeds
    if ($('body.what_candidates_get_involved').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_get_involved/index.html',
            blogUrl: '/ssi/select_blog_get_involved/index.html',
            twitterUrl: '/ssi/select_twitter_get_involved/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_get_involved/index.html',
                blogUrl: '/ssi/select_blog_get_involved/index.html',
                twitterUrl: '/ssi/select_twitter_get_involved/index.html',
                count: 3
            });
        });
    }
        // candidate news feeds
    if ($('body.what_candidates_debbie_stabenow').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_debbie_stabenow/index.html',
            blogUrl: '/ssi/select_blog_debbie_stabenow/index.html',
            twitterUrl: '/ssi/select_twitter_debbie_stabenow/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_debbie_stabenow/index.html',
                blogUrl: '/ssi/select_blog_debbie_stabenow/index.html',
                twitterUrl: '/ssi/select_twitter_debbie_stabenow/index.html',
                count: 3
            });
        });
    }

// candidate news feeds
    if ($('body.what_candidates_shelley_berkley').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_shelley_berkley/index.html',
            blogUrl: '/ssi/select_blog_shelley_berkley/index.html',
            twitterUrl: '/ssi/select_twitter_shelley_berkley/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_shelley_berkley/index.html',
                blogUrl: '/ssi/select_blog_shelley_berkley/index.html',
                twitterUrl: '/ssi/select_twitter_shelley_berkley/index.html',
                count: 3
            });
        });
    }
// candidate news feeds
    if ($('body.what_candidates_janice_hahn').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_janice_hahn/index.html',
            blogUrl: '/ssi/select_blog_janice_hahn/index.html',
            twitterUrl: '/ssi/select_twitter_janice_hahn/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_janice_hahn/index.html',
                blogUrl: '/ssi/select_blog_janice_hahn/index.html',
                twitterUrl: '/ssi/select_twitter_janice_hahn/index.html',
                count: 3
            });
        });
    }
    // candidate news feeds
    if ($('body.what_candidates_tarryl_clark').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_tarryl_clark/index.html',
            blogUrl: '/ssi/select_blog_tarryl_clark/index.html',
            twitterUrl: '/ssi/select_twitter_tarryl_clark/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_tarryl_clark/index.html',
                blogUrl: '/ssi/select_blog_tarryl_clark/index.html',
                twitterUrl: '/ssi/select_twitter_tarryl_clark/index.html',
                count: 3
            });
        });
    }
// candidate news feeds
    if ($('body.what_candidates_elizabeth_esty').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_elizabeth_esty/index.html',
            blogUrl: '/ssi/select_blog_elizabeth_esty/index.html',
            twitterUrl: '/ssi/select_twitter_elizabeth_esty/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_elizabeth_esty/index.html',
                blogUrl: '/ssi/select_blog_elizabeth_esty/index.html',
                twitterUrl: '/ssi/select_twitter_elizabeth_esty/index.html',
                count: 3
            });
        });
    }
// candidate news feeds
    if ($('body.what_candidates_kate_marshall').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_kate_marshall/index.html',
            blogUrl: '/ssi/select_blog_kate_marshall/index.html',
            twitterUrl: '/ssi/select_twitter_kate_marshall/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_kate_marshall/index.html',
                blogUrl: '/ssi/select_blog_kate_marshall/index.html',
                twitterUrl: '/ssi/select_twitter_kate_marshall/index.html',
                count: 3
            });
        });
    }
// candidate news feeds
    if ($('body.what_candidates_mazie_hirono').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_mazie_hirono/index.html',
            blogUrl: '/ssi/select_blog_mazie_hirono/index.html',
            twitterUrl: '/ssi/select_twitter_mazie_hirono/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_mazie_hirono/index.html',
                blogUrl: '/ssi/select_blog_mazie_hirono/index.html',
                twitterUrl: '/ssi/select_twitter_mazie_hirono/index.html',
                count: 3
            });
        });
    }
// candidate news feeds
    if ($('body.what_candidates_dina_titus').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_dina_titus/index.html',
            blogUrl: '/ssi/select_blog_dina_titus/index.html',
            twitterUrl: '/ssi/select_twitter_dina_titus/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_dina_titus/index.html',
                blogUrl: '/ssi/select_blog_dina_titus/index.html',
                twitterUrl: '/ssi/select_twitter_dina_titus/index.html',
                count: 3
            });
        });
    }
// candidate news feeds
    if ($('body.what_candidates_tammy_duckworth').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_tammy_duckworth/index.html',
            blogUrl: '/ssi/select_blog_tammy_duckworth/index.html',
            twitterUrl: '/ssi/select_twitter_tammy_duckworth/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_tammy_duckworth/index.html',
                blogUrl: '/ssi/select_blog_tammy_duckworth/index.html',
                twitterUrl: '/ssi/select_twitter_tammy_duckworth/index.html',
                count: 3
            });
        });
    }
// candidate news feeds
    if ($('body.what_candidates_val_demings').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_val_demings/index.html',
            blogUrl: '/ssi/select_blog_val_demings/index.html',
            twitterUrl: '/ssi/select_twitter_val_demings/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_val_demings/index.html',
                blogUrl: '/ssi/select_blog_val_demings/index.html',
                twitterUrl: '/ssi/select_twitter_val_demings/index.html',
                count: 3
            });
        });
    }
// candidate news feeds
    if ($('body.what_candidates_susan_bysiewicz').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_susan_bysiewicz/index.html',
            blogUrl: '/ssi/select_blog_susan_bysiewicz/index.html',
            twitterUrl: '/ssi/select_twitter_susan_bysiewicz/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_susan_bysiewicz/index.html',
                blogUrl: '/ssi/select_blog_susan_bysiewicz/index.html',
                twitterUrl: '/ssi/select_twitter_susan_bysiewicz/index.html',
                count: 3
            });
        });
    }
// candidate news feeds
    if ($('body.what_candidates_bev_perdue').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_bev_perdue/index.html',
            blogUrl: '/ssi/select_blog_bev_perdue/index.html',
            twitterUrl: '/ssi/select_twitter_bev_perdue/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_bev_perdue/index.html',
                blogUrl: '/ssi/select_blog_bev_perdue/index.html',
                twitterUrl: '/ssi/select_twitter_bev_perdue/index.html',
                count: 3
            });
        });
    }
// candidate news feeds
    if ($('body.what_candidates_suzanne_bonamici').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_suzanne_bonamici/index.html',
            blogUrl: '/ssi/select_blog_suzanne_bonamici/index.html',
            twitterUrl: '/ssi/select_twitter_suzanne_bonamici/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_suzanne_bonamici/index.html',
                blogUrl: '/ssi/select_blog_suzanne_bonamici/index.html',
                twitterUrl: '/ssi/select_twitter_suzanne_bonamici/index.html',
                count: 3
           });
        });
    }
// candidate news feeds
    if ($('body.what_candidates_cheri_bustos').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_cheri_bustos/index.html',
            blogUrl: '/ssi/select_blog_cheri_bustos/index.html',
            twitterUrl: '/ssi/select_twitter_cheri_bustos/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_cheri_bustos/index.html',
                blogUrl: '/ssi/select_blog_cheri_bustos/index.html',
                twitterUrl: '/ssi/select_twitter_cheri_bustos/index.html',
                count: 3
            });
        });
    }

    // candidate news feeds
    if ($('body.what_candidates_tammy_baldwin').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_tammy_baldwin/index.html',
            blogUrl: '/ssi/select_blog_tammy_baldwin/index.html',
            twitterUrl: '/ssi/select_twitter_tammy_baldwin/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_tammy_baldwin/index.html',
                blogUrl: '/ssi/select_blog_tammy_baldwin/index.html',
                twitterUrl: '/ssi/select_twitter_tammy_baldwin/index.html',
                count: 3
            });
        });
    }            

    // candidate news feeds
    if ($('body.what_candidates_elizabeth_warren').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_elizabeth_warren/index.html',
            blogUrl: '/ssi/select_blog_elizabeth_warren/index.html',
            twitterUrl: '/ssi/select_twitter_elizabeth_warren/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_elizabeth_warren/index.html',
                blogUrl: '/ssi/select_blog_elizabeth_warren/index.html',
                twitterUrl: '/ssi/select_twitter_elizabeth_warren/index.html',
                count: 3
            });
        });
    }

// candidate news feeds
    if ($('body.what_candidates_kelda_roys').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_kelda_roys/index.html',
            blogUrl: '/ssi/select_blog_kelda_roys/index.html',
            twitterUrl: '/ssi/select_twitter_kelda_roys/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_kelda_roys/index.html',
                blogUrl: '/ssi/select_blog_kelda_roys/index.html',
                twitterUrl: '/ssi/select_twitter_kelda_roys/index.html',
                count: 3
            });
        });
    }
   
// candidate news feeds
    if ($('body.what_candidates_lois_capps').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_lois_capps/index.html',
            blogUrl: '/ssi/select_blog_lois_capps/index.html',
            twitterUrl: '/ssi/select_twitter_lois_capps/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_lois_capps/index.html',
                blogUrl: '/ssi/select_blog_lois_capps/index.html',
                twitterUrl: '/ssi/select_twitter_lois_capps/index.html',
                count: 3
            });
        });
    } 

// candidate news feeds
    if ($('body.what_candidates_denise_ducheny').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_denise_ducheny/index.html',
            blogUrl: '/ssi/select_blog_denise_ducheny/index.html',
            twitterUrl: '/ssi/select_twitter_denise_ducheny/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_denise_ducheny/index.html',
                blogUrl: '/ssi/select_blog_denise_ducheny/index.html',
                twitterUrl: '/ssi/select_twitter_denise_ducheny/index.html',
                count: 3
            });
        });
    }

// candidate news feeds
    if ($('body.what_candidates_gloria_negrete_mcleod').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_gloria_negrete_mcleod/index.html',
            blogUrl: '/ssi/select_blog_gloria_negrete_mcleod/index.html',
            twitterUrl: '/ssi/select_twitter_gloria_negrete_mcleod/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_gloria_negrete_mcleod/index.html',
                blogUrl: '/ssi/select_blog_gloria_negrete_mcleod/index.html',
                twitterUrl: '/ssi/select_twitter_gloria_negrete_mcleod/index.html',
                count: 3
            });
        });
    }

// candidate news feeds
    if ($('body.what_candidates_betty_sutton').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_betty_sutton/index.html',
            blogUrl: '/ssi/select_blog_betty_sutton/index.html',
            twitterUrl: '/ssi/select_twitter_betty_sutton/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_betty_sutton/index.html',
                blogUrl: '/ssi/select_blog_betty_sutton/index.html',
                twitterUrl: '/ssi/select_twitter_betty_sutton/index.html',
                count: 3
            });
        });
    }

// candidate news feeds
    if ($('body.what_candidates_tulsi_gabbard').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_tulsi_gabbard/index.html',
            blogUrl: '/ssi/select_blog_tulsi_gabbard/index.html',
            twitterUrl: '/ssi/select_twitter_tulsi_gabbard/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_tulsi_gabbard/index.html',
                blogUrl: '/ssi/select_blog_tulsi_gabbard/index.html',
                twitterUrl: '/ssi/select_twitter_tulsi_gabbard/index.html',
                count: 3
            });
        });
    }

// candidate news feeds
    if ($('body.what_candidates_michelle_lujan_grisham').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_michelle_lujan_grisham/index.html',
            blogUrl: '/ssi/select_blog_michelle_lujan_grisham/index.html',
            twitterUrl: '/ssi/select_twitter_michelle_lujan_grisham/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_michelle_lujan_grisham/index.html',
                blogUrl: '/ssi/select_blog_michelle_lujan_grisham/index.html',
                twitterUrl: '/ssi/select_twitter_michelle_lujan_grisham/index.html',
                count: 3
            });
        });
    }

// candidate news feeds
    if ($('body.what_candidates_kyrsten_sinema').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_kyrsten_sinema/index.html',
            blogUrl: '/ssi/select_blog_kyrsten_sinema/index.html',
            twitterUrl: '/ssi/select_twitter_kyrsten_sinema/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_kyrsten_sinema/index.html',
                blogUrl: '/ssi/select_blog_kyrsten_sinema/index.html',
                twitterUrl: '/ssi/select_twitter_kyrsten_sinema/index.html',
                count: 3
            });
        });
    }    

// candidate news feeds
    if ($('body.what_candidates_kathryn_boockvar').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_kathryn_boockvar/index.html',
            blogUrl: '/ssi/select_blog_kathryn_boockvar/index.html',
            twitterUrl: '/ssi/select_twitter_kathryn_boockvar/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_kathryn_boockvar/index.html',
                blogUrl: '/ssi/select_blog_kathryn_boockvar/index.html',
                twitterUrl: '/ssi/select_twitter_kathryn_boockvar/index.html',
                count: 3
            });
        });
    }    


// candidate news feeds
    if ($('body.what_candidates_lori_saldana').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_lori_saldana/index.html',
            blogUrl: '/ssi/select_blog_lori_saldana/index.html',
            twitterUrl: '/ssi/select_twitter_lori_saldana/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_lori_saldana/index.html',
                blogUrl: '/ssi/select_blog_lori_saldana/index.html',
                twitterUrl: '/ssi/select_twitter_lori_saldana/index.html',
                count: 3
            });
        });
    }    
    
// candidate news feeds
    if ($('body.what_candidates_stacey_lawson').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_stacey_lawson/index.html',
            blogUrl: '/ssi/select_blog_stacey_lawson/index.html',
            twitterUrl: '/ssi/select_twitter_stacey_lawson/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_stacey_lawson/index.html',
                blogUrl: '/ssi/select_blog_stacey_lawson/index.html',
                twitterUrl: '/ssi/select_twitter_stacey_lawson/index.html',
                count: 3
            });
        });
    }    

// candidate news feeds
    if ($('body.what_candidates_kathleen_falk').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_kathleen_falk/index.html',
            blogUrl: '/ssi/select_blog_kathleen_falk/index.html',
            twitterUrl: '/ssi/select_twitter_kathleen_falk/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_kathleen_falk/index.html',
                blogUrl: '/ssi/select_blog_kathleen_falk/index.html',
                twitterUrl: '/ssi/select_twitter_kathleen_falk/index.html',
                count: 3
            });
        });
    }    
    
// candidate news feeds
    if ($('body.what_candidates_kirsten_gillibrand').length > 0) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            twitterAvatar: '/images/twitter_generic100.jpg',
            newsUrl: '/ssi/select_news_kirsten_gillibrand/index.html',
            blogUrl: '/ssi/select_blog_kirsten_gillibrand/index.html',
            twitterUrl: '/ssi/select_twitter_kirsten_gillibrand/index.html',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                twitterAvatar: '/images/twitter_generic100.jpg',
                newsUrl: '/ssi/select_news_kirsten_gillibrand/index.html',
                blogUrl: '/ssi/select_blog_kirsten_gillibrand/index.html',
                twitterUrl: '/ssi/select_twitter_kirsten_gillibrand/index.html',
                count: 3
            });
        });
    }    
    
    /* we are emily */
    
    $('body.waecover .listeditem .img a').click(function() {
        var url = $(this).attr('href');
        $.ajax({
            url: url,
            context: document.body,
            dataType: 'html',
            success: function(data) {
                var html = '<div id="videowrapper">' + $(data).find('#videowrapper').html() + '</div>';
                $.fancybox(html, {
                    autoDimensions: false,
                    width: 600,
                    height: 'auto'
                });
            }
         });
         return false;
    });
    
    /* splash pages */
    $('body.splash_signup #email').blur().val('Email Address');
    $('body.splash_signup #email').focus(function() {
        vanilla.swapValue(this, false, 'Email Address');
    });
    $('body.splash_signup #email').blur(function() {
        vanilla.swapValue(this, true, 'Email Address');
    });
    $('body.splash_signup #zip').focus(function() {
        vanilla.swapValue(this, false, 'ZIP Code');
    });
    $('body.splash_signup #zip').blur(function() {
        vanilla.swapValue(this, true, 'ZIP Code');
    });
    
    // timeline /who/history/
    
    $('body.timelinecover').append('<div id="temp" style="display: none;"></div>');
    $('body.timelinecover .yearpart .listeditem a').click(function() {
        var url = $(this).attr('href');
        $.ajax({
            url: url,
            context: document.body,
            dataType: 'html',
            success: function(data) {
                var contents = $(data).find('#assetwrapper').html();
                var html = $('<div id="response"></div>').append(contents);

                var assets = [];
                var numAssets = $(html).find('.asset').length;
                if (numAssets > 0) {
                    $(html).find('.asset').each(function(i, item) {
                        var footer = '';
                        if ((i + 1) < numAssets) {
                            footer += ' [<a class="next">Next</a>]';
                        }
                        if (i > 0) {
                            footer += ' [<a class="prev">Previous</a>]';
                        }
                        assets.push('<div class="asset">' + $(item).html() + '<p>' + (i + 1) + ' of ' + numAssets + footer + '</p></div>');
                    });
                } else {
                    assets.push('<div class="asset">' + $(html).html() + '</div>');
                }

                $.fancybox(assets, {
                    autoDimensions: false,
                    width: 427,
                    height: 'auto',
                    showNavArrows: true,
                    overlayColor: '#fff',
                    overlayOpacity: 0.6,
                    showNavArrows: false,
                    onComplete: function() {
                        if ($('#fancybox-inner').height() < $('#fancybox-inner').get(0).scrollHeight) {
                            //console.log('have scroll bar');
                            $('#fancybox-wrap').css('width', '472px');
                            $('#fancybox-inner').css('width', '452px');
                        }
                        $('.asset .next').click(function() {
                            $.fancybox.next();
                        });
                        $('.asset .prev').click(function() {
                            $.fancybox.prev();
                        });
                            
                    }
                });
            }
         });
         return false;
    });
    
    /* blog twitter feed */
	
    if ($('#sidebar .twitter .feed').length > 0) {
        // $('#sidebar .twitter .feed').twitterFeed({jsonData: '/ssi/blog/twitter_json/index.html', dataType: 'json', queryType: 'friends', count: 5, refresh: 300000});
        
        $('#sidebar .twitter .feed').twitterFeed({
            queryType: 'user',
            query: 'EmilysList',
            template: '<div class="txt"><span class="msg">#{text}</span><br /><span class="footer"><span class="date">#{createdAt}</span> (<a href="http://twitter.com/intent/tweet?in_reply_to=#{id}">Reply</a>) (<a  href="http://twitter.com/intent/retweet?tweet_id=#{id}">RT</a>)</span></div>',
            refresh: 0,
            count: 2,
            fadeSpeed: 0,
            timeFormat: 'local',
ignoreReplies: true
        });
    }


    // pass fields to authorize
    $('form#contribution_form').submit(function() {
        if ($('input[name=employer]').length && $('input[name=occupation]').length) {
            $("#field_comment1").val("company");
            $("#field_comment2").val("ship_company");
            
            $('#value_comment1').val($('input[name=employer]').val());
            $('#value_comment2').val($('input[name=occupation]').val());
        }
        return true;
    });
    
    // countdown on contribute splash page
    if ($('body.countdown_contribute').length > 0) {
        var targetDate = new Date("November 2, 2010");
        var now = new Date();
        var daysUntil = Math.floor((targetDate.getTime() - now.getTime()) / (1000 * 60 * 60 * 24)) + 1;
        $('#top .day-display').addClass('day' + daysUntil);
    }
    
    // senate protection project
    $('#spp_bottom .qq input.right').click(function() {
        $(this).closest('.qq').find('div.wrong').hide();
        $(this).closest('.qq').find('div.right').show();
        $(this).closest('.qq').find('p.next').show();
    });
    $('#spp_bottom .qq input.wrong').click(function() {
        $(this).closest('.qq').find('div.right').hide();
        $(this).closest('.qq').find('div.wrong').show();
        $(this).closest('.qq').find('p.next').show();
    });
    $('#spp_bottom .qq p.next a').click(function() {
        $('#spp_bottom .qq').hide();
        $(this).closest('.qq').next().show();
        return false;
    });
    
    $("textarea.swap").focus(function() {
        vanilla.swapValue(this, false);
    });
    $("textarea.swap").blur(function() {
        vanilla.swapValue(this, true);
    });
    
    $('#sidebar .sppdonate select').change(function() {
        var total = 0;
        $('#sidebar .sppdonate select').each(function() {
            var val = parseInt(this.value);
            if (!isNaN(val)) {
                total += val;
            }
        });
        $('#sidebar .sppdonate p.total span.amount').text(total);
        //$('#sidebar .sppdonate #total_amount').val(total);
    });
    
    $('#wisc_bottom .candidates .leadinrow:last').css('border', '0');
    
    // wisconsin feed selector
    
    if ($('body.wisc-sc2 #feedselect').length > 0 ) {
        $('#feedselect .feedcontainer').feedSelect({
            getNews: $('#select_news').attr('checked'),
            getBlog: $('#select_blog_wi').attr('checked'),
            getTwitter: $('#select_twitter').attr('checked'),
            newsUrl: '/ssi/select_news/index.html',
            blogUrl: '/ssi/select_blog_wi/index.html',
            twitterUrl: 'http://api.twitter.com/1/statuses/user_timeline.json?screen_name=emilyslist',
            includeShareLinks: true,
            //twitterTemplate : '<div class="listeditem feeditem twitteritem twocol_left clearfix"><div class="img"><a href="http://twitter.com/#{screenName}/"><img src="#{profileImageUrl}" height="#{avatarHeight}" width="#{avatarWidth}" alt="#{screenName}" title="#{screenName}" /></a></div><div class="txt"><p class="type">#{feedType}</p><p class="teaser">#{text}</p><p class="date"><span>#{createdAt}</span> (<a  href="http://twitter.com/intent/tweet?in_reply_to=#{id}">Reply</a>) (<a  href="http://twitter.com/intent/retweet?tweet_id=#{id}">RT</a>)</span><div class="share_wrapper clearfix"><div class="fb_share"><fb:share-button class="url" href="http://twitter.com/#!/#{screenName}/status/#{id}" type="button_count"></fb:share-button></div></div></div></div>',
            twitterTemplate : '<div class="listeditem feeditem twitteritem twocol_left clearfix"><div class="img"><a href="http://twitter.com/#{screenName}/"><img src="#{profileImageUrl}" height="#{avatarHeight}" width="#{avatarWidth}" alt="#{screenName}" title="#{screenName}" /></a></div><div class="txt"><p class="type">#{feedType}</p><p class="teaser">#{text}</p><p class="date"><span>#{createdAt}</span> (<a  href="http://twitter.com/intent/tweet?in_reply_to=#{id}">Reply</a>) (<a  href="http://twitter.com/intent/retweet?tweet_id=#{id}">RT</a>)</span></p><div class="share_wrapper clearfix"><div class="fb_share"><fb:share-button class="url" href="http://twitter.com/#!/#{screenName}/status/#{id}" type="button_count"></fb:share-button></div></div></div></div>',
            newsBlogTemplate : '<div class="listeditem feeditem newsblogitem twocol_left clearfix"><div class="img"><a href="#{story_url}"><img src="#{teaser_image_url}" height="#{teaser_image_height}" width="#{teaser_image_width}" alt="#{title}" title="#{title}" /></a></div><div class="txt"><p class="type">#{feedType}</p><h3 class="title"><a href="#{story_url}">#{title}</a></h3><div class="teaser">#{teaser} <a href="#{story_url}">Read more &#187;</a></div><p class="date">#{cover_date}</p><div class="share_wrapper clearfix"><div class="fb_share"><fb:share-button class="url" href="#{story_url}" type="button_count"></fb:share-button></div><div class="tweet"><a href="http://twitter.com/share?url=#{encoded_story_url}&text=#{encoded_title}" class="twitter-share-button">Tweet</a></div></div></div></div>',
            count: 3
        });
        $('#select_news, #select_blog, #select_twitter').click(function() {
            $('#feedselect .feedcontainer').feedSelect({
                getNews: $('#select_news').attr('checked'),
                getBlog: $('#select_blog').attr('checked'),
                getTwitter: $('#select_twitter').attr('checked'),
                newsUrl: '/ssi/select_news/index.html',
                blogUrl: '/ssi/select_blog_wi/index.html',
                twitterUrl: 'http://api.twitter.com/1/statuses/user_timeline.json?screen_name=emilyslist',
                includeShareLinks: true,
                //twitterTemplate : '<div class="listeditem feeditem twitteritem twocol_left clearfix"><div class="img"><a href="http://twitter.com/#{screenName}/"><img src="#{profileImageUrl}" height="#{avatarHeight}" width="#{avatarWidth}" alt="#{screenName}" title="#{screenName}" /></a></div><div class="txt"><p class="type">#{feedType}</p><p class="teaser">#{text}</p><p class="date"><span>#{createdAt}</span> (<a  href="http://twitter.com/intent/tweet?in_reply_to=#{id}">Reply</a>) (<a  href="http://twitter.com/intent/retweet?tweet_id=#{id}">RT</a>)</span><div class="share_wrapper clearfix"><div class="fb_share"><fb:share-button class="url" href="http://twitter.com/#!/#{screenName}/status/#{id}" type="button_count"></fb:share-button></div><div class="tw_share"><a href="http://twitter.com/share" class="twitter-share-button">Tweet</a></div></div></div></div>',
                twitterTemplate : '<div class="listeditem feeditem twitteritem twocol_left clearfix"><div class="img"><a href="http://twitter.com/#{screenName}/"><img src="#{profileImageUrl}" height="#{avatarHeight}" width="#{avatarWidth}" alt="#{screenName}" title="#{screenName}" /></a></div><div class="txt"><p class="type">#{feedType}</p><p class="teaser">#{text}</p><p class="date"><span>#{createdAt}</span> (<a  href="http://twitter.com/intent/tweet?in_reply_to=#{id}">Reply</a>) (<a  href="http://twitter.com/intent/retweet?tweet_id=#{id}">RT</a>)</span></p><div class="share_wrapper clearfix"><div class="fb_share"><fb:share-button class="url" href="http://twitter.com/#!/#{screenName}/status/#{id}" type="button_count"></fb:share-button></div></div></div></div>',
                newsBlogTemplate : '<div class="listeditem feeditem newsblogitem twocol_left clearfix"><div class="img"><a href="#{story_url}"><img src="#{teaser_image_url}" height="#{teaser_image_height}" width="#{teaser_image_width}" alt="#{title}" title="#{title}" /></a></div><div class="txt"><p class="type">#{feedType}</p><h3 class="title"><a href="#{story_url}">#{title}</a></h3><div class="teaser">#{teaser} <a href="#{story_url}">Read more &#187;</a></div><p class="date">#{cover_date}</p><div class="share_wrapper clearfix"><div class="fb_share"><fb:share-button class="url" href="#{story_url}" type="button_count"></fb:share-button></div><div class="tweet"><a href="http://twitter.com/share?url=#{encoded_story_url}&text=#{encoded_title}" class="twitter-share-button">Tweet</a></div></div></div></div>',
                count: 3
            });
        });
    }
    
    // wisconsin photo gallery
    if ($('body.wisc-sc2 #flickr_badge_wrapper').length > 0 ) {
        $('body.wisc-sc2 #flickr_badge_wrapper .flickr_badge_image a').click(function() {
            var title = $('img', this).attr('title');
            var imgUrl = $('img', this).attr('src');
            imgUrl = imgUrl.replace('_s.jpg', '_b.jpg');
            $.fancybox({
                href : imgUrl,
                title : title
            });
            return false;
        });
    }

    // populate social-tell form stuff
    $('body.social-tell .form-wrapper .taf-email textarea').val($.trim($('body.social-tell #email-msg').text()));
    
    var stEmail = 'mailto:?subject=' + encodeURIComponent($.trim($('body.social-tell #email-subject').text())) + '&body=' + encodeURIComponent($.trim($('body.social-tell #email-msg').text()));
    $('body.social-tell .form-wrapper .taf-email p.button a').attr('href', stEmail);
    
    var stTwitter = 'http://twitter.com/intent/tweet?text=' + encodeURIComponent($.trim($('body.social-tell #twitter-msg').text()));
    $('body.social-tell .form-wrapper .taf-twitter p.button a').attr('href', stTwitter);

    var stFacebook = 'http://www.facebook.com/sharer.php?u=' + encodeURIComponent($.trim($('body.social-tell #facebook-url').text()));
    $('body.social-tell .form-wrapper .taf-facebook p.button a').attr('href', stFacebook);

    // background image kludge for form_layout_3
    $('body.form_layout_3 #content form').wrap('<div class="intro-form-wrapper clearfix" />');
    $('body.form_layout_3 #content .intro').prependTo('body.is_form #content div.intro-form-wrapper');


});

// CF thermometer
vanilla.addLoadEvent(function() {
    if (typeof vanilla.cf_data == 'undefined') {
        return;
    }
    
    // we delay this a bit so the user will see the entire effect
    setTimeout(function() {
        jQuery('#cf_progress #goal').html('$' + vanilla.format_number(vanilla.cf_data.goal));
        jQuery('#cf_progress #count').html(vanilla.cf_data.count + ((vanilla.cf_data.count == 1) ? ' donor' : ' donors'));
        jQuery('#cf_progress #average').html('$' + vanilla.format_number((vanilla.cf_data.raised/vanilla.cf_data.count).toFixed(2)));

        jQuery("#cf_progress").progressBar({
            value    : Math.round(vanilla.cf_data.raised * 100 / vanilla.cf_data.goal),
            height   : 190,
            width    : 32,
            callback : function(config) {
                var raised = 0;
                if (config.value > 0) {
                    raised = vanilla.format_number((vanilla.cf_data.raised * (config.runningValue / config.value)).toFixed(2));
                    raised = raised.replace('.00', '');
                }
                jQuery('#cf_progress #raised').html('$' + raised);
                
                if (config.runningValue == config.max) {
                    jQuery('#cf_progress').addClass('goal_reached');
                    jQuery('#cf_progress #scale').hide();
                }
                if (config.runningValue > config.max) {
                    jQuery('#cf_progress').addClass('goal_exceeded');
                    jQuery('#cf_progress #scale').hide();
                }
            }
        });
    }, 500);
});

vanilla.results2010 = function(url) {
    jQuery.ajax({
        url: url,
        context: document.body,
        dataType: 'html',
        success: function(data) {
            var html = '<div id="election_night_results">' + jQuery(data).find('.election_night_lightbox').html() + '</div>';
            jQuery.fancybox(html, {
                autoDimensions: false,
                width: 600,
                height: 'auto'
            });
        }
     });
};

