 window.simulation = false
 moving_sim = false
-
-simulatorEscapeHTML = (string) ->
-  string.replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/'/g, '&#39;').replace(/</g, '&lt;').replace(/>/g, '&gt;')
 
 window.updateSimulator = (data) ->
 

    msg = data.messages[i]
    direction = (if (msg.direction is "O") then "from" else "to")
    model = (if (msg.model is "msg") then "imsg" else "ilog")
    $(".simulator-body").append "<div class=\"" + model + " " + direction + "\">" + simulatorEscapeHTML(msg.text) + "</div>"
    i++
  $(".simulator-body").scrollTop $(".simulator-body")[0].scrollHeight
  $("#simulator textarea").val ""


    # add the progress gif
    if newMessage and newMessage.length <= 160
      $(".simulator-body").append "<div class=\"imsg to post-message\"></div>"
      $(".simultor-body .imsg.to.post-message:last").text(newMessage).html()
      $("#simulator textarea").val ""
      $(".simulator-loading").css "display", "block"
      # $(".simulator-body").css "height", $(".simulator-body").height() - 25
