var COMMENTS_MAX_CHARS = 2000;
    
function insertSmile(p_smile) {
    areaFocused();
    
    var el = document.getElementById("POST_TEXT");
    el.value = el.value + p_smile + ' ';
    
    changeCharsLeft();    

    return true;
}

function changeCharsLeft() {
    var el = document.getElementById("POST_TEXT");
//    var inp = document.getElementById("CHARS_LEFT");

    var len = el.value.length;
    if (len > COMMENTS_MAX_CHARS) {
        el.value = el.value.substr(0, COMMENTS_MAX_CHARS);
//        inp.value = 0;
    } 
//    else {
//        inp.value = COMMENTS_MAX_CHARS - len;
//    }    

    return true;
}

function areaFocused() {
    var el = document.getElementById("POST_TEXT");

    if ((el.value == 'Teksts') && (el.className == 'area')) {
        el.value = '';
        el.className = 'area_black';
    }

    return true;
}