﻿


function getAllChecked(containerId,excludeStr) {
    var chkID = "";

    $('#' + containerId + ' input[type="checkbox"][checked]').each(function() {
        chkID += this.id + '|';
    });

    if (chkID != '') {
        chkID = chkID.substring(0, chkID.length - 1);
    }

    while (chkID.indexOf(excludeStr) != -1) {
        chkID = chkID.replace(excludeStr, '');
    }

    return chkID;
}

function checkedInvert(chkId) {
    if ($('#' + chkId).attr('checked') == true) {
        $('#' + chkId).removeAttr('checked') ;
    }
    else {
        $('#' + chkId).attr('checked', 'true');
    }
}

function checkedAll(chkName) {
    
    $('[name="'+chkName+'"]').attr('checked', 'true'); //
}
function unCheckedAll(chkName) {
    $('[name="' + chkName + '"]').removeAttr('checked'); //
}

function chenkedAllInvert(chkName) {
    var k = true;
    $('[name="' + chkName + '"]').each(function() {
        if ($(this).attr('checked') == false) {
            k = false;
        }
    });
    if(k){
        unCheckedAll(chkName);
    }
    else{
        checkedAll(chkName);
    }
}