function isCheckboxSelected(oForm, iElementIdx, iTotalBox, sElementName, sMessage) {

//------------------------------------------------------------------
// isCheckboxSelected
//
// Determine if a checkbox option has been selected or not.
// iElementIdx is the start element; iTotalBox is the total
// number of checkboxes in the form.
//------------------------------------------------------------------

    var bChecked = false;
    var iEndElementIdx = iElementIdx + iTotalBox;

    if (oForm.elements[iElementIdx].type != "hidden") {
        // quit checking if the element is a hidden field, not a checkbox

        for (var i=iElementIdx; i<iEndElementIdx; i++) {
            // loop thru all checkboxes to see if any of them is checked 
            if (oForm.elements[i].checked) {
                bChecked = true; 
            }
        }

        if (!bChecked) {
            if (sMessage == "") {
                alert("Please select a " + sElementName + ".");
            } else {
                alert(sMessage);
            }
                        
            return false;
        }
    }
        	    
    return true;
}