       dataType: 'json'
       crossDomain: true
       error: (jqXHR, textStatus, errorThrown) ->
-        $('#results').append($('<div/>',{class: 'alert alert-danger', role: 'alert'}).text("Error in Google Books AJAX call for identifier #{gb_id}"))
-        console.log jqXHR
-        console.log errorThrown
-        console.log "AJAX Error: #{textStatus}"
-      success: (data) ->
-        console.log("GB metadata for #{gb_id}:")
-        console.log data
+        if jqXHR.responseJSON.error.errors[0].domain == 'usageLimits'
+          unless $('#gb_quota_error').length
+            $('#results').append($('<div/>',{id: 'gb_quota_error', class: 'alert alert-danger', role: 'alert'}).text("Error in Google Books AJAX call: Google Books API Quota daily limit exceeded. Please try again tomorrow for improved results."))
+        else
+          $('#results').append($('<div/>',{class: 'alert alert-danger', role: 'alert'}).text("Error in Google Books AJAX call for GB identifier #{gb_id}"))
+          console.log jqXHR.responseJSON
+          console.log errorThrown
+          console.log "AJAX Error: #{textStatus}"
+      success: (data) ->
+        # console.log("GB metadata for #{gb_id}:")
+        # console.log data
         if $("##{html_id(gb_id)}").length == 0
           $('#table').DataTable().row.add([
             '<img src="http://www.google.com/favicon.ico" width="16" height="16"/>',

html_id = (input) ->
  input.replace(/[\/:$.,'-]/g,'_')

# wrap values in single quotes and backslash-escape single-quotes
fusion_tables_escape = (value) ->
  "'#{value.replace(/'/g,"\\\'")}'"

fusion_tables_query = (query, callback, error_callback) ->
  console.log "Query: #{query}"
  switch query.split(' ')[0]
    when 'SELECT'
      $.ajax "#{FUSION_TABLES_URI}/query?sql=#{query}&key=#{GOOGLE_API_KEY}",
        type: 'GET'
        dataType: 'json'
        crossDomain: true
        error: (jqXHR, textStatus, errorThrown) ->
          # $('#results').append($('<div/>',{class: 'alert alert-danger', role: 'alert'}).text("Error in Fusion Tables AJAX call."))
          console.log jqXHR
          console.log errorThrown
          console.log "AJAX Error: #{textStatus}"
          error_callback() if error_callback?
          console.log "Retrying Fusion Tables query: #{query}"
          fusion_tables_query(query, callback, error_callback)
        success: (data) ->
          console.log "Fusion Tables result for #{query}:"
          console.log data
          if callback?
            callback(data)

ht_rights = (usRightsString) ->
  if usRightsString? and (usRightsString.toLowerCase() == 'full view')
    return ''

      console.log errorThrown
      console.log "AJAX Error: #{textStatus}"
    success: (data) ->
      # console.log data
      ht_ids = (item.htid for item in data.items) # _.map(data.items, (item) -> item.htid)
      # console.log(ht_ids)
      for ht_id in ht_ids
        process_ht_id(ht_id, 100)

