Get text selection

Support: IE6, Fx2, Opera9, Safari Cross browser getSelection().


function getSelection() {
	return (!!document.getSelection) ? document.getSelection() :
	       (!!window.getSelection)   ? window.getSelection() :
	       document.selection.createRange().text;
}