 fusion_tables_escape = (value) ->
   "'#{value.replace(/'/g,"\\\'")}'"
 
+# submit the form to Fusion Tables
 submit_collection_form = ->
   disable_collection_form()
   collection = $('#collection_select').val()
   column_names = []
   row_values = []
+  # the main body of the submission is in an anonymous callback function that gets the URN,
+  # this is so we hopefully have the latest URN possible
   construct_latest_urn (urn) =>
     $('#URN').attr('value',urn)
     update_timestamp_inputs()

          if callback?
            callback(data)

get_value_for_form_input = (element) ->
  if $(element).attr('class') == 'pagedown_container'
    $(element).find('.wmd-input').val()
  else
    $(element).val()

construct_latest_urn = (callback) ->
  collection = $('#collection_select').val()
  fusion_tables_query "SELECT ROWID FROM #{collection}", (data) =>

        set_cookie('access_token',params['access_token'],params['expires_in'])
        $('#collection_select').change()

# construct a clippy element to replace the given placeholder id
clippy = (id) ->
  console.log "Clippy: #{id}"
  flashvars =
