function changeCheckBox(parent, checkBox, grandParent)
{
    var parentChecked   = $(parent);
    var currentDiv = $(checkBox);
    var siblingDivs = 0;
    var newArrayCollection;

    if(parentChecked.checked){
        while(currentDiv = currentDiv.nextSibling) {
            if(currentDiv.nodeName == "DIV"){
                newArrayCollection = currentDiv.getElementsByTagName("input");
                newArrayCollection[0].disabled = false;
            }
            siblingDivs++;
        }
    } else if( !parentChecked.checked ) {
        newElement = $(grandParent);

        newArrayCollection = newElement.getElementsByTagName("input");
        if(newArrayCollection.length > 1){
            if(!deletePermissions()) {
                parentChecked.checked = true;
                return false;
            }
        }

        for(var i=1; i < newArrayCollection.length; i++) {
            newArrayCollection[i].disabled = true;
            newArrayCollection[i].checked  = false;
        }
    }
}
