// Returns selected (hightlighted) text any where on the document
function getSelectedText(){
  if (document.getSelection) {
    var txt = document.getSelection();
  } else if (document.selection && document.selection.createRange) {
    var range = document.selection.createRange();
    var txt = range.text;
  } else {
    alert("Sorry, your browser does not support copying selected text");
    txt = "";
  }
  return txt;
}