//=======================
function storeCaret(textEl) {
	if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}

//=======================
function miniforum_is (smile, form_name, element_name) 
 {
 //функция вставляет смайлик к курсору в указанный элемент формы.
 var txtarea = document.forms[form_name].elements[element_name];
 smile = ' ' + smile + ' ';
 
 if (txtarea.createTextRange && txtarea.caretPos) 
  {
   var caretPos = txtarea.caretPos;
   caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + smile + ' ' : caretPos.text + smile;
   txtarea.focus();
  } 
   else 
  {
   txtarea.value  += smile;
   txtarea.focus();
  }
 
}
//=======================

