  // Original JavaScript code by Duncan Crombie: dcrombie at chirp.com.au
  // Please acknowledge use of this code by including this header.

function getCookie(name) // use: getCookie("name");
{
    return readFromConglomerateCookie("jira.dashboard.conglomerate.cookie", name, "1");
}

var today = new Date();
var expiry = new Date(today.getTime() + 28 * 24 * 60 * 60 * 1000); // plus 28 days

function setCookie(name, value) // use: setCookie("name", value);
{
    if(value == "show")
    {
        eraseFromConglomerateCookie("jira.dashboard.conglomerate.cookie", name);
    }
    else if(value == "hide")
    {
        saveToConglomerateCookie("jira.dashboard.conglomerate.cookie", name, "0");
    }
}


function toggle(id, showString, hideString) {
    var element = document.getElementById(id);
    with (element.style) {
        if ( display == "none" ){
            display = "";
            setCookie(id, "show");
        } else{
            display = "none";
            setCookie(id, "hide");
        }
    }
    var text = document.getElementById(id + "-switch").firstChild;
    if (element.style.display == "") {
        text.nodeValue = hideString;
    } else {
        text.nodeValue = showString;
    }
}

function cookieHide(id, showString)
{
    if (getCookie(id) == "0")
    {
         var element = document.getElementById(id);
         element.style.display = "none";
         var text = document.getElementById(id + "-switch").firstChild;
         text.nodeValue = showString;
    }
}