var text = "";
AddTxt = "";

function AddText(NewCode,theform) {
	if (theform.comment_message.createTextRange && theform.comment_message.caretPos) {
		var caretPos = theform.comment_message.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? NewCode + ' ' : NewCode;
	} else {
		theform.comment_message.value+=NewCode
	}
	setfocus(theform);
	AddTxt = "";
}

function setfocus(theform) {
theform.comment_message.focus();
}

function standard(thecode) {
	AddSmile = " "+thecode+" ";
	theform = alp;
	AddText(AddSmile,theform);
}

function smilie(thesmilie) {
	AddSmile = " "+thesmilie+" ";
	theform = alp;
	AddText(AddSmile,theform);
}


