function toggleTextDecoration(obj) {
    if (obj.style.textDecoration == 'underline') {
        obj.style.textDecoration = 'none';
    } else {
        obj.style.textDecoration = 'underline';
    }
}
function findPos(obj) {
    var curleft = curtop = 0;
    if (obj.offsetParent) {
        curleft = obj.offsetLeft
        curtop = obj.offsetTop
        while (obj = obj.offsetParent) {
            curleft += obj.offsetLeft
            curtop += obj.offsetTop
        }
    }
    return [curleft,curtop];
}

function positionEditButtons() {
    var editButtons = document.getElementsByClassName("editbutton");
    if (editButtons != null) {
        for (i = 0; i < editButtons.length; ++i) {
            var pos = findPos(editButtons[i].nextSibling)
            editButtons[i].style.left = pos[0] + "px";
            editButtons[i].style.top = pos[1] + "px";
        }
    }
}

document.getElementsByClassName = function(class_name) {
    var all_obj, ret_obj = new Array(), j = 0, teststr, i;
    if (document.all) {
        all_obj = document.all;
    } else if (document.getElementsByTagName && !document.all) {
        all_obj = document.getElementsByTagName("*");
    }
    for (i = 0; i < all_obj.length; i++) {
        if (all_obj[i].className.indexOf(class_name) != -1) {
            teststr = "," + all_obj[i].className.split(" ").join(",") + ",";
            if (teststr.indexOf("," + class_name + ",") != -1) {
                ret_obj[j] = all_obj[i];
                j++;
            }
        }
    }
    return ret_obj;
}