       @unsetDragView e if @dragView
       @propagateEvent (KDEventType: 'ReceivedMouseUpElsewhere'), e
     , yes
-    
+
     document.body.addEventListener 'mousemove', (e)=>
       @redirectMouseMoveEvent e
     , yes
-    
 
-    window.onbeforeunload = (event) =>
-      # event.preventDefault();
-      # event.stopImmediatePropagation();
-      # event.stopPropagation();
+    unless window.location.hostname is 'localhost'
+      window.onbeforeunload = (event) =>
+        # event.preventDefault();
+        # event.stopImmediatePropagation();
+        # event.stopPropagation();
 
-      event or= window.event
-      msg = "Please make sure that you saved all your work."
-      
-      event.returnValue = msg if event # For IE and Firefox prior to version 4
+        event or= window.event
+        msg = "Please make sure that you saved all your work."
 
-      return msg unless window.location.hostname isnt 'localhost'
+        event.returnValue = msg if event # For IE and Firefox prior to version 4
+
+        return msg
 
   setDragInAction:(action = no)->
     $('body')[if action then "addClass" else "removeClass"]("dragInAction")
     @dragInAction = action
-  
+
   setMainView:(view)->
     @mainView = view
-  
+
   getMainView:(view)->
     @mainView
 

    @bindEvents()
    @setWindowProperties()
    super
  
  addLayer: (layer)->

    unless layer in @layers
      @layers.push layer
  
  removeLayer: (layer)->

    if layer in @layers
      index = @layers.indexOf(layer)
      @layers.splice index, 1
  
  bindEvents:()->

    $(window).bind "keydown keyup keypress",@key

      @setKeyView @oldKeyView

  setKeyView:(newKeyView)->

    return if newKeyView is @keyView

    newKeyViewAcceptsKeyStatus = ()->
