     zoom_listener = d3.behavior.zoom().
       scaleExtent([0.1, 3]).on("zoom", zoom)
 
-    $("div#d3_graph").html("")
+    d3.select("div#d3_graph").html("")
     svg = d3.select("div#d3_graph")
       .append('svg')
       .attr('width', width)

      .attr("data-label", (d) -> d.label)

    embedNodeInfo = (node) ->
      info_list = $('<ul />', id: 'node_info')
      payload =
        node_url: node_url
        node: node
        url: "#{node_url}/#{node.info.id}/"
      template = templateName(edge_type, 'node')
      info_list.html(HandlebarsTemplates[template](payload)) if template
      $("div#d3_context").html(info_list)

    embedEdgeInfo = (edge) ->
      info_list = $('<ul />', id: 'edge_info')
      payload =
        edge_url: edge_url
        edge: edge
      template = templateName(edge_type, 'edge')
      info_list.html(HandlebarsTemplates[template](payload)) if template
      $("div#d3_context").html(info_list)

    $("g.node").on "click", (e) ->
      e.preventDefault()
      resetSelections()
      default_classes = "node"
      classes = "#{default_classes} selected"
      node_data = d3.select(this).data()[0]
      # use attr, because jquery-class doesn't work
      if window.selected_node != this
        $(window.selected_node).attr('class', default_classes)
      window.selected_node = this
      $(this).attr('class', classes)
      embedNodeInfo(node_data)

    $("g > path").on "click", (e) ->
      e.preventDefault()
      resetSelections()
      path_data = d3.select(this).data()[0]
      addClass($(this), 'selected')
      embedEdgeInfo(path_data)

    $('path').on('mouseenter', (e) ->
      removeClass('g.node', 'highlight')
      path_data = d3.select(this).data()[0]
      source_index = path_data.source.index
      target_index = path_data.target.index
      addClass($(node[0][source_index]), 'highlight')
      addClass($(node[0][target_index]), 'highlight')
    )
    $('path').on('mouseleave', (e) -> removeClass('g.node', 'highlight'))

    node.append("circle").
      attr("r", (d) -> if d.is_center then 10 else 7)

      .attr("d", "M0,-6L10,0L0,6")

jQuery ->
  d3.select("div#d3_graph").html(HandlebarsTemplates['graphs/loading']({}))
  $.get(graphs_uri, (data) ->
      displayGraph(data)
    , "json")
