

 


(function() {

// Localize jQuery variable
var jQuery;

/******** Load jQuery if not present *********/
if (window.jQuery === undefined || window.jQuery.fn.jquery !== '1.7.2') {

    var script_tag = document.createElement('script');
    script_tag.setAttribute("type","text/javascript");
    script_tag.setAttribute("src",
        "http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js");
    if (script_tag.readyState) {
      script_tag.onreadystatechange = function () { // For old versions of IE
          if (this.readyState == 'complete' || this.readyState == 'loaded') {
              scriptLoadHandler();
          }
      };
    } else {
      script_tag.onload = scriptLoadHandler;
    }
    // Try to find the head, otherwise default to the documentElement
    (document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_tag);

    
} else {
    // The jQuery version on the window is the one we want to use
    jQuery = window.jQuery;
    main();
}

/******** Called once jQuery has loaded ******/
function scriptLoadHandler() {
    // Restore $ and window.jQuery to their previous values and store the
    // new jQuery in our local jQuery variable
    jQuery = window.jQuery.noConflict(true);

   
}

/******** Our main function ********/ 

(function(funcName, baseObj) {
    // The public function name defaults to window.docReady
    // but you can pass in your own object and own function name and those will be used
    // if you want to put them in a different namespace
    funcName = funcName || "docReady";
    baseObj = baseObj || window;
    var readyList = [];
    var readyFired = false;
    var readyEventHandlersInstalled = false;
    
    // call this when the document is ready
    // this function protects itself against being called more than once
    function ready() {
        if (!readyFired) {
            // this must be set to true before we start calling callbacks
            readyFired = true;
            for (var i = 0; i < readyList.length; i++) {
                // if a callback here happens to add new ready handlers,
                // the docReady() function will see that it already fired
                // and will schedule the callback to run right after
                // this event loop finishes so all handlers will still execute
                // in order and no new ones will be added to the readyList
                // while we are processing the list
                readyList[i].fn.call(window, readyList[i].ctx);
            }
            // allow any closures held by these functions to free
            readyList = [];
        }
    }
    
    function readyStateChange() {
        if ( document.readyState === "complete" ) {
            ready();
        }
    }
    
    // This is the one public interface
    // docReady(fn, context);
    // the context argument is optional - if present, it will be passed
    // as an argument to the callback
    baseObj[funcName] = function(callback, context) {
        // if ready has already fired, then just schedule the callback
        // to fire asynchronously, but right away
        if (readyFired) {
            setTimeout(function() {callback(context);}, 1);
            return;
        } else {
            // add the function and context to the list
            readyList.push({fn: callback, ctx: context});
        }
        // if document already ready to go, schedule the ready function to run
        if (document.readyState === "complete") {
            setTimeout(ready, 1);
        } else if (!readyEventHandlersInstalled) {
            // otherwise if we don't have event handlers installed, install them
            if (document.addEventListener) {
                // first choice is DOMContentLoaded event
                document.addEventListener("DOMContentLoaded", ready, false);
                // backup is window load event
                window.addEventListener("load", ready, false);
            } else {
                // must be IE
                document.attachEvent("onreadystatechange", readyStateChange);
                window.attachEvent("onload", ready);
            }
            readyEventHandlersInstalled = true;
        }
    }
})("docReady", window);

         /******* Load HTML *******/
        //this nees to come back in json format 
         
         docReady(function() {
         document.getElementById("newswhip-trending").innerHTML= "\n\n\n\n\n\n\n\n\n\n\n\n<body>\n\n<style type=\"text\/css\" media=\"screen\">\n#newswhip-trending .stats {width: 90px !important;}\n#newswhip-trending .comments i { float: left; background: url(http:\/\/static.newswhip.com\/static\/images\/DailyKos\/socials.png?domain=www) no-repeat 0 0; width: 11px; height: 11px; margin: 2px 3px 0 0; }\n#newswhip-trending .recs{ float: right !important; }\n#newswhip-trending .recs i { float: left; background: url(http:\/\/static.newswhip.com\/static\/images\/DailyKos\/socials.png?domain=www) no-repeat 0 -12px; width: 11px; height: 11px; margin: 2px 3px 0 0; }\n#newswhip-trending .navigation {display: none !important;}\n#newswhip-trending .collapsable-panel{margin-bottom: 0px !important;}\n.nw-powered { margin-bottom: 20px;font-size: 11px; padding: 0 0.5em 0.5em;}\n.nw-powered, .nw-powered a { color: #666; }\n<\/style>\n\n<script type=\"text\/javascript\">\n  \n(function(i,s,o,g,r,a,m){i[\'GoogleAnalyticsObject\']=r;i[r]=i[r]||function(){\n\t  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n\t  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n\t  })(window,document,\'script\',\'\/\/www.google-analytics.com\/analytics.js\',\'ga\');\n\n\t  ga(\'create\', \'UA-18201240-5\', \'newswhip.com\');\n\t  ga(\'send\', \'pageview\');\n\n\n<\/script>\n\n<div id=\"newswhip_shared_div\" class=\"featured-articles collapsable-panel ajax-paged\">\n<a class=\"collapsor\" href=\"#\"><h2 class=\"tight\" id=\"newswhip_shared\">Most Shared<\/h2><\/a>\n<ul class=\"articles ajax-paged-content\">\n\n\t\n\t\t<li class=\"clearfix\"> <div><a class=\"title\" href=\"http:\/\/www.dailykos.com\/story\/2015\/05\/31\/1389247\/-Beau-Biden-attorney-general-of-Delaware-and-son-of-Joe-Biden-dies-of-brain-cancer-at-46\" onClick=\"ga( \'send\', \'event\', \'click\', \'DailyKos\', \'http:\/\/www.dailykos.com\/story\/2015\/05\/31\/1389247\/-Beau-Biden-attorney-general-of-Delaware-and-son-of-Joe-Biden-dies-of-brain-cancer-at-46\');\">Beau Biden, attorney general of Delaware and son of Joe Biden, dies of brain cancer at 46<\/a><\/div>\n\t\t\n\t\t\n\t\t\t<span class=\"byline\"><span class=\"by\">by<\/span> <a href=\"http:\/\/www.dailykos.com\/user\/David Nir\" class=\"author\" onClick=\"ga( \'send\', \'event\', \'click\', \'DailyKos\', \'David Nir\');\">David Nir<\/a><\/span> \n\t\t\n\t\t<span class=\"stats\">\n\t\t\t<span class=\"comments\">\n\t\t\t\t<i><\/i>7993\n\t\t\t<\/span>\t\n\t\t\t<span class=\"recs\">\n\t\t\t\t<i><\/i>151\n\t\t\t\t<\/span>\n\t\t<\/span>\n\t\t<\/li>\n\t\n\t\t<li class=\"clearfix\"> <div><a class=\"title\" href=\"http:\/\/www.dailykos.com\/story\/2015\/05\/31\/1389291\/-A-Link-To-Send-The-Biden-Family-Our-Condolences\" onClick=\"ga( \'send\', \'event\', \'click\', \'DailyKos\', \'http:\/\/www.dailykos.com\/story\/2015\/05\/31\/1389291\/-A-Link-To-Send-The-Biden-Family-Our-Condolences\');\">A Link To Send The Biden Family Our Condolences<\/a><\/div>\n\t\t\n\t\t\n\t\t\t<span class=\"byline\"><span class=\"by\">by<\/span> <a href=\"http:\/\/www.dailykos.com\/user\/Leslie Salzillo\" class=\"author\" onClick=\"ga( \'send\', \'event\', \'click\', \'DailyKos\', \'Leslie Salzillo\');\">Leslie Salzillo<\/a><\/span> \n\t\t\n\t\t<span class=\"stats\">\n\t\t\t<span class=\"comments\">\n\t\t\t\t<i><\/i>278\n\t\t\t<\/span>\t\n\t\t\t<span class=\"recs\">\n\t\t\t\t<i><\/i>4\n\t\t\t\t<\/span>\n\t\t<\/span>\n\t\t<\/li>\n\t\n\t\t<li class=\"clearfix\"> <div><a class=\"title\" href=\"http:\/\/www.dailykos.com\/story\/2015\/05\/31\/1387824\/-The-white-riot-that-burned-Greenwood-to-the-ground\" onClick=\"ga( \'send\', \'event\', \'click\', \'DailyKos\', \'http:\/\/www.dailykos.com\/story\/2015\/05\/31\/1387824\/-The-white-riot-that-burned-Greenwood-to-the-ground\');\">The white riot that burned Greenwood to the ground<\/a><\/div>\n\t\t\n\t\t\n\t\t\t<span class=\"byline\"><span class=\"by\">by<\/span> <a href=\"http:\/\/www.dailykos.com\/user\/Denise Oliver Velez\" class=\"author\" onClick=\"ga( \'send\', \'event\', \'click\', \'DailyKos\', \'Denise Oliver Velez\');\">Denise Oliver Velez<\/a><\/span> \n\t\t\n\t\t<span class=\"stats\">\n\t\t\t<span class=\"comments\">\n\t\t\t\t<i><\/i>122\n\t\t\t<\/span>\t\n\t\t\t<span class=\"recs\">\n\t\t\t\t<i><\/i>35\n\t\t\t\t<\/span>\n\t\t<\/span>\n\t\t<\/li>\n\t\n\t\t<li class=\"clearfix\"> <div><a class=\"title\" href=\"http:\/\/www.dailykos.com\/story\/2015\/05\/31\/1388352\/-Book-Review-Dire-Predictions-2nd-Edition\" onClick=\"ga( \'send\', \'event\', \'click\', \'DailyKos\', \'http:\/\/www.dailykos.com\/story\/2015\/05\/31\/1388352\/-Book-Review-Dire-Predictions-2nd-Edition\');\">Book Review: Dire Predictions 2nd Edition<\/a><\/div>\n\t\t\n\t\t\n\t\t\t<span class=\"byline\"><span class=\"by\">by<\/span> <a href=\"http:\/\/www.dailykos.com\/user\/DarkSyde\" class=\"author\" onClick=\"ga( \'send\', \'event\', \'click\', \'DailyKos\', \'DarkSyde\');\">DarkSyde<\/a><\/span> \n\t\t\n\t\t<span class=\"stats\">\n\t\t\t<span class=\"comments\">\n\t\t\t\t<i><\/i>15\n\t\t\t<\/span>\t\n\t\t\t<span class=\"recs\">\n\t\t\t\t<i><\/i>16\n\t\t\t\t<\/span>\n\t\t<\/span>\n\t\t<\/li>\n\t\n\t\t<li class=\"clearfix\"> <div><a class=\"title\" href=\"http:\/\/www.dailykos.com\/story\/2015\/05\/31\/1389306\/-Don-Siegelman-The-Convict-at-All-Costs-Mandate-Must-Change\" onClick=\"ga( \'send\', \'event\', \'click\', \'DailyKos\', \'http:\/\/www.dailykos.com\/story\/2015\/05\/31\/1389306\/-Don-Siegelman-The-Convict-at-All-Costs-Mandate-Must-Change\');\">Don Siegelman: The \"Convict at All Costs\" Mandate Must Change<\/a><\/div>\n\t\t\n\t\t\n\t\t\t<span class=\"byline\"><span class=\"by\">by<\/span> <a href=\"http:\/\/www.dailykos.com\/user\/wclint\" class=\"author\" onClick=\"ga( \'send\', \'event\', \'click\', \'DailyKos\', \'wclint\');\">wclint<\/a><\/span> \n\t\t\n\t\t<span class=\"stats\">\n\t\t\t<span class=\"comments\">\n\t\t\t\t<i><\/i>11\n\t\t\t<\/span>\t\n\t\t\t<span class=\"recs\">\n\t\t\t\t<i><\/i>6\n\t\t\t\t<\/span>\n\t\t<\/span>\n\t\t<\/li>\n\t\n<\/ul>\n<ul class=\"navigation\">\n<li class=\"next\"><a class=\"do-page-next ajaxON\" href=\"\/part\/sidebar\/stories\/editors_choice?page=1\">Next<\/a><\/li>\n<\/ul>\n<\/div>\n\n<\/body>\n\n\n\n\n\n\n\n\n";
		

		  
          

function checkCookie(clicked) {
    var compact = getCookie("newswhip-compact");
    if (compact != "") {
        if (clicked == "true") {
            setCookie("newswhip-compact", true, -1);
        } else {
            var a = $("#newswhip-trending .collapsor");
            a.parent("div.collapsable-panel").toggleClass("collapsed");
            a.blur();
            kck.set_coll_pref(a.parent());
        }


    } else {
        if (clicked == "true") {
            setCookie("newswhip-compact", true, 365);
        }
    }
}

function setCookie(cname, cvalue, exdays) {
    var d = new Date();
    d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
    var expires = "expires=" + d.toGMTString();
    document.cookie = cname + "=" + cvalue + "; " + expires;
}


function getCookie(cname) {
    var name = cname + "=";
    var ca = document.cookie.split(';');
    for (var i = 0; i < ca.length; i++) {
        var c = ca[i].trim();
        if (c.indexOf(name) == 0) return c.substring(name.length, c.length);
    }
    return "";
}

checkCookie("false");
$("#newswhip-trending .collapsor").click(function () {
    checkCookie("true")
});
$("#newswhip-trending .collapsor").click(App.onAjaxButtonCollapse);
          
          
        });
    
    
    


})(); // We call our anonymous function immediately
