function triggerLos(losId) {
    var form = $('test');
    var los = form['los_'+losId];
    var studySessionId = 0;

    for (i in studySessions) {
        for (j in studySessions[i]) {
            if (studySessions[i][j] == losId) {
                studySessionId = i;
                break;
            }
        }
    }

    var checked = false;
    var studySessionCheck = true;
    if ($(los).getValue() == null) { checked = true; }
    if (checked) {
        studySessionCheck = false;
    }
    else {
        for (i in studySessions) {
            if (i == studySessionId) {
                studySessions[i].each(function(item) {
                    if (item != losId) {
                        loscb = form['los_'+item];
                        if ($(loscb).getValue() == null) {
                            studySessionCheck = false;
                        }
                    }
                });
            }
        }
    }
    
    var ss = form['studySession_'+studySessionId];
    if (studySessionCheck) {
        $(ss).checked = true;
    }
    else {
        $(ss).checked = false;
    }
}

function triggerStudySession(studySessionId) {
    var form = $('test');
    var ss = form['studySession_'+studySessionId];
    var field = 'los_ss_'+studySessionId;

    var checked = false;
    if ($(ss).getValue() == 1) { checked = true; }
    if (checked) {
        for (i in studySessions) {
            if (i == studySessionId) {
                studySessions[i].each(function(item) {
                    loscb = form['los_'+item];
                    $(loscb).checked = true;
                });
            }
        }
    }
    else {
        for (i in studySessions) {
            if (i == studySessionId) {
                studySessions[i].each(function(item) {
                    loscb = form['los_'+item];
                    $(loscb).checked = false;
                });
            }
        }
    }
    if ($(field).visible()) {
        if (!checked) {
            //Effect.SlideUp(field);
        }
    }
    else {
        if (checked) {
            //Effect.SlideDown(field);
        }
    }
}
