         frag = frag.substring(1)
         return null if frag == ""
         decodeURIComponent frag
+
+fetch_all_similar_crashes = (id, cb) ->
+    $.getJSON "/similarcrashes/#{id}", (result) ->
+        cb? result
 
 load_crashreport_data = (id, callback) ->
      $.getJSON "/crashreports/#{id}", (data) ->

    for name, thread of crashreport["stack-trace"]["threads"]
        render_stacktrace name, thread["pid"], null, thread["stack"]
    $('.stack_trace:first').detach()
        
    #Process state
    render_process_state crashreport


    #Analysis
    $('#app_similar_crashes_num').text "-"
    $('#all_similar_crashes_num').text "-"
    fetch_all_similar_crashes crashreport.id, (result) ->
        console.log result
        console.log result.data.length
        if result?.data
            $('#all_similar_crashes_num').text result.data.length

    # Related Bugs
    $('#related_bugs .tab1').empty()
