     elt = $(this)
     if not elt.data 'editing'
       # turn on editing
-      orig = editon elt
+      orig = editOn elt
 
       # make into textbox
       elt.html TEXT_INPUT(orig)

          # strip phone non-numbers
          if elt.hasClass 'phone'
            newtext = newtext.replace /\D/g,''
          editoff elt, newtext

          # begin ajax
          row = do elt.parent
          $.ajax {
            method: 'PUT',
            url: "/contacts/#{getId(row)}",
            data: contactInfoFor row
            error: (x) ->
              # reset text
              elt.text orig

              # display errors
              errs = $.parseJSON(x.responseText).errors
              $(document).trigger 'add-alerts', ({
                message: err,
                priority: 'warning'
              } for err in errs)
          }

      # cancel on defocus
      textbox.blur ->
        editoff elt, orig

  # callback to friend/unfriend
  editToggle = ->
    elt = $(this)
    row = do elt.parent

    console.log row.data('friended')
    if friendsWith row
      unfriend row
      elt.html HEART_TOGGLE false
    else
      friend row
      elt.html HEART_TOGGLE true

  $ ->
    # Set up error box

  classify = (c) ->
    '.' + c

  # get tr element data-id
  idOf = (row) ->
    row.data 'id'

  # get whether or not friends with current tr
  friendsWith = (row) ->
    row.data 'friended'

  # friend a tr
  friend = (row, heart) ->
    row.data 'friended', 1
    heart.html HEART_TOGGLE(true)

  # unfriend a tr
  unfriend = (row, heart) ->
    row.data 'friended', 0
    heart.html HEART_TOGGLE(false)

  # get contact info for current tr
  contactInfoFor = (row) ->
    {
      name: do $(row.children('.name')[0]).text
      email: do $(row.children('.email')[0]).text
      phone: do $(row.children('.phone')[0]).text
    }

  # turn edit mode on
  editOn = (cell) ->
    cell.data 'editing', true
    cell.addClass EDITING
    do cell.text

  # switch textbox back to table cell
  editOff = (cell, text) ->
    cell.data 'editing', false
    cell.removeClass EDITING
    cell.text text

  # add errors to alert
  addErrors = (errs) ->
    $(document).trigger 'add-alerts', ({
    message: err,
    priority: 'warning'
    } for err in errs)

  # callback to edit table cell
  # http://mrbool.com/how-to-create-an-editable-html-table-with-jquery/27425
