function CheckAll(me)
{
    var index = me.name.lastIndexOf('_');
    var prefix = me.name.substr(0,index); 
    for(i=0; i<document.forms[0].length; i++) 
    { 
        var o = document.forms[0][i]; 
        if (o.type == 'checkbox') 
        { 
            if (me.name != o.id) 
            {
                //debugger;             
                if (o.id.substring(0, prefix.length) == prefix) 
                {
                    // Must be this way
                    o.checked = !me.checked; 
                    o.click(); 
                }
            }
        } 
    } 
}
function ApplyStyle(me, selectedForeColor, selectedBackColor, foreColor, backColor, bold, checkBoxHeaderId) 
{ 
    var td = me.parentNode; 
    if (td == null) 
        return; 
        
    var tr = td.parentNode;
    if (me.checked)
    { 
       /*tr.style.fontWeight = 700;*/ // bold
       tr.style.color = selectedForeColor; 
       tr.style.backgroundColor = selectedBackColor; 
    } 
    else 
    { 
       if(!(document.getElementById(checkBoxHeaderId) == null)) {
         document.getElementById(checkBoxHeaderId).checked = false;
       }
       tr.style.fontWeight = bold; 
       tr.style.color = foreColor; 
       tr.style.backgroundColor = backColor; 
    } 
}
function DeselectAllButMe(me)
{
    var index = me.id.indexOf(getHotGridViewId()+'_ctl');   
    var prefix = me.id.substr(0,index);    
    for(i=0; i<document.forms[0].length; i++) 
    { 
        var o = document.forms[0][i]; 
        if (o.type == 'checkbox') 
        { 
            if(o.id.indexOf('HeaderButton')<0) {
                if (me.id != o.id) 
                {
                    if (o.id.substring(0, prefix.length) == prefix) 
                    {
                        // Must be this way
                        o.checked = false; 
                        ApplyStyle(o, '', 'White', '', '', '400', '');
                        //o.click(); 
                    }
                }
            }
        } 
    } 
}

function selectDependant(idChk,idDependantChk)
{
    chk = document.getElementById(idChk.id);
    dependantChk = document.getElementById(idDependantChk.id);
    if(chk.checked) {
        if(!dependantChk.checked) {
            dependantChk.checked = true;
        }
    }
    if(!chk.checked) {
        if(dependantChk.checked) {
            dependantChk.checked = false;
        }
    }
}

function selectDependantIfChecked(idChk,idDependantChk)
{
    chk = document.getElementById(idChk.id);
    dependantChk = document.getElementById(idDependantChk.id);
    if(chk.checked) {
        if(!dependantChk.checked) {
            dependantChk.checked = true;
        }
    }
}