AJAX_AMZWEB_PKG.EditorialReviewRenderer = function(response, properties) {
  this._response = response;
  this._properties = properties;
};

AJAX_AMZWEB_PKG.EditorialReviewRenderer.prototype.display = function() {
  if(this._response.Item) {
    var product = this._response.Item;

    if (product.editorialReview || product.synopsis) {
      var widgetHTML = '';
      if (!document.getElementById('editorialReviews')) {
        // Need custom heading
        widgetHTML += '<h3 id="editorialReviews" style="border-bottom: 1px solid #C9D4D7;padding-bottom:4px">' + this._properties.titleEditorialReviews + '</h3>';
      }

      if (product.synopsis && !document.getElementById('synopsis')) {
        // No AbeBooks synopsis, so use Amazon's
        widgetHTML += '<strong>' + this._properties.titleSynopsis + '</strong>';
        widgetHTML += '<p class="toggle" style="padding-top: 3px;">' + product.synopsis.replace(/<\/?(table|tr|td|tdata|center|div)>/gi, "") + '</p>';
        widgetHTML += '<br/>';
      }

      if (product.editorialReview) {
        widgetHTML += '<strong>' + this._properties.titleAmazonReview + '</strong>';
        widgetHTML += '<p class="toggle" style="padding-top: 3px;">' + product.editorialReview.replace(/<\/?(table|tr|td|tdata|center|div)>/gi, "") + '</p>';
      }

      document.getElementById('amz-web-service-EditorialReview').innerHTML = widgetHTML;
    }
  }
};