(function(){
  
  getParentScriptTag = function() {
    // Attempt to get parent script tag via id
    scr = document.getElementById("publish2_widget_token"); 
    // Legacy widgets don't have script tag id attributes, so find the parent script tag via url 
    if (!scr) {
      var scripts = document.getElementsByTagName('script');
      for (var i=0, len=scripts.length; i<len; i++) {  
        if (scripts[i].src == "http://www.publish2.com/syndicate/widget/?feed=user-newsgroups/cgi-latest-news-live.js&feed_type=cgi-latest-news-live.js&widget_src=http%3A%2F%2Fclients.publish2.com%2Fsyndicate%2Fwidget%2F%3Ffeed%3Duser-newsgroups%2Fcgi-latest-news-live.js&title=&short_url=1&publication_name=1&video_display=1&video_width=160&labels=news%2Cwebinar%2Cvideo%2Caudio%2Creport%2Cpresentation%2Ccommentary%2Cblog%2Cslides&publication_date=1&journalist=&tags=&jquery_noconflict=&number_of_items=10&headline_font_family=&headline_font_size=&headline_font_color=&headline_font_decoration=&headline_font_weight=&comment_font_family=&comment_font_size=") {
          scr = scripts[i];
          break;
        }
      } 
    }
  };
  
  injectContainer = function() {
    // Unique container for widget HTML, hidden until filled so we aren't adding elements to the live DOM
    var container = document.createElement('div');
    container.id = "publish2_widget_html_26175d217e275e4e20bd965156938759";
    // Check for IE non-standard attribute
    if (typeof container.style.setAttribute != "undefined") {
      container.style.setAttribute('cssText', 'display:none', 0);
    } else {
      container.setAttribute('style', 'display:none');
    }
    scr.parentNode.insertBefore(container, scr);    
  };
  
  loadjQuery = function() {
    // jQuery assigned to window.p2jQuery with noConflict(true)
    var jquerysrc = document.createElement('script');
    jquerysrc.type = "text/javascript";
    jquerysrc.src = "http://www.publish2.com/static/js/jquery-1.4.2.min.widget.js";
    scr.parentNode.insertBefore(jquerysrc, scr);    
  };

    renderWidgetbb7a6d86038229aae9bc1ebb173c86e9 = function(elapsed) {
    // Don't load display.js until window.p2jQuery is available
    if (typeof window.p2jQuery == "undefined") {
      if (elapsed <= 5000) { 
        setTimeout("renderWidgetbb7a6d86038229aae9bc1ebb173c86e9(" + (elapsed + 50) + ")", 50);
      } else {
        var error = document.createElement('div');
        var errornode = document.createTextNode("Publish2 widget temporarily unavailable");
        error.appendChild(errornode);
        scr.parentNode.insertBefore(error, scr);      
      }
    } else {
      
      // Load JSON, parse JSON and inject HTML into DOM 
      var widget = document.createElement('script');
      widget.src = "http://www.publish2.com/widget/display/publish2_widget_html_26175d217e275e4e20bd965156938759/?feed=user-newsgroups/cgi-latest-news-live.js&feed_type=cgi-latest-news-live.js&widget_src=http%3A%2F%2Fclients.publish2.com%2Fsyndicate%2Fwidget%2F%3Ffeed%3Duser-newsgroups%2Fcgi-latest-news-live.js&title=&short_url=1&publication_name=1&video_display=1&video_width=160&labels=news%2Cwebinar%2Cvideo%2Caudio%2Creport%2Cpresentation%2Ccommentary%2Cblog%2Cslides&publication_date=1&journalist=&tags=&jquery_noconflict=&number_of_items=10&headline_font_family=&headline_font_size=&headline_font_color=&headline_font_decoration=&headline_font_weight=&comment_font_family=&comment_font_size=";
      widget.type = "text/javascript";
      scr.parentNode.insertBefore(widget, scr);        
    }
  };
  
getParentScriptTag();
injectContainer();
loadjQuery();
renderWidgetbb7a6d86038229aae9bc1ebb173c86e9(0);
})();
