
window.onload = function () {
  var blogFeeds, blogId;
  for (blogId in feedmap) {
    blogFeeds = new LSBlogPostsGetAll({
        "blogid": blogId,
        "sort" : 'creationdate',
        "count" :5
      }, function(blogObj) {
//console.log("blogObj: ", blogObj);
        var entries = blogObj.items;
        if (entries.length > 0) {
          var bId = entries[0].BlogID[0];
          var options = feedmap[bId];
//console.log("options: ", options);
          var target = document.getElementById(options.targetId);
          var buf=[], entry;
          buf.push("<div class='blog-entries'>");
          for (i = 0; i < entries.length; i++) {
            buf.push("<div class='blog-entry'>");
            entry = entries[i];
//console.log("entry: ", entry);
            buf.push("<p>");
            if (options.thumb) {
              buf.push("<img src='");
              buf.push(entry.MediaUrl);
              buf.push("' width='50' height='50'/>");
            }
            buf.push("<a href='");
            buf.push(entry.link);
            buf.push("'>");
            buf.push(entry.title);
            buf.push("</a><br />");
            buf.push(entry.description);
            buf.push("</p>");
            buf.push("</div>");
          }
          buf.push("</div>");
          target.innerHTML = buf.join("");
        }
      }
    );
  }


  if (lsbFeed) {
    var entries = lsbFeed.entries;
    for (var i = 0; i < entries.length; i++) {
      var buf = [];
      var entry = entries[i];
      buf.push("<div class='feed-entry'><h2>");
      buf.push(entry.title);
      buf.push("</h2><div class='feed-entry-content'>");
      buf.push(entry.content);
      buf.push("</div></div>");
      document.getElementById(entry.targetId).innerHTML = buf.join("");
    }
  }




  };
  
   


