function UIHelper_applyVisibilityToItems(ctlIDs, Visible, separator) {
    var itemList = ctlIDs;
    arrItems = itemList.split(separator);
    for (i = 0; i < arrItems.length; i++) {
        UIHelper_applyVisibility(arrItems[i], Visible);
    }
}

function UIHelper_applyVisibility(whichItem, bVisible) {
    var control = document.getElementById(whichItem);
    if (control != null) {
        if (bVisible == 'true' || bVisible == true || bVisible == 1 || bVisible == '1' || bVisible == 'True') {
            control.style.display = 'block';
        }
        else {
            control.style.display = 'none';
        }
    }
}

function UIHelper_applyDisabilityToItems(ctlIDs, Disable, separator) {
    var itemList = ctlIDs;
    arrItems = itemList.split(separator);
    for (i = 0; i < arrItems.length; i++) {
        UIHelper_applyDisability(arrItems[i], Disable);
    }
}

function UIHelper_applyDisability(whichItem, bDisable) {
    var control = document.getElementById(whichItem);
    if (control != null) {
        if (bDisable == 'true' || bDisable == true || bDisable == 1 || bDisable == '1' || bDisable == 'True') {
            control.disabled = true;
        }
        else {
            control.disabled = false;
        }
    }
}

function UIHelper_applyValueToItems(ctlIDs, Values, separator) {
    var itemList = ctlIDs;
    var valueList = Values;
    arrItems = itemList.split(separator);
    arrValues = valueList.split(separator);
    if (arrItems.length == arrValues.length) {
        for (i = 0; i < arrItems.length; i++) {
            UIHelper_applyValue(arrItems[i], arrValues[i]);
        }
    }
}

function UIHelper_applyValue(whichItem, bValue) {
    var control = document.getElementById(whichItem);
    if (control != null) {
        control.value = bValue;
    }
}

function UIHelper_applyCheckedValue(whichItem, bValue) {
    var control = document.getElementById(whichItem);
    if (control != null) {
        control.checked = bValue;
    }
}

function UIHelper_constructClientCtrlID(parentCtrlID, curCtrlID) {
    var res = parentCtrlID + '_' + curCtrlID;
    return res;
}

function UIHelper_setUniqueRadioButton(nameregex, current) {
    re = new RegExp(nameregex);
    for (i = 0; i < document.frmEnrollmentDetail.elements.length; i++) {
        elm = document.frmEnrollmentDetail.elements[i]
        if (elm.type == 'radio') {
            if (re.test(elm.name)) {
                elm.checked = false;
            }
        }
    }
    current.checked = true;
}

function popup(url, title) {
    cuteLittleWindow = window.open(url, title, "location=no,width=320,height=200");
}
