/*
if (this.readOnly && this.style.backgroundColor.toUpperCase() != escurecerCor(corSelecionada)) {
    this.style.backgroundColor = corDesabilitada;
}
*/

/**
 * Tratamento do evento OnBlur.
 */
function CGRID_BLR(ctrl) {
    if (ctrl.readOnly != true) {
        mudarCorLinha(ctrl, "blur");
        //setLarguraBorda(ctrl, "0px")
    }
}

/**
 * Tratamento do evento OnFocus.
 */
function CGRID_FCS(ctrl) {
    if (ctrl.readOnly != true) {
        mudarCorLinha(ctrl, "focus");
        //setLarguraBorda(ctrl, "2px")			
    }
}
	
/**
 * Tratamento do evento OnChange.
 */
function CGRID_CHG(ctrl) {
    grid = getGrid(ctrl);
    index = getFieldIndex(ctrl.id);
    changeActionGrid(grid, index, "U");
}
	
/**
 * Tratamento do evento OnKeyDown.
 */
function CGRID_KDN(ctrl, event){
    if (ctrl.nodeName == "SELECT"){
        return;
    }
    tecla = C_TeclaDigitada(event);
    if (tecla == 38) {
        inc = -1
    } else if (tecla == 40) {
        inc = 1
    }
    if (tecla == 40 || tecla == 38) {
        index = new Number(getFieldIndex(ctrl.id)) + inc;
        if (index >= 0) {
            nome = getFieldName(ctrl.id)
            internalColName = getInternalColName(ctrl, nome);
            idProx = getColumnId(ctrl, internalColName, index);
            objProximo = document.getElementById(idProx);
            while (objProximo != null) {
                if (objProximo.readOnly != true) {
                    objProximo.focus();
                    return;
                }
                index = index + inc;
                idProx = getColumnId(ctrl, internalColName, index);
                objProximo = document.getElementById(idProx);
            }
        }
    }
}