/**

 * Toggle the state of an object

 *

 * @param string id The ID of the object to toggle

 */

function toggleCollapseState(id)

{

    var obj = getObj(id);



    if(!obj)

        return false;



    if(obj.style.display == 'none')

    {

        var state = 1;

        obj.style.display = '';

    }



    else

    {

        var state = 0;

        obj.style.display = 'none';

    }



 //   saveCollapseState(id, state);



    return true;

}











/**

 * Modify the document cookie to remember the state of an object

 *

 * @param string id The ID of the object

 * @param integer state The state of the object

 */

function saveCollapseState(id, state)

{

    var cookie = readCookie('collapseState');



    if(!cookie)

        cookie = '';



    var search = new RegExp('(' + id + ')=([01]{1}),');



    if(search.test(cookie))

        cookie = cookie.replace(search, '$1$2=' + state + ',');

    else

        cookie += id + '=' + state + ',';

setCookie('collapseState', cookie, new Date('January 1, 2020'));
//This is the old setting

 //   setCookie('collapseState', cookie,0);

}