 			@buttonDown = false 
 			$(@target).css("cursor", "auto")
 
+		lockMouse : =>
+			@lock = true
+
+		unlockMouse : =>
+			@lock = false
+
 		attachEventHandler : (type, func) ->
 			if @target.addEventListener
 				@target.addEventListener type, func, false

			
			{ lastPosition, changedCallback } = @

			if @buttonDown
				distX = -(evt.pageX - lastPosition.x)
				distY =   evt.pageY - lastPosition.y
				changedCallback.x distX/SLOWDOWN_FACTOR if distX isnt 0
				changedCallback.y distY/SLOWDOWN_FACTOR if distY isnt 0

			@lastPosition =
				x : evt.pageX
				y : evt.pageY		

		mouseDown : =>
			$(@target).css("cursor", "none")

		SLOWDOWN_FACTOR = 250		

		buttonDown : false
		
		# used for mopuse locking in fullscreen mode
		locked : false

		lastPosition : 
			x : null
