

 


(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\/02\/03\/1362005\/-Republican-senator-says-restaurants-should-be-able-to-opt-out-of-mandatory-handwashing\" onClick=\"ga( \'send\', \'event\', \'click\', \'DailyKos\', \'http:\/\/www.dailykos.com\/story\/2015\/02\/03\/1362005\/-Republican-senator-says-restaurants-should-be-able-to-opt-out-of-mandatory-handwashing\');\">Republican senator says restaurants should be able to opt-out of mandatory handwashing<\/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\/Jen Hayden\" class=\"author\" onClick=\"ga( \'send\', \'event\', \'click\', \'DailyKos\', \'Jen Hayden\');\">Jen Hayden<\/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>8920\n\t\t\t<\/span>\t\n\t\t\t<span class=\"recs\">\n\t\t\t\t<i><\/i>107\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\/02\/03\/1361982\/-After-a-55-year-absence-Harper-Lee-to-release-new-novel-featuring-a-grown-up-Scout-Finch\" onClick=\"ga( \'send\', \'event\', \'click\', \'DailyKos\', \'http:\/\/www.dailykos.com\/story\/2015\/02\/03\/1361982\/-After-a-55-year-absence-Harper-Lee-to-release-new-novel-featuring-a-grown-up-Scout-Finch\');\">After a 55 year absence, Harper Lee to release new novel featuring a grown-up Scout Finch<\/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\/Jen Hayden\" class=\"author\" onClick=\"ga( \'send\', \'event\', \'click\', \'DailyKos\', \'Jen Hayden\');\">Jen Hayden<\/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>8479\n\t\t\t<\/span>\t\n\t\t\t<span class=\"recs\">\n\t\t\t\t<i><\/i>24\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\/02\/03\/1361826\/-Obama-issues-order-mandating-that-sea-level-rise-be-included-in-planning-new-federal-buildings\" onClick=\"ga( \'send\', \'event\', \'click\', \'DailyKos\', \'http:\/\/www.dailykos.com\/story\/2015\/02\/03\/1361826\/-Obama-issues-order-mandating-that-sea-level-rise-be-included-in-planning-new-federal-buildings\');\">Obama issues order mandating that sea level rise be included in planning new federal buildings<\/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\/Meteor Blades\" class=\"author\" onClick=\"ga( \'send\', \'event\', \'click\', \'DailyKos\', \'Meteor Blades\');\">Meteor Blades<\/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>2339\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\/02\/03\/1362014\/-The-O-Reilly-Factor-s-Totally-Lame-Response-To-Vermont-High-School-Students-You-re-Pinheads\" onClick=\"ga( \'send\', \'event\', \'click\', \'DailyKos\', \'http:\/\/www.dailykos.com\/story\/2015\/02\/03\/1362014\/-The-O-Reilly-Factor-s-Totally-Lame-Response-To-Vermont-High-School-Students-You-re-Pinheads\');\">The O\u2019Reilly Factor\'s Totally Lame Response To Vermont High School Students: You\'re Pinheads<\/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\/News Corpse\" class=\"author\" onClick=\"ga( \'send\', \'event\', \'click\', \'DailyKos\', \'News Corpse\');\">News Corpse<\/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>591\n\t\t\t<\/span>\t\n\t\t\t<span class=\"recs\">\n\t\t\t\t<i><\/i>7\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\/02\/03\/1362015\/-Sanity-May-Yet-Prevail-Even-the-NRA-Agrees-Residential-Gun-Ranges-Are-Stupid\" onClick=\"ga( \'send\', \'event\', \'click\', \'DailyKos\', \'http:\/\/www.dailykos.com\/story\/2015\/02\/03\/1362015\/-Sanity-May-Yet-Prevail-Even-the-NRA-Agrees-Residential-Gun-Ranges-Are-Stupid\');\">Sanity May Yet Prevail; Even the NRA Agrees Residential Gun Ranges Are Stupid<\/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\/pajoly\" class=\"author\" onClick=\"ga( \'send\', \'event\', \'click\', \'DailyKos\', \'pajoly\');\">pajoly<\/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>226\n\t\t\t<\/span>\t\n\t\t\t<span class=\"recs\">\n\t\t\t\t<i><\/i>10\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
