   for k,v of graph.links
     act_color = colors[list_index]
     list_index += 2
-    arcLinks graph.nodes,v,act_color[1],'t',v
-    $("#head").append "<span class='info navbar-brand' style='color:" + act_color[0] + "'>#" + k + ": " + v.length + "</span>"
+    console.log 
+    arcLinks graph.nodes,v,act_color[1],'t',k
+    $("#head").append "<a href='#" + k + "' class='info navbar-brand' style='color:" + act_color[0] + "'>#" + k + ": " + v.length + "</a>"
   
   drawNodes graph.nodes
   writeClaims graph.nodes
-  
 
 linearLayout = (nodes) ->
-  # used to scale node index to x position
   xscale = d3.scale.linear().domain([
     0
     nodes.length - 1

      d3.select(this).transition().duration(2000).delay(100).style('opacity',0).each "end", ->
        d3.select(this).remove()
        return
    
    return
  ).attr "d", (d, i) ->
    xdist = Math.abs(d.source.x - d.target.x)

colors = [
  [
    'rgb(228,26,28)'
    'rgba(228,26,28,0.66)'
  ]
  [
    'rgb(55,126,184)'
    'rgba(55,126,184,0.66)'
  ]
  [
    'rgb(77,175,74)'
    'rgba(77,175,74,0.66)'
  ]
  [
    'rgb(152,78,163)'
    'rgba(152,78,163,0.66)'
  ]
  [
    'rgb(255,127,0)'
    'rgba(255,127,0,0.66)'
  ]
  [
    'rgb(255,255,51)'
    'rgba(255,255,51,0.66)'
  ]
  [
    'rgb(166,86,40)'
    'rgba(166,86,40,0.66)'
  ]
  [
    'rgb(247,129,191)'
    'rgba(247,129,191,0.66)'
  ]
  [
    'rgb(153,153,153)'
    'rgba(153,153,153,0.66)'
  ]
]
# jQuery(document).ready ($) ->
$(".file").click (event) ->
  path = $(this).attr("href")
  event.preventDefault()
  $.ajax
    url: path
    success: (response) ->
      $("#content").empty()
      $('#arc').remove()
      $('span.info').remove()
      
      setHistory path
      buildGraph response
      $(".info").on "click", (event) ->
        makeLinksActive this
  return


setHistory = (path) ->
  if path!=window.location
    window.history.pushState({path:path},'',path)

makeLinksActive = (reference) ->
  cssColor = $(reference).css 'color'
  strokeColor = cssColor.replace(/\)/,',0.66)').replace(/rgb/,'rgba')
  hrefValue = $(reference).attr("href")
  klass = hrefValue.substring(1,hrefValue.length)
  
  if $(reference).hasClass 'inactive-link'
    $(reference).removeClass 'inactive-link'
    d3.selectAll("." + klass).style({'stroke': strokeColor, 'stroke-width': 2})
  else
    $(reference).addClass 'inactive-link'
    d3.selectAll("." + klass).style({'stroke': 'rgba(80,80,80,0.66)', 'stroke-width': 2})
  return
  


# all for graph bulding
buildGraph = (graph) ->
  svg = d3.select("#content").append("svg").attr("id", "arc").attr("width", width).attr("height", height)
  plot = svg.append("g").attr("id", "plot").attr("transform", "translate(" + pad + ", " + pad*25 + ")")
  
  linearLayout graph.nodes
