bound on methods to document

The on method was bound to the initSelector. This works fine when the script files are in the bottom of the body, but not when they're included in the head. (since $(initSelector) does not return any elements). This works ok for live(), but not for on(). Binding on to document, solves the problem.

also, minor bug when dragging with the mouse: this fires dragend event without sending a data-argument. Added a check for that.