function BlogPreview(container) {
  this.container_ = container;
}

BlogPreview.prototype.show = function(url, opt_noTitle) {
  var feed = new google.feeds.Feed(url);
  var preview = this;
  feed.load(function(result) {
    preview.render_(result, opt_noTitle);
  });
}

BlogPreview.prototype.render_ = function(result, opt_noTitle) {
  if (!result.feed || !result.feed.entries) return;
  while (this.container_.firstChild) {
    this.container_.removeChild(this.container_.firstChild);
  }

  var blog = this.createDiv_(this.container_, "");
 // if (!opt_noTitle) {
 //   var header = this.createElement_("h2", blog, "");
 //   this.createLink_(header, result.feed.link, result.feed.title);
 // }

  for (var i = 0; i < result.feed.entries.length; i++) {
    var entry = result.feed.entries[i];
    var div = this.createDiv_(blog, "");
    var linkDiv = this.createDiv_(div, "");
    this.createLink_(linkDiv, entry.link, entry.title);
    var pubDate = new Date (entry.publishedDate)
    this.createDiv_(div, "author", "Posted " + pubDate.getMonth() + "/" + pubDate.getDate() + "/" + pubDate.getFullYear());
    this.createDiv_(div, "", entry.content);
    this.createHr_(div, "");

  }
}

BlogPreview.prototype.createDiv_ = function(parent, className, opt_text) {
  return this.createElement_("div", parent, className, opt_text);
}

BlogPreview.prototype.createHr_ = function(parent, className) {
  return this.createElement_("hr", parent, className, "");
}

BlogPreview.prototype.createBr_ = function(parent, className) {
  return this.createElement_("br", parent, className, "");
}

BlogPreview.prototype.createLink_ = function(parent, href, text) {
  var link = this.createElement_("a", parent, "blog_title_link", text);
  link.href = href;
  return link;
}

BlogPreview.prototype.createElement_ = function(tagName, parent, className,
                                                opt_text) {
  var div = document.createElement(tagName);
  div.className = className;
  parent.appendChild(div);
  if (opt_text) {
    div.innerHTML=opt_text;
  }
  return div;
}