function toggle_visibility(id) {
    lmnt = document.getElementById(id);

    if(lmnt.style.visibility == "hidden"){
        lmnt.style.visibility = "visible";
        lmnt.style.display = "inline-block";
        lmnt.style.opacity = 0.1;
        appear_int = window.setInterval("appear(lmnt);", 10);
    } else if (lmnt.style.visibility == "visible"){
        //lmnt.style.opacity = 1.0;
        appear_int = window.setInterval("disappear(lmnt);", 10);
    }
}

function appear(lmnt) {
    if(lmnt.style.opacity >= 1){
        clearInterval(appear_int);
        //alert(lmnt.offsetHeight);
    } else {
        lmnt.style.opacity *= 1.2;
    }
}

function disappear(lmnt) {
    if(lmnt.style.opacity <= 0.1){
        clearInterval(appear_int);
        lmnt.style.visibility = "hidden";
        lmnt.style.display = "none";
        //alert(lmnt.offsetHeight);
    } else {
        lmnt.style.opacity -= 0.1;
    }
}


function set_text(id, lmnt) {
    target = document.getElementById(id);
    target.innerHTML = lmnt.innerHTML;
}

function set_bg(id, color) {
    lmnt = document.getElementById(id);
    lmnt.style.backgroundColor = color;
}

function hide(id) {
    lmnt = document.getElementById(id);
    lmnt.style.visibility = "hidden";
}