onMouseDown = function(evt) {
    var $this = $(this),
        data = $this.data(pluginName);

    // Do not start selection if it's not done with the left button.
    if (evt.which != 1) {
      return;
    }

    // Prevent selection from starting on any element matched by
    // or contained within the selector specified by the 'cancel'
    // option.
    var selector =
        [data.options.cancel, data.options.cancel + ' *'].join(',');
    if (!!data.options.cancel &&
        $(evt.target).is(selector)) {
      return;
    }

    // Prevent selection if the mouse is being pressed down on a scrollbar
    // (which is still technically part of the selectable element).
    if (evt.pageX > $this.offset().left + this.clientWidth ||
        evt.pageY > $this.offset().top + this.clientHeight) {
      return;
    }

    // Record the initial position of the container, with respect to the
    // document. Also include the current border size (assuming equal
    // top/bottom and right/left border sizes).
    data.containerDimensions = {
      'top': $this.offset().top +
             ($this.outerHeight(false) - $this.innerHeight())/2,
      'left': $this.offset().left +
              ($this.outerWidth(false) - $this.innerWidth())/2,
      'width': this.clientWidth,
      'height': this.clientHeight
    };

    // Record the initial position of the mouse event, with respect to the
    // document (_not_ including the scrolling position of the selection
    // container).
    data.startPosition = {'pageX': evt.pageX, 'pageY': evt.pageY};
    data.curPosition = {'pageX': evt.pageX, 'pageY': evt.pageY};

    // Init the scroller
    data.scroller = (data.options.scroller || documentScroller).
        call(this, this);

    // Start listening for mouseup (to terminate selection), movement and
    // wheel scrolling. Mouseups and movement can occur everywhere in the
    // document, if the user moves the mouse outside the selection container.
    data.mouseupHandler = $.proxy(onMouseUp, this);
    $(document).bind('mouseup.' + pluginName, data.mouseupHandler);
    $(document).bind('mousemove.' + pluginName, $.proxy(tick, this));

    // Disable mousewheel scrolling during box selections.
    $this.bind('mousewheel.' + pluginName, function(evt) {
      evt.preventDefault(); return false;
    });

    // Prevent the default browser dragging to occur.
    evt.preventDefault();
  }
Reacts to the user pressing the mouse down inside the selectable container
viewport, possibly initiating a selection gesture.