﻿// JScript File

function toggleDisplay(id) {
  document.getElementById(id).style.visibility = "visible";
  
  if(document.getElementById(id).style.display == "none" ) {
    document.getElementById(id).style.display = "";
  }
  else {
    document.getElementById(id).style.display = "none";
  }
}

function toggleBoxStatus(id, classNameExpand, classNameCollapse) {

    eraseCookie('BoxStatus_'+id);

    if (document.getElementById(id + '_content').style.display == "none" ) {
        setBoxStatus(id, 1, classNameCollapse);
        createCookie('BoxStatus_'+id,1,7);   
    } else {
        setBoxStatus(id, 0, classNameExpand);
        createCookie('BoxStatus_'+id,0,7);
    }
}

function setBoxStatus(id, status, className)
{
    document.getElementById(id + '_content').style.visibility = "visible";
    
    if (status==1)
        document.getElementById(id + '_content').style.display = "";
    else
        document.getElementById(id + '_content').style.display = "none";
        
    document.getElementById(id + '_header').setAttribute("class", className);
    document.getElementById(id + '_header').className=className;
}

function initBoxStatus(id, classNameExpand, classNameCollapse)
{
    
    var s;
    s = readCookie('BoxStatus_'+id);
    
    if (s!=null) {
        if (s=='1')
            setBoxStatus(id, 1, classNameCollapse);
        else
            setBoxStatus(id, 0, classNameExpand);
    }
}
