function tag (obj, pre, after)
{
if (document.selection){
	obj.focus();
   with (document.selection.createRange ()) {text = pre + text + after}}
else (obj.selectionStart)
   with (obj)
      {
      var t = scrollTop, l = scrollLeft, txt = obj.value,
      st = selectionStart, ln = selectionEnd; focus ();
      value = txt.substring(0, st) + pre + txt.substring (st, ln) + after + txt.substring(ln,txt.length);
      selectionStart = selectionEnd = st; scrollTop = t; scrollLeft = l;
      offset = pre.length;
      selectionStart = st + offset;
      selectionEnd = ln + offset;
      }
}
