var startHide;

startHide = function() {
    // hide the extend content
    document.getElementById("extend").className = "hidden";
    // show + sign
    document.getElementById("switch").className = "collapsed";
    
    // get the text of the headline
    var linkText = document.getElementById("switch").firstChild.nodeValue;
    // delete the current text
    document.getElementById("switch").removeChild(document.getElementById("switch").firstChild);
    // create a new a element
    //var newA = document.createElement("a");
    // create text for the new a element
    newA.appendChild(document.createTextNode(linkText));
    // append a href to the a element
    //newA.href = "javascript:extend()";
    // append the new a element
    document.getElementById("switch").appendChild(newA);
}

//window.onload = startHide;

function extend() {
    // get the current className
    var newClassName = document.getElementById("extend").className;
    var linkClassName = document.getElementById("switch").className;
    
    // switch the className and link text
    if (newClassName == "hidden") {
        newClassName = "visible";
        linkClassName = "extended";
    }
    else {
        newClassName = "hidden";
        linkClassName = "collapsed";
    }
    
    document.getElementById("extend").className = newClassName;
    
    // change the class of the link
    document.getElementById("switch").className = linkClassName;
}

