
@remove_fields = (link) ->
  $(link).prev("input[type=hidden]").val "1"
  $(link).closest(".field").hide()
  false
@add_fields = (link, association, content) ->
  new_id = new Date().getTime()
  regexp = new RegExp("new_" + association, "g")
  $(link).closest("p").next("." + association + "_form").prepend content.replace(regexp, new_id).replace(association + "_class", "new_field")
  $(".new_field").removeClass "new_field"
  false