function setSelection(input, offsets) {
    var start = offsets.start;
    var end = offsets.end;

    if (end === undefined) {
      end = start;
    }

    if ('selectionStart' in input) {
      input.selectionStart = start;
      input.selectionEnd = Math.min(end, input.value.length);
    } else {
      setOffsets(input, offsets);
    }
  }
@setSelection: Sets the selection bounds of a textarea or input and focuses
the input.
-@input     Set selection bounds of this input or textarea
-@offsets   Object of same form that is returned from get*