 
     @utils.wait 500, => @unsetClass 'animate-movement'
 
-  setTitle:(title,o={})->
-    unless o.html is no
-      @wrapper.updatePartial title
-    else
-      @wrapper.updatePartial Encoder.htmlEncode title
+
+  setTitle: (title, isHTML) ->
+
+    title = Encoder.htmlEncode title  unless isHTML
+    @wrapper.updatePartial title
+
 
   directionMap = (placement, gravity)->
     if placement in ["top", "bottom"]


    return o

  display:(o = @getOptions())->

    # converts NESW-Values to topbottomleftright and retains them in @getOptions
    @appendToDomBody()
    KD.singletons.windowController.addLayer this
    o = @translateCompassDirections o if o.gravity
    o.gravity = null

    @setClass 'in' if o.animate
    @utils.defer => @setPositions o

    @visible = yes

  getCorrectPositionCoordinates:(o={},positionValues,callback=noop)->
    # values that can/will be used in all the submethods


  hide: (event)->
    return unless @visible
    {permanent} = @getOptions()
    super
    @getDomElement().remove()
    KD.singletons.windowController.removeLayer this  unless permanent
    @visible = no

  update: (o = @getOptions(), view) ->

    unless view
      o.selector or= null
      o.title    or= ""
      @setTitle o.title, o.html
      @display()
    else
      @setView view

    @visible = yes

  addListeners:->
    {events, sticky, permanent} = @getOptions()

    _show = @bound 'show'
    _hide = @bound 'hide'

    @parentView.bindEvent name for name in events
    @parentView.on 'mouseenter', _show
    @parentView.on 'mouseleave', _hide  unless sticky

    @on 'ReceivedClickElsewhere', _hide  unless permanent

    @once 'KDObjectWillBeDestroyed', =>
      @parentView.off 'mouseenter',  _show
      @parentView.off 'mouseleave',  _hide  unless sticky

  setView: (childView) ->
    return unless childView
