// insert tag
function paste(text, elem) {
  left=text.substr(0,text.indexOf('|'));
  right=text.substr(text.indexOf('|')+1,text.length-1);
  if((document.selection)) {
      document.msg[elem].focus();
      src=document.msg.document.selection.createRange().text;
      document.msg.document.selection.createRange().text=left+src+right;
      }
  else document.msg[elem].value+=left+right; 
}

// open new window with image
function WinOpen(file, width, height)
{ //width+=4;height+=4;
  var w=window.open('', '_blank', "width="+width+",height="+height+",titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes");
  with (w.document)
  { open ();
    write ('<body style = "background-color:#809E62; margin: 0" scroll = "no" onclick = "self.close ()">');
    write ('<img align=center valign=middle src=' +file+ '></body>');
    close ();
  }
  return false;
}

// confim deletion
function del(msg) {
 if (confirm(msg))
  return true;
 else
  return false;
}