const statuses = {ok:0, error:1, loading: 2, attention: 3, hidden: 4};

function do_set_answer(status, answer_text, element_id) {
    let ans_el = document.getElementById(element_id);
    if (!ans_el) {
        console.log('no id: ' + element_id + ';answer=' + answer_text);
        return;
    }
    ans_el.innerHTML = answer_text;
    let color = 'blue';
    if (status === statuses.ok) {
        color = 'lightgreen';
    } else if (status === statuses.error) {
        color = 'red';
    } else if (status === statuses.loading) {
        color = 'beige';
    } else if (status === statuses.attention) {
        color = '#f5c42f';
    } else if (status === statuses.hidden) {
        color = 'grey';
    }
    ans_el.style.borderLeft = '5px solid ' + color;
    let el_dup = document.getElementById(element_id + '_dup');
    if (!!el_dup) {
        el_dup.innerHTML = answer_text;
      //  el_dup.style.borderLeft = '5px solid ' + color;
    }
}
