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

gb_query = (gb_id, level = 0) ->
  if gb_id not in QUERIED_IDS['gb']
    QUERIED_IDS['gb'].push gb_id
    fusion_tables_query "SELECT ia_identifier FROM #{IA_GB_TABLE_ID} WHERE gb_identifier = #{fusion_tables_escape(gb_id)}",
      (data) ->
        if data.rows?
          process_ia_id(row[0],(1 - level)*100) for row in data.rows.reverse()
          if level == 0
            ia_query(row[0],1) for row in data.rows.reverse()

gb_url = (gb_id) ->
  "https://books.google.com/books?id=#{gb_id}"

ia_query = (ia_id, level = 0) ->
  if ia_id not in QUERIED_IDS['ia']
    QUERIED_IDS['ia'].push ia_id
    $.ajax "#{API_GATEWAY_URI}/ht-ia/ia/#{ia_id}",
      type: 'GET'
      cache: true
      dataType: 'json'
      crossDomain: true
      error: (jqXHR, textStatus, errorThrown) ->
        $('#results').append($('<div/>',{class: 'alert alert-danger', role: 'alert'}).text('Error in Book Aligner IA/HT AJAX call.'))
        console.log errorThrown
        console.log "AJAX Error: #{textStatus}"
      success: (data) ->
        if data.length
          process_ht_id(result.ht_identifier, (1 - level) * parseInt(result.score)) for result in data
          if level == 0
            ht_query(result.ht_identifier,1) for result in data
    $.ajax "#{API_GATEWAY_URI}/ia-gb/ia/#{ia_id}",
      type: 'GET'
      cache: true
      dataType: 'json'
      crossDomain: true
      error: (jqXHR, textStatus, errorThrown) ->
        $('#results').append($('<div/>',{class: 'alert alert-danger', role: 'alert'}).text('Error in Book Aligner IA/GB AJAX call.'))
        console.log errorThrown
        console.log "AJAX Error: #{textStatus}"
      success: (data) ->
        if data.length
          process_gb_id(result.gb_identifier, (1 - level) * 100) for result in data
          if level == 0
            gb_query(result.gb_identifier,1) for result in data

ia_url = (ia_id) ->
  "https://archive.org/details/#{ia_id}"
