function add_emotion(event) { 
    comment = document.getElementById('comment');
    /*@cc_on
    @set @ie = true
    @if (@ie)
    comment.focus(); 
    document.selection.createRange().text = " " + this.alt + " "; 
    @else @*/
    if (comment.selectionStart || comment.selectionStart == '0') {
        var startPos = comment.selectionStart;
        var endPos = comment.selectionEnd;
        comment.value = comment.value.substring(0, startPos)
        + " " + this.alt + " " 
        + comment.value.substring(endPos, comment.value.length);
    }
    else {
        comment.value += " " + this.alt + " ";
    }
    /*@end @*/
}
function load_emotion() {
    var emotion = document.getElementById('emotion');
    if (emotion) {
        var emotions = emotion.getElementsByTagName('img');
        for (i = 0; i < emotions.length; i++) {
            emotions[i].onclick = add_emotion;
        }
    }
}
addEvent(window, 'load', load_emotion);