Retrieve the caret (text cursor) position from textareas and input fields as well as the actual selection and its index boundaries. Replacing the selection string is also supported. Unfortunately special treatment for such a simple thing is needed, because MSIE doesn’t support the easy DOM 3.0 methods.