function DoPrompt(action)
 {
  document.form.comment.value=document.form.comment.value+action;
  document.form.comment.focus();
 }

function storeCaret (textEl)
 {
       if (textEl.createTextRange) 
         textEl.caretPos = document.selection.createRange().duplicate();
 }

function insertAtCaret (textEl, text)
 {
  if (navigator.appVersion.indexOf("MSIE")!=-1)
    {
      if (textEl.createTextRange && textEl.caretPos) {
         var caretPos = textEl.caretPos;
         caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?
             text + ' ' : text;
       }
       else
         textEl.value  = textEl.value + text;
    } else DoPrompt(text);
	document.form.comment.focus();
 }

