           showFrame.contentWindow.position top, left
       return # don't return anything unless you have a callback on the other site of easyXdm
 
+showUrl = (url, successFn) ->
+  successCalled = 0
+  onLoadSuccess = ->
+    unless successCalled
+      successCalled++
+      successFn()  if $.isFunction(successFn)
+
+  showFrame.onload = onLoadSuccess
+  # Somehow only lower case letters seem to work for those events --mark
+  $(document).bind "modalready", onLoadSuccess
+  loadUrl url
+  showFrame.className = "overlay"
+
 loadUrl = (url)->
   history = showFrame.contentWindow.Backbone?.history
   if history?

  else
    showFrame.src = url

loadUrl '/facts/new'

$("iframe").preventScrollPropagation()


  local:
    showFactlink: (id, successFn) ->
      url = "/facts/" + id
      showUrl url, successFn
      return # don't return anything unless you have a callback on the other site of easyXdm

    prepareNewFactlink: (text, siteUrl, siteTitle, guided, successFn, errorFn) ->
      url = "/facts/new" +
              "?fact=" + encodeURIComponent(text) +
              "&url=" + encodeURIComponent(siteUrl) +
              "&title=" + encodeURIComponent(siteTitle) +
              "&guided=" + encodeURIComponent(guided)
      showUrl url, successFn

      onFactlinkCreated = (e, id) ->
        remote.highlightNewFactlink text, id

