function insert_smile ( tag, forum_comment_area_id, new_window ) {
	if ( forum_comment_area_id != '' ) {
		if ( new_window ) {
			var doc = window.opener.document;
		} else {
			var doc = document;
		}

		tag = ' ' + tag + ' ';

		var comment_area = doc.getElementById( forum_comment_area_id );
		if ( comment_area != null ) {

			if ( comment_area.createTextRange && comment_area.caretPos ) {
				var text_pos = comment_area.caretPos;
				text_pos.text = text_pos.text.charAt(text_pos.text.length - 1) == ' ' ? text_pos.text + tag + ' ' : text_pos.text + tag;
				comment_area.focus();
			} else {
				comment_area.value  += tag;
				comment_area.focus();
			}

		} else {
			alert( 'NINCS comment_area!!!!' );
		}
	}
}

// Insert at Claret position. Code from
// http://www.faqts.com/knowledge_base/view.phtml/aid/1052/fid/130
function storeCaret(textEl) {
	if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}