function check_all(frm, chAll)
{
    comfList = document.forms[frm].elements['years[]'];

    checkAll = (chAll.checked)?true:false; // what to do? Check all or uncheck all.

    // Is it an array
    if (comfList.length) {
        if (checkAll) {
            for (i = 0; i < comfList.length; i++) {
                comfList[i].checked = true;
            }
        }
        else {
            for (i = 0; i < comfList.length; i++) {
                comfList[i].checked = false;
            }
        }
    }
    else {
        /* This will take care of the situation when your 
checkbox/dropdown list (checkList[] element here) is dependent on
            a condition and only a single check box came in a list.
        */
        if (checkAll) {
            comfList.checked = true;
        }
        else {
            comfList.checked = false;
        }
    }
    return;
}

