
overviewText = "<  Hide Abstracts";
fullAbstractsText = ">  Show Abstracts";
metaLang = document.getElementById("lang");
if (metaLang.content == "de") {
        overviewText = "<  Beschreibungen verstecken";
        fullAbstractsText = ">  Beschreibungen anzeigen";
}

tooltip = null;
pseudolink = null;
showAll = true;

function showTooltip(id) {
        if (!showAll) {
                pseudolink = document.getElementById(id);
                tooltip = document.getElementById(id+"_tooltip");
                pseudolink.style.backgroundColor = "#007FFF";
                pseudolink.style.color = "#FFFFFF";
                tooltip.style.marginLeft = "-2em";
                tooltip.style.display = "block";
        }
}

function hideTooltip() {
        if (!showAll) {
                pseudolink.style.backgroundColor = "#FFFFFF";
                pseudolink.style.color = "#007FFF";
                tooltip.style.display = "none";
                tooltip.style.marginLeft = "0em";
        }
}

function compatibleGetElements(elementName, tagName) {
        /* list = document.getElementsByName(elementName);
        if (list.length != 0) return list; */
        list = []
        tl = document.getElementsByTagName(tagName);
        l = tl.length;
        for (i = 0; i < l; i++) {
            if (tl[i].className == elementName) list.push(tl[i]);
        }
        return list;
}

function toggleShowAll() {
        if (showAll) {
                tp = compatibleGetElements("tooltip", "div");
                l = tp.length;
                for (i = 0; i < l; i++) {
                        tp[i].style.position = "absolute";
                        tp[i].style.display = "none";
                }

                pl = compatibleGetElements("pseudolink", "span");
                l = pl.length;
                for (i = 0; i < l; i++) {
                        pl[i].style.backgroundColor = "#FFFFFF";
                        pl[i].style.color = "#007FFF";
                }

                toggleButton = document.getElementById("toggleshowall");
                toggleButton.value = fullAbstractsText;
                showAll = false;

        } else {
                showAll = true;
                tp = compatibleGetElements("tooltip", "div");
                l = tp.length;
                for (i = 0; i < l; i++) {
                        tp[i].style.position = "static";
                        tp[i].style.display = "block";
                }

                pl = compatibleGetElements("pseudolink", "span");
                l = pl.length;
                for (i = 0; i < l; i++) {
                        pl[i].style.backgroundColor = "#FFFFFF";
                        pl[i].style.color = "#BFBFBF";
                }

                toggleButton = document.getElementById("toggleshowall");
                toggleButton.value = overviewText;
        }
}


function checkFirstTime() {
        tb = document.getElementById("toggleshowall");
        tb.disabled=false;
        tb.style.display = "block";
        if (tb.value.charAt(tb.value.length-1) == " ") return true;
        else return false;
}

/*
function konquerorBugWorkaround() {
        tb = document.getElementById("toggleshowall");
        if (tb.value == overviewText) {
                showAll = false;
                toggleShowAll();
        }
}
*/

function konquerorBugWorkaround() {
        tb = document.getElementById("toggleshowall");
        if (tb.value == fullAbstractsText) {
                showAll = true;
                toggleShowAll();
        }
}

function doCollapse() {
        if (checkFirstTime()) toggleShowAll();
        else konquerorBugWorkaround();
}

