function CheckBoxValidatorEvaluateIsValid(val)
{
    var control = document.getElementById(val.controltovalidate);
    var mustBeChecked = Boolean(val.mustBeChecked);

    return control.checked == mustBeChecked;
}

function CheckBoxListValidatorEvaluateIsValid(val)
{
    var control = document.getElementById(val.controltovalidate);
    var minimumNumberOfSelectedCheckBoxes = parseInt(val.minimumNumberOfSelectedCheckBoxes);
    var maximumNumberOfSelectedCheckBoxes = parseInt(val.maximumNumberOfSelectedCheckBoxes);

    var selectedItemCount = 0;
    var liIndex = 0;
    var currentListItem = document.getElementById(control.id + '_' + liIndex.toString());
    while (currentListItem != null)
    {
        if (currentListItem.checked) selectedItemCount++;
        liIndex++;
        currentListItem = document.getElementById(control.id + '_' + liIndex.toString());
    }
    
    return (selectedItemCount >= minimumNumberOfSelectedCheckBoxes) && (maxnimumNumberOfSelectedCheckBoxes < 0 || selectedItemCount <= maxnimumNumberOfSelectedCheckBoxes);
}

function mitRegExValidatorEvaluateIsValid(val) {
    var value = ValidatorGetValue(val.controltovalidate);
    if ((ValidatorTrim(value).length == 0) &&
            ((typeof(val.validateemptytext) != "string") || (val.validateemptytext != "true"))) {
            return true;
    }
    if ((typeof(val.validationmodifiers) != "string") || (ValidatorTrim(val.validationmodifiers).length == 0)) { 
        var rx = new RegExp(val.validationexpression);
        var matches = rx.exec(value);
        return (matches != null && value == matches[0]);
    }
    else
    {
        var rx = new RegExp(val.validationexpression, val.validationmodifiers);
        var matches = rx.exec(value);
        return (matches != null && value == matches[0]);
    }
}