var uiIndexCamNumH264Vbr = 0;
var uiIndexModelH264Vbr = 1;
var uiIndexResoH264Vbr = 2;
var uiIndexQualH264Vbr = 3;
var uiIndexFpsH264Vbr = 4;
var uiIndexSceneLocationH264Vbr = 5;
var uiIndex_s_scene_gopcontrol_1_h264 = 6;
var uiIndex_s_scene_gopcontrol_2_h264 = 7;
var uiIndexSceneGopControlH264Vbr = 8;
var uiIndex_s_scene_smartfacialcoding_h264 = 9;
var uiIndex_s_scene_smartfacialcoding_h264_ai = 10;
var uiIndex_s_scene_smartcoding_viqs_h264 = 11;
var uiIndexSceneSmartFacialCodingH264Vbr = 12;
var uiIndexSceneIllumNormalH264Vbr = 13;
var uiIndexSceneIllumLowH264Vbr = 14;
var uiIndexSceneMotionNormalH264Vbr = 15;
var uiIndexSceneMotionLowH264Vbr = 16;
var uiIndexSceneIllumNormalHourH264Vbr = 17;
var uiIndexSceneMotionNormalHourH264Vbr = 18;
var uiIndexSceneIllumLowHourH264Vbr = 19;
var uiIndexSceneMotionLowHourH264Vbr = 20;
var uiIndexSceneImageNormalH264Vbr = 21;
var uiIndexSceneImageLowH264Vbr = 22;
var uiIndexAvgKbpsH264Vbr = 23;
var uiIndexMaxKbpsH264Vbr = 24;
var uiIndexCompkindH264Vbr = 25;
var uiIndexSceneSmartCodingPicSkipH264Vbr = 26;
var uiIndexSceneSmartCodingNewSH264Vbr = 27;

function uiInitloadH264Vbr() {
    uiInitH264Vbr('1', camKind_H264Vbr_EX_Next_2M_U3, null);
    uiInitH264Vbr('2', camKind_H264Vbr_EX_Next_5M_U2, null);
    uiInitH264Vbr('3', camKind_H264Vbr_EX_Next_5M_U3, null);
}

function uiInitH264VbrCompkind() {
    var idx = 0;
    var objParts = new Array();

    uiGetH264VbrObject('1', objParts);

    objParts[uiIndexCompkindH264Vbr].length = compkindInfo_H264Vbr.length - 1;
    for (var idx = 0; idx < objParts[uiIndexCompkindH264Vbr].length; idx++) {
        objParts[uiIndexCompkindH264Vbr].options[idx].value = idx;
        objParts[uiIndexCompkindH264Vbr].options[idx].text = compkindInfo_H264Vbr[idx + 1];
    }
}


 function uiUpdateVbr264(no) {
    var objParts = new Array();

    uiGetH264VbrObject(no, objParts);

    var model = objParts[uiIndexModelH264Vbr].selectedIndex;
    var fps = Number(objParts[uiIndexFpsH264Vbr].options[objParts[uiIndexFpsH264Vbr].selectedIndex].text);

    uiSetH264VbrFpsText(no, model, fps);
}


function uiInitH264Vbr(no, model, reso) {
    uiSetH264VbrModel(no, model);
    reso = uiSetH264VbrResoValue(no, model, reso);
    var qual = uiSetH264VbrQualIndex(no, null);
    var fps = uiSetH264VbrFpsIndex(no, model, null);
    var location = uiSetH264VbrLocationIndex(no, model, null);
    uiChangeH264VbrSampleImage(no);
    if (no == 1) {
        var gopcontrol = uiSetH264VbrGopControl(no, model, null);
    } else {
        var gopcontrol = uiSetH264VbrGopControl(no, model, null);
    }
    if (IsH265Exstreme(model)) {
        var smartfacialcoding = uiSetH264VbrSmartFacialCoding(no, model, null);
    } else {
        var smartfacialcoding = 0;
    }
    uiSetH264VbrSmartCodingPicSkip(no, model);
    var illumnormal = uiSetH264VbrIllumPercentage(no, null);
    uiChangeH264VbrIllumPercentage(no);
    var motionnormal = uiSetH264VbrIllumMotionNormalPercentage(no, null);
    var motionlow = uiSetH264VbrIllumMotionLowPercentage(no, null);
    uiChangeH264VbrTimeAllocation(no);
    uiChangeH264VbrBitrate(no);
}


function uiChangeH264Vbr(no, modelchange) {
    var objParts = new Array();

    uiGetH264VbrObject(no, objParts);

    var model = objParts[uiIndexModelH264Vbr].selectedIndex;
    var modelname = objParts[uiIndexModelH264Vbr].options[model].text;
    var reso = objParts[uiIndexResoH264Vbr].options[objParts[uiIndexResoH264Vbr].selectedIndex].text;
    var qual = Number(objParts[uiIndexQualH264Vbr].options[objParts[uiIndexQualH264Vbr].selectedIndex].value);
    var fps = Number(objParts[uiIndexFpsH264Vbr].options[objParts[uiIndexFpsH264Vbr].selectedIndex].text);
    var gopcontrol = Number(objParts[uiIndexSceneGopControlH264Vbr].options[objParts[uiIndexSceneGopControlH264Vbr].selectedIndex].value);
    var smartfacialcoding = 0;
    if (objParts[uiIndexSceneSmartFacialCodingH264Vbr].selectedIndex == -1) {
         smartfacialcoding = 2;
    }
     else {
         smartfacialcoding = Number(objParts[uiIndexSceneSmartFacialCodingH264Vbr].options[objParts[uiIndexSceneSmartFacialCodingH264Vbr].selectedIndex].value);
     }
    var illumnormal = Number(objParts[uiIndexSceneIllumNormalH264Vbr].value);
    var motionnormal = Number(objParts[uiIndexSceneMotionNormalH264Vbr].value);
    var motionlow = Number(objParts[uiIndexSceneMotionLowH264Vbr].value);

    if (1 == modelchange) {
        uiSetH264VbrResoText(no, model, reso);
        uiSetH264VbrQualIndex(no, qual);
        uiSetH264VbrFpsText(no, model, fps);
        uiSetH264VbrLocationIndex(no, model, null);
        uiSetH264VbrGopControl(no, model, gopcontrol);
        if (IsH265Exstreme(model)) {
            if (((modelname == 'S854**(Multi-Sensor)') || (modelname == 'S857**(4K Multi-Sensor)') || (modelname == 'X865**(Multi-Sensor)') || (modelname == 'S613**/S653**') || (modelname == 'S615**/S655**') || (modelname == 'X865**(PTZ)')  || (modelname == 'S2**6/S2**5/S1**6/S1**5') || (modelname == 'S71***') || (modelname == 'S25***/S22***/S15***') || (modelname == 'S854*(AI Multi-Sensor)') || (modelname == 'S856*/S857*(AI Multi-Sensor)')) && (smartfacialcoding > 1)) {
                smartfacialcoding = 1;
            }
            uiSetH264VbrSmartFacialCoding(no, model, smartfacialcoding);
        }
        uiSetH264VbrIllumPercentage(no, illumnormal);
        uiSetH264VbrIllumMotionNormalPercentage(no, motionnormal);
        uiSetH264VbrIllumMotionLowPercentage(no, motionlow);
    } else if (2 == modelchange) {
        uiSetH264VbrFpsText(no, model, fps);
    }

    uiChangeH264VbrSampleImage(no);
    uiChangeH264VbrIllumPercentage(no);
    uiChangeH264VbrTimeAllocation(no);
    uiChangeH264VbrBitrate(no);
    if (uiCheckH264CamUpperBitrate(no) != true) {
        uiAllResultGrayOut();
        return;
    }

    calcdata();
}


function uiSetH264VbrCompkind() {
    var objParts = new Array();

    uiGetH264VbrObject(no, objParts);

    objParts[uiIndexCompkindH264Vbr].length = compkindInfo_H264Vbr.length - 1;
    for (var idx = 0; idx < objParts[uiIndexCompkindH264Vbr].length; idx++) {
        objParts[uiIndexCompkindH264Vbr].options[idx].value = COMPKIND_H264;
        objParts[uiIndexCompkindH264Vbr].options[idx].text = compkindInfo_H264Vbr[idx + 1];
    }
}


function uiSetH264VbrModel(no, model) {
    var objParts = new Array();

    uiGetH264VbrObject(no, objParts);

    objParts[uiIndexModelH264Vbr].length = camInfo_H264Vbr.length;
    for (var idx = 0; idx < objParts[uiIndexModelH264Vbr].length; idx++) {
        objParts[uiIndexModelH264Vbr].options[idx].value = idx;
        objParts[uiIndexModelH264Vbr].options[idx].text = camInfo_H264Vbr[idx][0];
    }
    objParts[uiIndexModelH264Vbr].selectedIndex = model;
}


function uiSetH264VbrResoValue(no, model, reso) {
    var objParts = new Array();

    uiGetH264VbrObject(no, objParts);

    objParts[uiIndexResoH264Vbr].length = camInfo_H264Vbr[model][1].length - 1;
    for (var idx = 0; idx < objParts[uiIndexResoH264Vbr].length; idx++) {
        objParts[uiIndexResoH264Vbr].options[idx].value = idx;
        objParts[uiIndexResoH264Vbr].options[idx].text = resoInfo_H264Vbr[camInfo_H264Vbr[model][1][idx + 1]][resoNameH264Vbr];
    }
    if (null == reso) {
        if (model == camKind_H264Vbr_S2) {
            uiSelectListBoxText(objParts[uiIndexResoH264Vbr], resoInfo_H264Vbr[camReso_H264Vbr_HD][0], resoInfo_H264Vbr[camReso_H264Vbr_HD][0]);
        } else {
            uiSelectListBoxText(objParts[uiIndexResoH264Vbr], resoInfo_H264Vbr[camInfo_H264Vbr[model][1][0]][0], resoInfo_H264Vbr[camInfo_H264Vbr[model][1][0]][0]);
        }
    } else {
        uiSelectListBoxText(objParts[uiIndexResoH264Vbr], resoInfo_H264Vbr[reso][0], resoInfo_H264Vbr[camInfo_H264Vbr[model][1][0]][0]);
    }

    return Number(objParts[uiIndexResoH264Vbr].options[objParts[uiIndexResoH264Vbr].selectedIndex].value);
}


function uiSetH264VbrResoText(no, model, reso) {
    var objParts = new Array();

    uiGetH264VbrObject(no, objParts);

    objParts[uiIndexResoH264Vbr].length = camInfo_H264Vbr[model][1].length - 1;
    for (var idx = 0; idx < objParts[uiIndexResoH264Vbr].length; idx++) {
        objParts[uiIndexResoH264Vbr].options[idx].value = idx;
        objParts[uiIndexResoH264Vbr].options[idx].text = resoInfo_H264Vbr[camInfo_H264Vbr[model][1][idx + 1]][resoNameH264Vbr];
    }
    uiSelectListBoxText(objParts[uiIndexResoH264Vbr], reso, resoInfo_H264Vbr[camInfo_H264Vbr[model][1][0]][0]);

    return Number(objParts[uiIndexResoH264Vbr].options[objParts[uiIndexResoH264Vbr].selectedIndex].value);
}


function uiSetH264VbrQualIndex(no, qual) {
    var objParts = new Array();

    uiGetH264VbrObject(no, objParts);

    objParts[uiIndexQualH264Vbr].length = qualInfo_H264Vbr.length - 1;
    for (var idx = 0; idx < objParts[uiIndexQualH264Vbr].length; idx++) {
        objParts[uiIndexQualH264Vbr].options[idx].value = idx;
        objParts[uiIndexQualH264Vbr].options[idx].text = qualInfo_H264Vbr[idx + 1];
    }
    if (null == qual) {
        uiSelectListBoxValue(objParts[uiIndexQualH264Vbr], qualInfo_H264Vbr[0], qualInfo_H264Vbr[0]);
    } else {
        uiSelectListBoxValue(objParts[uiIndexQualH264Vbr], qual, qualInfo_H264Vbr[0]);
    }

    return Number(objParts[uiIndexQualH264Vbr].options[objParts[uiIndexQualH264Vbr].selectedIndex].value);
}


function uiSetH264VbrFpsIndex(no, model, fps) {
    var objParts = new Array();
    var idx2 = 0;

    uiGetH264VbrObject(no, objParts);

    var reso = objParts[uiIndexResoH264Vbr].selectedIndex;

    if (null == fps) {
        if ((model == camKind_H264Vbr_EX_Next_2M_U3)) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        }
        else if ((model == camKind_H264Vbr_EX_Next_5M_U2)) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        }
        else if ((model == camKind_H264Vbr_EX_Next_2M_U4)) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        }
        else if ((model == camKind_H264Vbr_EX_Next_5M_U3)) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        }
        else if (model == camKind_H264Vbr_EX_Next_4K_U) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        }
        else if ((model == camKind_H264Vbr_EX_Next_2M_U2)) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        }
        else if ((model == camKind_H264Vbr_EX_Next_5M_U)) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        }
        else if ((model == camKind_H264Vbr_EX_Next_Bullet_2M_S)) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        }
        else if ((model == camKind_H264Vbr_EX_Next_Bullet_5M_S)) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        }
        else if ((model == camKind_H264Vbr_EX_Next_Bullet_4K_S)) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        }
        else if ((model == camKind_H264Vbr_EX_NextPTZ_2M_X)) {
            if (reso == camReso_H264Vbr_EX_PTZ_HVGAW) {
                objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 2;
            }
            else {
                objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
            }
        }
        else if ((model == camKind_H264Vbr_EX_NextPTZ_4K_X)) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        }
        else if ((model == camKind_H264Vbr_EX_Next_2M_S)) {
            if (reso == camReso_H264Vbr_EX_PTZ_HVGAW) {
                objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 2;
            }
            else {
                objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
            }
        }
        else if ((model == camKind_H264Vbr_EX_Next_2M_X)) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        }
        else if ((model == camKind_H264Vbr_EX_Next_5M_XCnr) || 
                 (model == camKind_H264Vbr_EX_Next_5M_X) || 
                 (model == camKind_H264Vbr_EX_Next_6M_X) || 
                 (model == camKind_H264Vbr_EX_Next_4K_X) || 
                 (model == camKind_H264Vbr_EX_NextPTZ_2M_S) || 
                 (model == camKind_H264Vbr_EX_NextPTZ_6M_S) || 
                 (model == camKind_H264Vbr_EX_NextPTZ_4K_S) || 
                 (model == camKind_H264Vbr_EX_NextPTZ_6M2_S) || 
                 (model == camKind_H264Vbr_EX_NextPTZ_4K2_S) || 
                 (model == camKind_H264Vbr_EX_Next_4M_S)) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        }
        else if ((model == camKind_H264Vbr_EX_Next_2M_U) || (model == camKind_H264Vbr_EX_MIC_U)) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
            CALC_AUDIOAACLDSELECTED = false;

            if (frmNWDR.chkaudio.checked == true) {
                if (document.getElementById('camRecAudio_AACLC').checked == true) {
                    objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 2;
                    CALC_AUDIOAACLDSELECTED = true;
                }
            }
        }
        else if (model == camKind_H264Vbr_EX_Next_4M_U) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
            CALC_AUDIOAACLDSELECTED = false;

            if (frmNWDR.chkaudio.checked == true) {
                objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 2;
                CALC_AUDIOAACLDSELECTED = true;
            }
        }
        else if (model == camKind_H264Vbr_EX_U) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        }
        else if ((model == camKind_H264Vbr_NextPTZ_S) || (model == camKind_H264Vbr_NextPTZ_U) || (model == camKind_H264Vbr_NextPT_S) || (model == camKind_H264Vbr_EX_AIMS_X_PTZ)) {
            if (reso == camReso_H264Vbr_EX_PTZ_HVGAW) {
                objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 2;
            }
            else {
                objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
            }
        }
        else if (model == camKind_H264Vbr_Next5MPTZ_S) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        }
        else if ((model == camKind_H264Vbr_EX_AIMS) || (model == camKind_H264Vbr_EX_AIMS_U)) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        }
        else if (model == camKind_H264Vbr_EX_AIMS_4K) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        }
        else if (model == camKind_H264Vbr_EX_AIMS_X) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        }
        else if (model == camKind_H264Vbr_EX_4K_5M6M) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        }
        else if (model == camKind_H264Vbr_EX_IPROMINI) {
            if (reso == camReso_H264Vbr_2048x1536) {
                objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 2;
            }
            else {
                objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
            }
        }
        else if (model == camKind_H264Vbr_NextS) {
            if ((reso == camReso_H264Vbr_EX_FHD) || (reso == camReso_H264Vbr_EX_HD)) {
                objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
            }
            else {
                objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 2;
            }
        }
        else if ((model == camKind_H264Vbr_EX1) || (model == camKind_H264Vbr_EX2) || (model == camKind_H264Vbr_EX3)) {
            if (reso == camReso_H264Vbr_EX_FHD || reso == camReso_H264Vbr_EX_HD) {
                objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
            }
            else {
                objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 2;
            }
        }
        else if (model == camKind_H264Vbr_EX_4K) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        }
        else if (model == camKind_H264Vbr_EX_AI360) {
            if (reso == camReso_H264Vbr_EX_9M_2560x1920 || reso == camReso_H264Vbr_EX_9M_2048x1536 || reso == camReso_H264Vbr_EX_9M_2560x1440) {
                objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 2;
            }
            else {
                objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
            }
        }
        else if (model == camKind_H264Vbr_EX_9M) {
            if (reso == camReso_H264Vbr_EX_9M_2560x1920 || reso == camReso_H264Vbr_EX_9M_2048x1536 || reso == camReso_H264Vbr_EX_9M_2560x1440) {
                objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 2;
            }
            else {
                objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
            }
        }
        else if (model == camKind_H264Vbr_EX_AIMS_30ips) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        }
        else if (model == camKind_H264Vbr_EX_AIMS_15ips) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        }
        else if (model == camKind_H264Vbr_EX_MS) {
            if ( reso == camReso_H264Vbr_EX_MS_3840x2160 || reso == camReso_H264Vbr_EX_MS_2560x1440) {
                objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 2;
            }
            else {
                objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
            }
        }
        else if (model == camKind_H264Vbr_EX_AI || model == camKind_H264Vbr_EX_AI_4K) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        }
        else if (model == camKind_H264Vbr_S2) {
            if (reso == camReso_H264Vbr_S2_FHD && reso == camReso_H264Vbr_S2_HD) {
                objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
            } else {
                objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 2;
            }
        }
        else if (model == camKind_H264Vbr_4K) {
            if (reso == camReso_H264Vbr_4K_4000x3000 || reso == camReso_H264Vbr_4K_3840x2160) {
                objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 2;
            } else {
                objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
            }
        }
        else if (model == camKind_H264Vbr_9M) {
            if (reso == camReso_H264Vbr_9M_2816x2816) {
                objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 4;
            } else if (reso == camReso_H264Vbr_9M_1280x1280) {
                objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
            } else {
                objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 2;
            }
        } 
    } else {
        objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
    }
    for (var idx = 0; idx < objParts[uiIndexFpsH264Vbr].length; idx++) {
        objParts[uiIndexFpsH264Vbr].options[idx].value = idx;
        objParts[uiIndexFpsH264Vbr].options[idx].text = fpsInfo_H264Vbr[model][idx + 1];
    }

    if (null == fps) {
        uiSelectListBoxValue(objParts[uiIndexFpsH264Vbr], fpsInfo_H264Vbr[model][0], fpsInfo_H264Vbr[model][0]);
    } else {
        uiSelectListBoxValue(objParts[uiIndexFpsH264Vbr], fps, fpsInfo_H264Vbr[model][0]);
    }

    return Number(objParts[uiIndexFpsH264Vbr].options[objParts[uiIndexFpsH264Vbr].selectedIndex].value);
}


function uiSetH264VbrFpsText(no, model, fps) {
    var objParts = new Array();
    var idx2 = 0;

    uiGetH264VbrObject(no, objParts);

    var reso = objParts[uiIndexResoH264Vbr].selectedIndex;

    if ((model == camKind_H264Vbr_EX_Next_2M_U3)) {
        objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
    }
    else if ((model == camKind_H264Vbr_EX_Next_5M_U2)) {
        objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
    }
    else if ((model == camKind_H264Vbr_EX_Next_2M_U4)) {
        objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
    }
    else if ((model == camKind_H264Vbr_EX_Next_5M_U3)) {
        objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
    }
    else if ((model == camKind_H264Vbr_EX_Next_4K_U)) {
        objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
    }
    else if ((model == camKind_H264Vbr_EX_Next_2M_U2)) {
        objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
    }
    else if ((model == camKind_H264Vbr_EX_Next_5M_U)) {
        objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
    }
    else if ((model == camKind_H264Vbr_EX_Next_Bullet_2M_S)) {
        objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
    }
    else if ((model == camKind_H264Vbr_EX_Next_Bullet_5M_S)) {
        objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
    }
    else if ((model == camKind_H264Vbr_EX_Next_Bullet_4K_S)) {
        objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
    }
    else if ((model == camKind_H264Vbr_EX_NextPTZ_2M_X)) {
        if (reso == camReso_H264Vbr_EX_PTZ_HVGAW) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 2;
        }
        else {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        }
    }
    else if ((model == camKind_H264Vbr_EX_NextPTZ_4K_X)) {
        objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
    }
    else if ((model == camKind_H264Vbr_EX_Next_2M_S)) {
        if (reso == camReso_H264Vbr_EX_PTZ_HVGAW) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 2;
        }
        else {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        }
    }
    else if ((model == camKind_H264Vbr_EX_Next_2M_X)) {
        objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
    }
    else if ((model == camKind_H264Vbr_EX_Next_5M_XCnr) || 
             (model == camKind_H264Vbr_EX_Next_5M_X) || 
             (model == camKind_H264Vbr_EX_Next_6M_X) || 
             (model == camKind_H264Vbr_EX_Next_4K_X) || 
             (model == camKind_H264Vbr_EX_NextPTZ_2M_S) || 
             (model == camKind_H264Vbr_EX_NextPTZ_6M_S) || 
             (model == camKind_H264Vbr_EX_NextPTZ_4K_S) || 
             (model == camKind_H264Vbr_EX_NextPTZ_6M2_S) || 
             (model == camKind_H264Vbr_EX_NextPTZ_4K2_S) || 
             (model == camKind_H264Vbr_EX_Next_4M_S)) {
        objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
    }
    else if ((model == camKind_H264Vbr_EX_Next_2M_U) || (model == camKind_H264Vbr_EX_MIC_U)) {
        objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        CALC_AUDIOAACLDSELECTED = false;

        if (frmNWDR.chkaudio.checked == true) {
            if (document.getElementById('camRecAudio_AACLC').checked == true) {
                objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 2;
                CALC_AUDIOAACLDSELECTED = true;
            }
        }
    }
else if (model == camKind_H264Vbr_EX_Next_4M_U) {
        objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        CALC_AUDIOAACLDSELECTED = false;

        if (frmNWDR.chkaudio.checked == true) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 2;
            CALC_AUDIOAACLDSELECTED = true;
        }
    }
    else if (model == camKind_H264Vbr_EX_U) {
        objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
    }
    else if ((model == camKind_H264Vbr_NextPTZ_S) || (model == camKind_H264Vbr_NextPTZ_U) || (model == camKind_H264Vbr_NextPT_S) || (model == camKind_H264Vbr_EX_AIMS_X_PTZ)) {
        if (reso == camReso_H264Vbr_EX_PTZ_HVGAW) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 2;
        }
        else {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        }
    }
    else if (model == camKind_H264Vbr_Next5MPTZ_S) {
        objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
    }
    else if ((model == camKind_H264Vbr_EX_AIMS) || (model == camKind_H264Vbr_EX_AIMS_U)) {
        objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
    }
    else if (model == camKind_H264Vbr_EX_AIMS_4K) {
        objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
    }
    else if (model == camKind_H264Vbr_EX_AIMS_X) {
        objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
    }
    else if (model == camKind_H264Vbr_EX_4K_5M6M) {
        objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
    }
    else if (model == camKind_H264Vbr_EX_IPROMINI) {
        if (reso == camReso_H264Vbr_EX_IPROMINI_2048x1536) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 2;
        }
        else {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        }
    }
    else if (model == camKind_H264Vbr_NextS) {
        if ((reso == camReso_H264Vbr_EX_FHD) || (reso == camReso_H264Vbr_EX_HD)) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        }
        else {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 2;
        }
    }
    else if ((model == camKind_H264Vbr_EX1) || (model == camKind_H264Vbr_EX2) || (model == camKind_H264Vbr_EX3)) {
        if (reso == camReso_H264Vbr_EX_FHD || reso == camReso_H264Vbr_EX_HD) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        }
        else {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 2;
        }
    }
    else if (model == camKind_H264Vbr_EX_4K) {
        objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
    }
    else if (model == camKind_H264Vbr_EX_AI360) {
        if (reso == camReso_H264Vbr_EX_9M_2560x1920 || reso == camReso_H264Vbr_EX_9M_2048x1536 || reso == camReso_H264Vbr_EX_9M_2560x1440) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 2;
        }
        else {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        }
    }
    else if (model == camKind_H264Vbr_EX_9M) {
        if (reso == camReso_H264Vbr_EX_9M_2560x1920 || reso == camReso_H264Vbr_EX_9M_2048x1536 || reso == camReso_H264Vbr_EX_9M_2560x1440) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 2;
        }
        else {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        }
    }
    else if (model == camKind_H264Vbr_EX_AIMS_30ips) {
        objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
    }
    else if (model == camKind_H264Vbr_EX_AIMS_15ips) {
        objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
    }
    else if (model == camKind_H264Vbr_EX_MS) {
        if ( reso == camReso_H264Vbr_EX_MS_3840x2160 || reso == camReso_H264Vbr_EX_MS_2560x1440) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 2;
        }
        else {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        }
    }
    else if (model == camKind_H264Vbr_EX_AI || model == camKind_H264Vbr_EX_AI_4K) {
        objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
    }
    else if (model == camKind_H264Vbr_S2) {
        if (reso == camReso_H264Vbr_S2_FHD || reso == camReso_H264Vbr_S2_HD) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        } else {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 2;
        }
    }
    else if (model == camKind_H264Vbr_4K) {
        if (reso == camReso_H264Vbr_4K_4000x3000 || reso == camReso_H264Vbr_4K_3840x2160) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 2;
        } else {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        }
    }
    else if (model == camKind_H264Vbr_9M) {
        if (reso == camReso_H264Vbr_9M_2816x2816) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 4;
        } else if (reso == camReso_H264Vbr_9M_1280x1280) {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 1;
        } else {
            objParts[uiIndexFpsH264Vbr].length = fpsInfo_H264Vbr[model].length - 2;
        }
    } 

    for (var idx = 0; idx < objParts[uiIndexFpsH264Vbr].length; idx++) {
        objParts[uiIndexFpsH264Vbr].options[idx].value = idx;
        objParts[uiIndexFpsH264Vbr].options[idx].text = fpsInfo_H264Vbr[model][idx + 1];
    }

    uiSelectListBoxText(objParts[uiIndexFpsH264Vbr], fps, fpsInfo_H264Vbr[model][fpsInfo_H264Vbr[model][0] + 1]);

    return Number(objParts[uiIndexFpsH264Vbr].options[objParts[uiIndexFpsH264Vbr].selectedIndex].value);
}


function uiSetH264VbrLocationIndex(no, model, location) {
    var objParts = new Array();

    uiGetH264VbrObject(no, objParts);

    objParts[uiIndexSceneLocationH264Vbr].length = camSceneInfo_H264Vbr[model].length;
    for (var idx = 0; idx < objParts[uiIndexSceneLocationH264Vbr].length; idx++) {
        objParts[uiIndexSceneLocationH264Vbr].options[idx].value = idx;
        objParts[uiIndexSceneLocationH264Vbr].options[idx].text = camSceneInfo_H264Vbr[model][idx][0];
    }
    if (null == location) {
        if (model == camKind_H264Vbr_S2) {
            uiSelectListBoxValue(objParts[uiIndexSceneLocationH264Vbr], 4, 4);
        } else {
            uiSelectListBoxValue(objParts[uiIndexSceneLocationH264Vbr], 0, 0);
        }
    } else {
        uiSelectListBoxValue(objParts[uiIndexSceneLocationH264Vbr], location, 0);
    }

    return Number(objParts[uiIndexSceneLocationH264Vbr].options[objParts[uiIndexSceneLocationH264Vbr].selectedIndex].value);
}


function uiSetH264VbrGopControl(no, model, gopcontrol) {
    var objParts = new Array();

    uiGetH264VbrObject(no, objParts);

    motionLabelNormal = '#txt_s_scene_motion_h264_normal_1';
    motionLabelLow = '#txt_s_scene_motion_h264_low_1';
    aiLabelNormal = '#txt_s_scene_motion_h264_normal_ai_1';
    aiLabelLow = '#txt_s_scene_motion_h264_low_ai_1';
    if (no == 2) {
        motionLabelNormal = '#txt_s_scene_motion_h264_normal_2';
        motionLabelLow = '#txt_s_scene_motion_h264_low_2';
        aiLabelNormal = '#txt_s_scene_motion_h264_normal_ai_2';
        aiLabelLow = '#txt_s_scene_motion_h264_low_ai_2';
    }
    else if (no == 3) {
        motionLabelNormal = '#txt_s_scene_motion_h264_normal_3';
        motionLabelLow = '#txt_s_scene_motion_h264_low_3';
        aiLabelNormal = '#txt_s_scene_motion_h264_normal_ai_3';
        aiLabelLow = '#txt_s_scene_motion_h264_low_ai_3';
    }

    var txt_s_scene_smartcoding_face_id;
    var selSceneSmartFacialCoding_id;
    var item_scene_smartcoding_id;
    var item_scene_smartcoding_picskip_id;
    var item_scene_smartcoding_news_id;
    switch (no) {
        case '1':
            txt_s_scene_smartcoding_face_id = "txt_s_scene_smartfacialcoding_h264_1";
            selSceneSmartFacialCoding_id = "selSceneSmartFacialCodingH264Vbr_1";

            item_scene_smartcoding_id = "item_scene_smartcoding_h264_1";
            item_scene_smartcoding_picskip_id = "item_scene_smartcoding_picskip_h264_1";
            item_scene_smartcoding_news_id = "item_scene_smartcoding_news_h264_1";
            break;
        case '2':
            txt_s_scene_smartcoding_face_id = "txt_s_scene_smartfacialcoding_h264_2";
            selSceneSmartFacialCoding_id = "selSceneSmartFacialCodingH264Vbr_2";

            item_scene_smartcoding_id = "item_scene_smartcoding_h264_2";
            item_scene_smartcoding_picskip_id = "item_scene_smartcoding_picskip_h264_2";
            item_scene_smartcoding_news_id = "item_scene_smartcoding_news_h264_2";
            break;
        case '3':
            txt_s_scene_smartcoding_face_id = "txt_s_scene_smartfacialcoding_h264_3";
            selSceneSmartFacialCoding_id = "selSceneSmartFacialCodingH264Vbr_3";

            item_scene_smartcoding_id = "item_scene_smartcoding_h264_3";
            item_scene_smartcoding_picskip_id = "item_scene_smartcoding_picskip_h264_3";
            item_scene_smartcoding_news_id = "item_scene_smartcoding_news_h264_3";
            break;
        default:
            txt_s_scene_smartcoding_face_id = "txt_s_scene_smartfacialcoding_h264_1";
            selSceneSmartFacialCoding_id = "selSceneSmartFacialCodingH264Vbr_1";

            item_scene_smartcoding_id = "item_scene_smartcoding_h264_1";
            item_scene_smartcoding_picskip_id = "item_scene_smartcoding_picskip_h264_1";
            item_scene_smartcoding_news_id = "item_scene_smartcoding_news_h264_1";
            break;
    }

    var modelname = objParts[uiIndexModelH264Vbr].options[model].text;

    if ((modelname == 'X2558*') || 
        (modelname == 'X153**/X223**/X253**') || (modelname == 'X155**/X225**/X2550*') || 
        (modelname == 'X156**/X226**/X256**') || (modelname == 'X157**/X227**/X257**') || 
        (modelname == 'X156**/X226**/X256**') || (modelname == 'X157**/X227**/X257**') || 
        (modelname == 'S663**/X663**') || (modelname == 'S666**/X666**') || 
        (modelname == 'S667**/X667**') || (modelname == 'S854**(Multi-Sensor)') || 
        (modelname == 'U854**(Multi-Sensor)') || (modelname == 'S857**(4K Multi-Sensor)') || 
        (modelname == 'X865**(Multi-Sensor)') || (modelname == 'S613**/S653**') || 
        (modelname == 'S615**/S655**') || (modelname == 'X865**(PTZ)')  || 
        (modelname == 'S2**6/S2**5/S1**6/S1**5') || (modelname == 'S71***') || 
        (modelname == 'S25***/S22***/S15***') || (modelname == 'S854*(AI Multi-Sensor)') || 
        (modelname == 'S153**') || (modelname == 'S155**') || (modelname == 'S157**') ||
        (modelname == 'S616**') || (modelname == 'S617**') ||
        (modelname == 'X673**') || (modelname == 'X677**') ||
        (modelname == 'S856*/S857*(AI Multi-Sensor)') ||
        (modelname == 'U1575*/U2275*/U2575*') ||
        (modelname == 'U1135*/U1535*/U2135*/U2235*/U2535*') ||
        (modelname == 'U1155*/U1555*/U2155*/U2555*')) {

        document.getElementById(txt_s_scene_smartcoding_face_id).innerText = s_scene_smartviqs;
        document.getElementById(selSceneSmartFacialCoding_id).className = "sCamSmartCordingSettingVbrWidth";

        document.getElementById(item_scene_smartcoding_id).style.display ="none";
        document.getElementById(item_scene_smartcoding_picskip_id).style.display ="table-cell";
        document.getElementById(item_scene_smartcoding_news_id).style.display ="table-cell";
    } else {

        document.getElementById(txt_s_scene_smartcoding_face_id).innerText = s_scene_smartcodingface;
        document.getElementById(selSceneSmartFacialCoding_id).className = "sCamSmartFacialCordingSettingVbrWidth";

        document.getElementById(item_scene_smartcoding_id).style.display ="table-cell";
        document.getElementById(item_scene_smartcoding_picskip_id).style.display ="none";
        document.getElementById(item_scene_smartcoding_news_id).style.display ="none";
    }

    if (IsH265Exstreme(model)) {
        objParts[uiIndexSceneGopControlH264Vbr].length = camSmartCodingInfo_H264Vbr_H265.length - 1;
        if ((modelname == 'X2558*') || (modelname == 'X153**/X223**/X253**') || 
        (modelname == 'X155**/X225**/X2550*') || (modelname == 'X156**/X226**/X256**') || 
        (modelname == 'X157**/X227**/X257**') || (modelname == 'S663**/X663**')  || 
        (modelname == 'S666**/X666**') || (modelname == 'S667**/X667**') || 
        (modelname == 'S854**(Multi-Sensor)') || (modelname == 'U854**(Multi-Sensor)') || 
        (modelname == 'S857**(4K Multi-Sensor)') || (modelname == 'X865**(Multi-Sensor)') || 
        (modelname == 'S613**/S653**') || (modelname == 'S615**/S655**') || 
        (modelname == 'B513**/B543**') || (modelname == 'X865**(PTZ)')  || 
        (modelname == 'S2**6/S2**5/S1**6/S1**5') || (modelname == 'S71***') || 
        (modelname == 'S25***/S22***/S15***') || (modelname == 'S854*(AI Multi-Sensor)') || 
        (modelname == 'S153**') || (modelname == 'S155**') || (modelname == 'S157**') ||
        (modelname == 'S616**') || (modelname == 'S617**') ||
        (modelname == 'X673**') || (modelname == 'X677**') ||
        (modelname == 'S856*/S857*(AI Multi-Sensor)') ||
        (modelname == 'U1575*/U2275*/U2575*') ||
        (modelname == 'U1135*/U1535*/U2135*/U2235*/U2535*') ||
        (modelname == 'U1155*/U1555*/U2155*/U2555*')
        ) {
            objParts[uiIndexSceneSmartCodingNewSH264Vbr].length = camSmartCodingInfo_H264Vbr_H265.length - 1;
        }
        objParts[uiIndex_s_scene_gopcontrol_1_h264].style.display = 'block';
        objParts[uiIndex_s_scene_gopcontrol_2_h264].style.display = 'none';
        if (model == camKind_H264Vbr_EX_AI || model == camKind_H264Vbr_EX_AI_4K) {
            objParts[uiIndex_s_scene_smartfacialcoding_h264].style.display = 'none';
            objParts[uiIndex_s_scene_smartfacialcoding_h264_ai].style.display = 'block';
            objParts[uiIndex_s_scene_smartcoding_viqs_h264].style.display = 'none';
            objParts[uiIndexSceneSmartFacialCodingH264Vbr].style.display = 'block';
            $(motionLabelNormal)[0].style.display = 'none';
            $(motionLabelLow)[0].style.display = 'none';
            $(aiLabelNormal)[0].style.display = 'block';
            $(aiLabelLow)[0].style.display = 'block';
        } else if ((model == camKind_H264Vbr_EX_Next_2M_S) || 
                   (model == camKind_H264Vbr_EX_Next_4M_S) || 
                   (model == camKind_H264Vbr_EX_Next_2M_U) || 
                   (model == camKind_H264Vbr_EX_Next_4M_U) || 
                   (model == camKind_H264Vbr_EX_U) || 
                   (model == camKind_H264Vbr_EX_MIC_U) || 
                   (model == camKind_H264Vbr_NextPT_S) || 
                   (model == camKind_H264Vbr_EX_AI360)  || 
                   (model == camKind_H264Vbr_NextPTZ_U) ||
                   (model == camKind_H264Vbr_EX_Next_2M_U3) || 
                   (model == camKind_H264Vbr_EX_Next_2M_U4) || 
                   (model == camKind_H264Vbr_EX_Next_5M_U2) || 
                   (model == camKind_H264Vbr_EX_Next_5M_U3)){

            objParts[uiIndex_s_scene_smartfacialcoding_h264].style.display = 'none';
            objParts[uiIndex_s_scene_smartfacialcoding_h264_ai].style.display = 'none';
            objParts[uiIndex_s_scene_smartcoding_viqs_h264].style.display = 'block';
            objParts[uiIndexSceneSmartFacialCodingH264Vbr].style.display = 'block';
            $(motionLabelNormal)[0].style.display = 'none';
            $(motionLabelLow)[0].style.display = 'none';
            $(aiLabelNormal)[0].style.display = 'block';
            $(aiLabelLow)[0].style.display = 'block';           
        } else {
            objParts[uiIndex_s_scene_smartfacialcoding_h264].style.display = 'block';
            objParts[uiIndex_s_scene_smartfacialcoding_h264_ai].style.display = 'none';
            objParts[uiIndex_s_scene_smartcoding_viqs_h264].style.display = 'none';
            objParts[uiIndexSceneSmartFacialCodingH264Vbr].style.display = 'block';
            $(motionLabelNormal)[0].style.display = 'inline';
            $(motionLabelLow)[0].style.display = 'inline';
            $(aiLabelNormal)[0].style.display = 'none';
            $(aiLabelLow)[0].style.display = 'none';
        }
    } else {
        objParts[uiIndexSceneGopControlH264Vbr].length = camSmartCodingInfo_H264Vbr.length - 1;
        objParts[uiIndex_s_scene_gopcontrol_1_h264].style.display = 'none';
        objParts[uiIndex_s_scene_gopcontrol_2_h264].style.display = 'block';
        objParts[uiIndex_s_scene_smartfacialcoding_h264].style.display = 'none';
        objParts[uiIndexSceneSmartFacialCodingH264Vbr].style.display = 'none';
        $(motionLabelNormal)[0].style.display = 'inline';
        $(motionLabelLow)[0].style.display = 'inline';
        $(aiLabelNormal)[0].style.display = 'none';
        $(aiLabelLow)[0].style.display = 'none';
    }

    for (var idx = 0; idx < objParts[uiIndexSceneGopControlH264Vbr].length; idx++) {
        if ((!IsH265Exstreme(model)) && (idx == 1)) {
            objParts[uiIndexSceneGopControlH264Vbr].options[idx].value = 2;
        } else {
            objParts[uiIndexSceneGopControlH264Vbr].options[idx].value = idx;
        }
        if (IsH265Exstreme(model)) {
            objParts[uiIndexSceneGopControlH264Vbr].options[idx].text = camSmartCodingInfo_H264Vbr_H265[idx + 1];
        } else {
            objParts[uiIndexSceneGopControlH264Vbr].options[idx].text = camSmartCodingInfo_H264Vbr[idx + 1];
        }
    }
    if (null == gopcontrol) {
        if (IsH265Exstreme(model)) {
            uiSelectListBoxValue(objParts[uiIndexSceneGopControlH264Vbr], 0, camSmartCodingInfo_H264Vbr_H265[0]);
        } else {
            uiSelectListBoxValue(objParts[uiIndexSceneGopControlH264Vbr], 2, camSmartCodingInfo_H264Vbr[0]);
        }
    } else {
        uiSelectListBoxValue(objParts[uiIndexSceneGopControlH264Vbr], gopcontrol, camSmartCodingInfo_H264Vbr[0]);
    }

    if ((modelname == 'X2558*') || (modelname == 'X153**/X223**/X253**') || 
        (modelname == 'X155**/X225**/X2550*') || (modelname == 'X156**/X226**/X256**') || 
        (modelname == 'X157**/X227**/X257**') || (modelname == 'S663**/X663**') || 
        (modelname == 'S666**/X666**') || (modelname == 'S667**/X667**') || 
        (modelname == 'S854**(Multi-Sensor)') || (modelname == 'U854**(Multi-Sensor)') || 
        (modelname == 'S857**(4K Multi-Sensor)') || (modelname == 'X865**(Multi-Sensor)') || 
        (modelname == 'S613**/S653**') || (modelname == 'S615**/S655**') || 
        (modelname == 'B513**/B543**') || (modelname == 'X865**(PTZ)')  || 
        (modelname == 'S2**6/S2**5/S1**6/S1**5') || (modelname == 'S71***') || 
        (modelname == 'S25***/S22***/S15***') || (modelname == 'S854*(AI Multi-Sensor)') || 
        (modelname == 'S153**') || (modelname == 'S155**') || (modelname == 'S157**') ||
        (modelname == 'S616**') || (modelname == 'S617**') ||
        (modelname == 'X673**') || (modelname == 'X677**') ||
        (modelname == 'S856*/S857*(AI Multi-Sensor)') ||
        (modelname == 'U1575*/U2275*/U2575*') ||
        (modelname == 'U1135*/U1535*/U2135*/U2235*/U2535*') ||
        (modelname == 'U1155*/U1555*/U2155*/U2555*')) {

        objParts[uiIndexSceneSmartCodingNewSH264Vbr].options[0].text = camSmartCodingInfo_H264Vbr_H265[1];
        uiSelectListBoxValue(objParts[uiIndexSceneSmartCodingNewSH264Vbr], 0, camSmartCodingInfo_H264Vbr[0]);
        return Number(objParts[uiIndexSceneSmartCodingNewSH264Vbr].options[objParts[uiIndexSceneSmartCodingNewSH264Vbr].selectedIndex].value);
    }
    return Number(objParts[uiIndexSceneGopControlH264Vbr].options[objParts[uiIndexSceneGopControlH264Vbr].selectedIndex].value);
}


function uiSetH264VbrSmartFacialCoding(no, model, smartfacialcoding) {
    var objParts = new Array();

    uiGetH264VbrObject(no, objParts);

    var modelname = objParts[uiIndexModelH264Vbr].options[model].text;
    if ((modelname == 'X2558*') || (modelname == 'X153**/X223**/X253**') || 
        (modelname == 'X155**/X225**/X2550*') || (modelname == 'X156**/X226**/X256**') || 
        (modelname == 'X157**/X227**/X257**') || (modelname == 'S663**/X663**') || 
        (modelname == 'S666**/X666**') || (modelname == 'S667**/X667**') || 
        (modelname == 'S854**(Multi-Sensor)') || (modelname == 'U854**(Multi-Sensor)') || 
        (modelname == 'U854**(Multi-Sensor)') || (modelname == 'S857**(4K Multi-Sensor)') || 
        (modelname == 'X865**(Multi-Sensor)') || (modelname == 'S854**(Multi-Sensor)') || 
        (modelname == 'S857**(4K Multi-Sensor)') || (modelname == 'X865**(Multi-Sensor)') || 
        (modelname == 'S613**/S653**') || (modelname == 'S615**/S655**') || 
        (modelname == 'X865**(PTZ)')  || (modelname == 'S2**6/S2**5/S1**6/S1**5') || 
        (modelname == 'S71***') || (modelname == 'S25***/S22***/S15***') || 
        (modelname == 'S854*(AI Multi-Sensor)') || 
        (modelname == 'S153**') || (modelname == 'S155**') || (modelname == 'S157**') ||
        (modelname == 'S616**') || (modelname == 'S617**') ||
        (modelname == 'X673**') || (modelname == 'X677**') ||
        (modelname == 'S856*/S857*(AI Multi-Sensor)') ||
        (modelname == 'U1575*/U2275*/U2575*') ||
        (modelname == 'U1135*/U1535*/U2135*/U2235*/U2535*') ||
        (modelname == 'U1155*/U1555*/U2155*/U2555*')
    ) {

        objParts[uiIndexSceneSmartFacialCodingH264Vbr].length = camSmartCodingSmartVIQSInfo_H264Vbr.length - 1;
        for (var idx = 0; idx < objParts[uiIndexSceneSmartFacialCodingH264Vbr].length; idx++) {
            objParts[uiIndexSceneSmartFacialCodingH264Vbr].options[idx].value = idx;
            objParts[uiIndexSceneSmartFacialCodingH264Vbr].options[idx].text = camSmartCodingSmartVIQSInfo_H264Vbr[idx + 1];
        }

        if (null == smartfacialcoding) {
            uiSelectListBoxValue(objParts[uiIndexSceneSmartFacialCodingH264Vbr], 1, camSmartCodingInfo_H264Vbr_SmartCoding[0]);
        } else {
            uiSelectListBoxValue(objParts[uiIndexSceneSmartFacialCodingH264Vbr], smartfacialcoding, camSmartCodingSmartVIQSInfo_H264Vbr[0]);
        }

        return Number(objParts[uiIndexSceneSmartFacialCodingH264Vbr].options[objParts[uiIndexSceneSmartFacialCodingH264Vbr].selectedIndex].value);
    }

    if ( model == camKind_H264Vbr_EX_MIC_U ) {
        if ((frmNWDR.chkaudio.checked == true) && (document.getElementById('camRecAudio_AACLC').checked == true)) {
            objParts[uiIndexSceneSmartFacialCodingH264Vbr].length = camSmartCodingInfo_H264Vbr_SmartCoding.length - 2;
        } else {
            objParts[uiIndexSceneSmartFacialCodingH264Vbr].length = camSmartCodingInfo_H264Vbr_SmartCoding.length - 1;
        }
        for (var idx = 0; idx < objParts[uiIndexSceneSmartFacialCodingH264Vbr].length; idx++) {
            if ((IsH265Exstreme(model)) && (idx == 1)) {
                objParts[uiIndexSceneSmartFacialCodingH264Vbr].options[idx].value = idx + 1;
            } else {
                objParts[uiIndexSceneSmartFacialCodingH264Vbr].options[idx].value = idx;
            }
            objParts[uiIndexSceneSmartFacialCodingH264Vbr].options[idx].text = camSmartCodingInfo_H264Vbr_SmartCoding[idx + 1];
        }
        if (null == smartfacialcoding) {
            uiSelectListBoxValue(objParts[uiIndexSceneSmartFacialCodingH264Vbr], 2, camSmartCodingInfo_H264Vbr_SmartCoding[0]);
        } else {
            uiSelectListBoxValue(objParts[uiIndexSceneSmartFacialCodingH264Vbr], smartfacialcoding, camSmartCodingInfo_H264Vbr_SmartCoding[0]);
        }
    } else {
        objParts[uiIndexSceneSmartFacialCodingH264Vbr].length = camSmartCodingInfo_H264Vbr_SmartCoding.length - 1;
        for (var idx = 0; idx < objParts[uiIndexSceneSmartFacialCodingH264Vbr].length; idx++) {
            if ((IsH265Exstreme(model)) && (idx == 1)) {
                objParts[uiIndexSceneSmartFacialCodingH264Vbr].options[idx].value = idx + 1;
            } else {
                objParts[uiIndexSceneSmartFacialCodingH264Vbr].options[idx].value = idx;
            }
            objParts[uiIndexSceneSmartFacialCodingH264Vbr].options[idx].text = camSmartCodingInfo_H264Vbr_SmartCoding[idx + 1];
        }
        if (null == smartfacialcoding) {
            uiSelectListBoxValue(objParts[uiIndexSceneSmartFacialCodingH264Vbr], 2, camSmartCodingInfo_H264Vbr_SmartCoding[0]);
        } else {
            uiSelectListBoxValue(objParts[uiIndexSceneSmartFacialCodingH264Vbr], smartfacialcoding, camSmartCodingInfo_H264Vbr_SmartCoding[0]);
        }
    }

    return Number(objParts[uiIndexSceneSmartFacialCodingH264Vbr].options[objParts[uiIndexSceneSmartFacialCodingH264Vbr].selectedIndex].value);
}


function uiSetH264VbrSmartCodingPicSkip(no, model) {
    var objParts = new Array();

    uiGetH264VbrObject(no, objParts);
    
    var txt_s_scene_smartcoding_picskip_id;
    var selSceneSmartCodingPicSkip_id;
    switch (no) {
        case '1':
            txt_s_scene_smartcoding_picskip_id = "txt_s_scene_smartcoding_picskip_h264_1";
            selSceneSmartCodingPicSkip_id = "selSceneSmartCodingPicSkipH264Vbr_1";
            break;
        case '2':
            txt_s_scene_smartcoding_picskip_id = "txt_s_scene_smartcoding_picskip_h264_2";
            selSceneSmartCodingPicSkip_id = "selSceneSmartCodingPicSkipH264Vbr_2";
            break;
        case '3':
            txt_s_scene_smartcoding_picskip_id = "txt_s_scene_smartcoding_picskip_h264_3";
            selSceneSmartCodingPicSkip_id = "selSceneSmartCodingPicSkipH264Vbr_3";
            break;
        default:
            txt_s_scene_smartcoding_picskip_id = "txt_s_scene_smartcoding_picskip_h264_1";
            selSceneSmartCodingPicSkip_id = "selSceneSmartCodingPicSkipH264Vbr_1";
            break;
    }

    objParts[uiIndexSceneSmartCodingPicSkipH264Vbr].length = 1;
    objParts[uiIndexSceneSmartCodingPicSkipH264Vbr].options[0].value = 0;
    objParts[uiIndexSceneSmartCodingPicSkipH264Vbr].options[0].text = camSmartCodingSmartPicSkipInfo_H264Vbr[1];

    return Number(objParts[uiIndexSceneSmartCodingPicSkipH264Vbr].options[objParts[uiIndexSceneSmartCodingPicSkipH264Vbr].selectedIndex].value);
}


function uiSetH264VbrIllumPercentage(no, illum) {
    var objParts = new Array();

    uiGetH264VbrObject(no, objParts);

    objParts[uiIndexSceneIllumNormalH264Vbr].length = camIllumInfo_H264Vbr.length - 1;
    for (var idx = 0; idx < objParts[uiIndexSceneIllumNormalH264Vbr].length; idx++) {
        objParts[uiIndexSceneIllumNormalH264Vbr].options[idx].value = camIllumInfo_H264Vbr[idx + 1];
        objParts[uiIndexSceneIllumNormalH264Vbr].options[idx].text = camIllumInfo_H264Vbr[idx + 1];
    }
    if (null == illum) {
        uiSelectListBoxValue(objParts[uiIndexSceneIllumNormalH264Vbr], camIllumInfo_H264Vbr[0], camIllumInfo_H264Vbr[0]);
    } else {
        uiSelectListBoxValue(objParts[uiIndexSceneIllumNormalH264Vbr], illum, camIllumInfo_H264Vbr[0]);
    }

    var illumlow = 100 - Number(objParts[uiIndexSceneIllumNormalH264Vbr].value);
    objParts[uiIndexSceneIllumLowH264Vbr].value = illumlow;

    return Number(objParts[uiIndexSceneIllumNormalH264Vbr].value);
}


function uiChangeH264VbrIllumPercentage(no) {
    var objParts = new Array();

    uiGetH264VbrObject(no, objParts);

    var illumlow = 100 - Number(objParts[uiIndexSceneIllumNormalH264Vbr].value);
    objParts[uiIndexSceneIllumLowH264Vbr].value = illumlow;

    return Number(objParts[uiIndexSceneLocationH264Vbr].value);
}


function uiSetH264VbrIllumMotionNormalPercentage(no, motion) {
    var objParts = new Array();

    uiGetH264VbrObject(no, objParts);

    objParts[uiIndexSceneMotionNormalH264Vbr].length = camMotionInfo_H264Vbr.length - 1;
    for (var idx = 0; idx < objParts[uiIndexSceneMotionNormalH264Vbr].length; idx++) {
        objParts[uiIndexSceneMotionNormalH264Vbr].options[idx].value = camMotionInfo_H264Vbr[idx + 1];
        objParts[uiIndexSceneMotionNormalH264Vbr].options[idx].text = camMotionInfo_H264Vbr[idx + 1];
    }
    if (null == motion) {
        uiSelectListBoxValue(objParts[uiIndexSceneMotionNormalH264Vbr], camMotionInfo_H264Vbr[0], camMotionInfo_H264Vbr[0]);
    } else {
        uiSelectListBoxValue(objParts[uiIndexSceneMotionNormalH264Vbr], motion, camMotionInfo_H264Vbr[0]);
    }

    return Number(objParts[uiIndexSceneMotionNormalH264Vbr].value);
}


function uiSetH264VbrIllumMotionLowPercentage(no, motion) {
    var objParts = new Array();

    uiGetH264VbrObject(no, objParts);

    objParts[uiIndexSceneMotionLowH264Vbr].length = camMotionInfo_H264Vbr.length - 1;
    for (var idx = 0; idx < objParts[uiIndexSceneMotionLowH264Vbr].length; idx++) {
        objParts[uiIndexSceneMotionLowH264Vbr].options[idx].value = camMotionInfo_H264Vbr[idx + 1];
        objParts[uiIndexSceneMotionLowH264Vbr].options[idx].text = camMotionInfo_H264Vbr[idx + 1];
    }
    if (null == motion) {
        uiSelectListBoxValue(objParts[uiIndexSceneMotionLowH264Vbr], camMotionInfo_H264Vbr[0], camMotionInfo_H264Vbr[0]);
    } else {
        uiSelectListBoxValue(objParts[uiIndexSceneMotionLowH264Vbr], motion, camMotionInfo_H264Vbr[0]);
    }

    return Number(objParts[uiIndexSceneMotionLowH264Vbr].value);
}


function uiChangeH264VbrTimeAllocation(no) {
    var objParts = new Array();

    uiGetH264VbrObject(no, objParts);

    var rechours_perday = Number(frmNWDR.selRecHour.options[frmNWDR.selRecHour.selectedIndex].value);
    rechours_perday = Math.round(rechours_perday * 10) / 10;

    var rechours_illum_normal = rechours_perday * (Number(objParts[uiIndexSceneIllumNormalH264Vbr].value) / 100);
    rechours_illum_normal = Math.floor(rechours_illum_normal * 10) / 10;
    objParts[uiIndexSceneIllumNormalHourH264Vbr].innerHTML = rechours_illum_normal + '<br>' + s_txtTimeHour;

    var rechours_illum_low = (rechours_perday - rechours_illum_normal);
    rechours_illum_low = Math.round(rechours_illum_low * 10) / 10;
    objParts[uiIndexSceneIllumLowHourH264Vbr].innerHTML = rechours_illum_low + '<br>' + s_txtTimeHour;

    var rechours_motion_normal = rechours_illum_normal * (Number(objParts[uiIndexSceneMotionNormalH264Vbr].value) / 100);
    rechours_motion_normal = Math.floor(rechours_motion_normal * 10) / 10;
    objParts[uiIndexSceneMotionNormalHourH264Vbr].innerHTML = rechours_motion_normal + '<br>' + s_txtTimeHour;

    var rechours_motion_low = rechours_illum_low * (Number(objParts[uiIndexSceneMotionLowH264Vbr].value) / 100);
    rechours_motion_low = Math.floor(rechours_motion_low * 10) / 10;
    objParts[uiIndexSceneMotionLowHourH264Vbr].innerHTML = rechours_motion_low + '<br>' + s_txtTimeHour;
}


function uiChangeH264VbrSampleImage(no) {
    var objParts = new Array();

    uiGetH264VbrObject(no, objParts);

    var model = objParts[uiIndexModelH264Vbr].selectedIndex;
    var location = Number(objParts[uiIndexSceneLocationH264Vbr].options[objParts[uiIndexSceneLocationH264Vbr].selectedIndex].value);

    objParts[uiIndexSceneImageNormalH264Vbr].src = camSceneInfo_H264Vbr[model][location][1][0];
    objParts[uiIndexSceneImageLowH264Vbr].src = camSceneInfo_H264Vbr[model][location][1][1];
}


function uiPlayMovieH264(no, illum) {
    var objParts = new Array();

    uiGetH264VbrObject(no, objParts);

    var model = Number(objParts[uiIndexModelH264Vbr].options[objParts[uiIndexModelH264Vbr].selectedIndex].value);
    var location = Number(objParts[uiIndexSceneLocationH264Vbr].options[objParts[uiIndexSceneLocationH264Vbr].selectedIndex].value);

    var movieurl = camSceneInfo_H264Vbr[model][location][2][illum];

    WindowOpen(movieurl, 405, 228);


    var waitCount = 0;
    var waitHandle = setInterval(function() {
        waitCount++;

        if (waitCount == 10) {
            clearInterval(waitHandle);
        }
    }, 500);
}


function uiChangeH264VbrBitrate(no) {
    var objParts = new Array();

    uiGetH264VbrObject(no, objParts);

    var model = Number(objParts[uiIndexModelH264Vbr].options[objParts[uiIndexModelH264Vbr].selectedIndex].value);
    var reso = Number(objParts[uiIndexResoH264Vbr].options[objParts[uiIndexResoH264Vbr].selectedIndex].value);
    var resostr = objParts[uiIndexResoH264Vbr].options[objParts[uiIndexResoH264Vbr].selectedIndex].text;
    var qual = Number(objParts[uiIndexQualH264Vbr].options[objParts[uiIndexQualH264Vbr].selectedIndex].value);
    var fps = Number(objParts[uiIndexFpsH264Vbr].options[objParts[uiIndexFpsH264Vbr].selectedIndex].value);
    var location = Number(objParts[uiIndexSceneLocationH264Vbr].options[objParts[uiIndexSceneLocationH264Vbr].selectedIndex].value);
    var gopcontrol = Number(objParts[uiIndexSceneGopControlH264Vbr].options[objParts[uiIndexSceneGopControlH264Vbr].selectedIndex].value);
    var smartcodingstr = objParts[uiIndexSceneGopControlH264Vbr].options[objParts[uiIndexSceneGopControlH264Vbr].selectedIndex].text;
    if (IsH265Exstreme(model)) {
        var smartfacialcoding = Number(objParts[uiIndexSceneSmartFacialCodingH264Vbr].options[objParts[uiIndexSceneSmartFacialCodingH264Vbr].selectedIndex].value);
        var smartcodingfacestr = objParts[uiIndexSceneSmartFacialCodingH264Vbr].options[objParts[uiIndexSceneSmartFacialCodingH264Vbr].selectedIndex].text;
        if ((model == camKind_H264Vbr_EX_U) || (model == camKind_H264Vbr_EX_MIC_U) || (model == camKind_H264Vbr_NextPT_S) || (model == camKind_H264Vbr_EX_AI360) || (model == camKind_H264Vbr_NextPTZ_U) || (model == camKind_H264Vbr_EX_AIMS_U)) {
            if (smartfacialcoding > 0) {
                smartfacialcoding = 1; 
            }
        } else if ((model == camKind_H264Vbr_NextPTZ_S) || (model == camKind_H264Vbr_Next5MPTZ_S) || (model == camKind_H264Vbr_EX_AIMS) || (model == camKind_H264Vbr_EX_AIMS_4K) || (model == camKind_H264Vbr_EX_AIMS_X) || (model == camKind_H264Vbr_EX_AIMS_X_PTZ)) {
                if ((smartfacialcoding == 2)) {
                smartfacialcoding = smartfacialcoding + 1;
            }
        } else {
            var smartfacialcoding = Number(objParts[uiIndexSceneSmartFacialCodingH264Vbr].options[objParts[uiIndexSceneSmartFacialCodingH264Vbr].selectedIndex].value);
        }
    } else {
        var smartfacialcoding = 0;
    }
    var illmnormal = Number(objParts[uiIndexSceneIllumNormalH264Vbr].options[objParts[uiIndexSceneIllumNormalH264Vbr].selectedIndex].value);
    var illmlow = Number(objParts[uiIndexSceneIllumLowH264Vbr].value);
    var motionnormal = Number(objParts[uiIndexSceneMotionNormalH264Vbr].options[objParts[uiIndexSceneMotionNormalH264Vbr].selectedIndex].value);
    var motionlow = Number(objParts[uiIndexSceneMotionLowH264Vbr].options[objParts[uiIndexSceneMotionLowH264Vbr].selectedIndex].value);

    var maxBitrate = 0;

    var model_vbroldcalc = model - camKind_H264Vbr_EX_MIC_U;

    if (vbrCamInfTable[model][vbrCamInfTable_Enable] == 1 ) {
        var stilBitrateNormal = VbrCalcCoefMethod(model, vbr_h264, resostr, qual, fps, location, vbrCamInfTable[model][vbrCamInfTable_SCType], smartcodingstr, smartcodingfacestr, 0, 0);
    } else {
        if (IsH265Exstreme(model)) {
            var stilBitrateNormal = camBitrate_H264Vbr[model_vbroldcalc][location][bitrate_Normal][0][0][smartfacialcoding][reso][qual][fps]; 
        } else {
            if ((model != camKind_H264Vbr_EX_U) || (model != camKind_H264Vbr_EX_MIC_U)) {
                var stilBitrateNormal = camBitrate_H264Vbr[model_vbroldcalc][location][bitrate_Normal][gopcontrol * 2][reso][qual][fps]; 
            } else {
                var stilBitrateNormal = camBitrate_H264Vbr[model_vbroldcalc][location][bitrate_Normal][0][gopcontrol][smartfacialcoding][reso][qual][fps]; 
            }
        }
    }
    maxBitrate = (0 < illmnormal && 100 > motionnormal && stilBitrateNormal > maxBitrate) ? stilBitrateNormal : maxBitrate;
    if (vbrCamInfTable[model][vbrCamInfTable_Enable] == 1 ) {
        var stilBitrateLow = VbrCalcCoefMethod(model, vbr_h264, resostr, qual, fps, location, vbrCamInfTable[model][vbrCamInfTable_SCType], smartcodingstr, smartcodingfacestr, 1, 0);
    } else {
        if (IsH265Exstreme(model)) {
            var stilBitrateLow = camBitrate_H264Vbr[model_vbroldcalc][location][bitrate_Low][0][0][smartfacialcoding][reso][qual][fps]; 
        } else {
            if ((model != camKind_H264Vbr_EX_U) || (model != camKind_H264Vbr_EX_MIC_U)) {
                var stilBitrateLow = camBitrate_H264Vbr[model_vbroldcalc][location][bitrate_Low][gopcontrol * 2][reso][qual][fps]; 
            } else {
                var stilBitrateLow = camBitrate_H264Vbr[model_vbroldcalc][location][bitrate_Low][0][gopcontrol][smartfacialcoding][reso][qual][fps]; 
            }
        }
    }
    maxBitrate = (0 < illmlow && 100 > motionlow && stilBitrateLow > maxBitrate) ? stilBitrateLow : maxBitrate;

    if (vbrCamInfTable[model][vbrCamInfTable_Enable] == 1 ) {
        var moveBitrateNormal = VbrCalcCoefMethod(model, vbr_h264, resostr, qual, fps, location, vbrCamInfTable[model][vbrCamInfTable_SCType], smartcodingstr, smartcodingfacestr, 0, 1);
    } else {
        if (IsH265Exstreme(model)) {
            var moveBitrateNormal = camBitrate_H264Vbr[model_vbroldcalc][location][bitrate_Normal][1][0][smartfacialcoding][reso][qual][fps]; 
        } else {
            if ((model != camKind_H264Vbr_EX_U) || (model != camKind_H264Vbr_EX_MIC_U)) {
                var moveBitrateNormal = camBitrate_H264Vbr[model_vbroldcalc][location][bitrate_Normal][(gopcontrol * 2) + 1][reso][qual][fps]; 
            } else {
                var moveBitrateNormal = camBitrate_H264Vbr[model_vbroldcalc][location][bitrate_Normal][1][gopcontrol][smartfacialcoding][reso][qual][fps]; 
            }
        }
    }
    maxBitrate = (0 < illmnormal && 0 < motionnormal && moveBitrateNormal > maxBitrate) ? moveBitrateNormal : maxBitrate;
    if (vbrCamInfTable[model][vbrCamInfTable_Enable] == 1 ) {
        var moveBitrateLow = VbrCalcCoefMethod(model, vbr_h264, resostr, qual, fps, location, vbrCamInfTable[model][vbrCamInfTable_SCType], smartcodingstr, smartcodingfacestr, 1, 1);
    } else {
        if (IsH265Exstreme(model)) {
            var moveBitrateLow = camBitrate_H264Vbr[model_vbroldcalc][location][bitrate_Low][1][0][smartfacialcoding][reso][qual][fps]; 
        } else {
            if ((model != camKind_H264Vbr_EX_U) || (model != camKind_H264Vbr_EX_MIC_U)) {
                var moveBitrateLow = camBitrate_H264Vbr[model_vbroldcalc][location][bitrate_Low][(gopcontrol * 2) + 1][reso][qual][fps]; 
            } else {
                var moveBitrateLow = camBitrate_H264Vbr[model_vbroldcalc][location][bitrate_Low][1][gopcontrol][smartfacialcoding][reso][qual][fps]; 
            }
        }
    }
    maxBitrate = (0 < illmlow && 0 < motionlow && moveBitrateLow > maxBitrate) ? moveBitrateLow : maxBitrate;

    if (0 == stilBitrateNormal || 0 == stilBitrateLow || 0 == moveBitrateNormal || 0 == moveBitrateLow) {
        uiSetTextBoxValue(objParts[uiIndexMaxKbpsH264Vbr], '-', 0);
        uiSetTextBoxValue(objParts[uiIndexAvgKbpsH264Vbr], '-', 0);
    }
    else {
        var avgBitrate =
            (
                moveBitrateNormal * (motionnormal / 100) + stilBitrateNormal * (1 - motionnormal / 100)
            ) * (illmnormal / 100) +
            (
                moveBitrateLow * (motionlow / 100) + stilBitrateLow * (1 - motionlow / 100)
            ) * (illmlow / 100);

        uiSetTextBoxValue(objParts[uiIndexMaxKbpsH264Vbr], Math.ceil(maxBitrate), 1);
        uiSetTextBoxValue(objParts[uiIndexAvgKbpsH264Vbr], Math.ceil(avgBitrate), 1);
    }
}



function uiCheckH264CamUpperBitrate(no) {
    var objParts = new Array();
    var upperBitrate = 0;

    uiGetH264VbrObject(no, objParts);

    var model = Number(objParts[uiIndexModelH264Vbr].options[objParts[uiIndexModelH264Vbr].selectedIndex].value);
    var reso = Number(objParts[uiIndexResoH264Vbr].options[objParts[uiIndexResoH264Vbr].selectedIndex].value);
    var fps = Number(objParts[uiIndexFpsH264Vbr].options[objParts[uiIndexFpsH264Vbr].selectedIndex].value);

    if ((model == camKind_H264Vbr_EX_Next_2M_U2) ||
        (model == camKind_H264Vbr_EX_Next_2M_S) || 
        (model == camKind_H264Vbr_EX_NextPTZ_2M_S) || 
        (model == camKind_H264Vbr_EX_NextPTZ_2M_X) || 
        (model == camKind_H264Vbr_EX_Next_Bullet_2M_S) ||
        (model == camKind_H264Vbr_EX_Next_2M_U3) ||
        (model == camKind_H264Vbr_EX_Next_2M_U4)) {

        if (reso == camReso_H264Vbr_EX_2M_FHD) {
            upperBitrate = 24576;
        } else if ((reso == camReso_H264Vbr_EX_2M_HD) || (reso == camReso_H264Vbr_EX_2M_HVGAW)) {
            upperBitrate = 12288;
        }
    }
    else if (model == camKind_H264Vbr_EX_Next_4K_U) {
        if ((reso == camReso_H264Vbr_EX_U_4K_3840x2160) || (reso == camReso_H264Vbr_EX_U_4K_2560x1440) || (reso == camReso_H264Vbr_EX_U_4K_FHD)) {
            upperBitrate = 24576;
        } else if (reso == camReso_H264Vbr_EX_U_4K_HD) {
            upperBitrate = 12288;
        }
    }
    else if ((model == camKind_H264Vbr_EX_Next_5M_U) || (model == camKind_H264Vbr_EX_Next_5M_U2) || (model == camKind_H264Vbr_EX_Next_5M_U3)) {
        if ((reso == camReso_H264Vbr_EX_U_5M_2560x1440) || (reso == camReso_H264Vbr_EX_U_5M_FHD) || (reso == camKind_H264Vbr_EX_Next_5M_U2) || (reso == camKind_H264Vbr_EX_Next_5M_U3)) {
            upperBitrate = 24576;
        } else if (reso == camReso_H264Vbr_EX_U_5M_HD) {
            upperBitrate = 12288;
        }
    }
    else if (model == camKind_H264Vbr_EX_Next_Bullet_5M_S) {
        if ((reso == camReso_H264Vbr_EX_5M_3072x1728) || (reso == camReso_H264Vbr_EX_5M_2560x1440)) {
            upperBitrate = 24576;
        }
    }
    else if (model == camKind_H264Vbr_EX_Next_4M_S) {
        if ((reso == camReso_H264Vbr_EX_4M_2688x1520) || (reso == camReso_H264Vbr_EX_4M_2560x1440) || (reso == camReso_H264Vbr_EX_4M_FHD)) {
            upperBitrate = 24576;
        } else if (reso == camReso_H264Vbr_EX_4M_HD) {
            upperBitrate = 12288;
        }
    }
    else if ((model == camKind_H264Vbr_EX_NextPTZ_6M_S) ||
             (model == camKind_H264Vbr_EX_NextPTZ_6M2_S)) {
        if ((reso == camReso_H264Vbr_EX_PTZ_6M_3328x1872) || (reso == camReso_H264Vbr_EX_PTZ_6M_2560x1440)) {
            upperBitrate = 24576;
        }
    }
    else if ((model == camKind_H264Vbr_EX_NextPTZ_4K_S) ||
             (model == camKind_H264Vbr_EX_NextPTZ_4K_X) ||
             (model == camKind_H264Vbr_EX_Next_Bullet_4K_S) ||
             (model == camKind_H264Vbr_EX_NextPTZ_4K2_S)) {
        if ((reso == camReso_H264Vbr_EX_PTZ_4K_3840x2160) || (reso == camReso_H264Vbr_EX_PTZ_4K_2560x1440)) {
            upperBitrate = 24576;
        }
    }
    else if (model == camKind_H264Vbr_EX_Next_2M_U) {
        if (reso == camReso_H264Vbr_EX_U_2M_FHD) {
            upperBitrate = 24576;
        } else if ((reso == camReso_H264Vbr_EX_U_2M_HD) || (reso == camReso_H264Vbr_EX_U_2M_HVGAW)) {
            upperBitrate = 12288;
        }
    }
    else if (model == camKind_H264Vbr_EX_Next_4M_U) {
        if ((reso == camReso_H264Vbr_EX_U_4M_2560x1440) || (reso == camReso_H264Vbr_EX_U_4M_FHD)) {
            upperBitrate = 24576;
        } else if (reso == camReso_H264Vbr_EX_U_4M_HD) {
            upperBitrate = 12288;
        }
    }
    else if (model == camKind_H264Vbr_EX_Next_2M_X) {
        if (reso == camReso_H264Vbr_EX_X_2M_FHD) {
            upperBitrate = 24576;
        } else if ((reso == camReso_H264Vbr_EX_X_2M_HD) || (reso == camReso_H264Vbr_EX_X_2M_HVGAW)) {
            upperBitrate = 12288;
        }
    }
    else if (model == camKind_H264Vbr_EX_Next_5M_X) {
        if ((reso == camReso_H264Vbr_EX_X_5M_3072x1728) || (reso == camReso_H264Vbr_EX_X_5M_2560x1440) || (reso == camReso_H264Vbr_EX_X_5M_FHD)) {
            upperBitrate = 24576;
        } else if ((reso == camReso_H264Vbr_EX_X_5M_HD)) {
            upperBitrate = 12288;
        }
    }
    else if (model == camKind_H264Vbr_EX_Next_6M_X) {
        if ((reso == camReso_H264Vbr_EX_X_6M_3328x1872) || (reso == camReso_H264Vbr_EX_X_6M_2560x1440) || (reso == camReso_H264Vbr_EX_X_6M_FHD)) {
            upperBitrate = 24576;
        } else if ((reso == camReso_H264Vbr_EX_X_6M_HD)) {
            upperBitrate = 12288;
        }
    }
    else if (model == camKind_H264Vbr_EX_Next_4K_X) {
        if ((reso == camReso_H264Vbr_EX_X_4K_3840x2160) || (reso == camReso_H264Vbr_EX_X_4K_2560x1440) || (reso == camReso_H264Vbr_EX_X_4K_FHD)) {
            upperBitrate = 24576;
        } else if ((reso == camReso_H264Vbr_EX_X_4K_HD)) {
            upperBitrate = 12288;
        }
    }
    else if (model == camKind_H264Vbr_EX_Next_5M_XCnr) {
        if ((reso == camReso_H264Vbr_EX_XCnr_5M_3072x1728) || (reso == camReso_H264Vbr_EX_XCnr_5M_2560x1440)) {
            upperBitrate = 24576;
        }
    }
    else if ((model == camKind_H264Vbr_NextPTZ_S) || (model == camKind_H264Vbr_NextPTZ_U) || (model == camKind_H264Vbr_NextPT_S) || (model == camKind_H264Vbr_EX_AIMS_X_PTZ)) {
        if (reso == camReso_H264Vbr_EX_PTZ_FHD) {
            upperBitrate = 24576;
        } else if ((reso == camReso_H264Vbr_EX_PTZ_HD) || (reso == camReso_H264Vbr_EX_PTZ_HVGAW)) {
            upperBitrate = 12288;
        }
    }
    else if (model == camKind_H264Vbr_Next5MPTZ_S) {
        if ((reso == camReso_H264Vbr_EX_5MPTZ_5M) || (reso == camReso_H264Vbr_EX_5MPTZ_WQHD)) {
            upperBitrate = 24576;
        }
    }
    else if ((model == camKind_H264Vbr_EX_AIMS) || (model == camKind_H264Vbr_EX_AIMS_U)) {
        if ((reso == camReso_H264Vbr_EX_AIMS_4M) || (reso == camReso_H264Vbr_EX_AIMS_WQHD) || (reso == camReso_H264Vbr_EX_AIMS_FHD)) {
            upperBitrate = 24576;
        }
    }
    else if (model == camKind_H264Vbr_EX_AIMS_4K) {
        if ((reso == camReso_H264Vbr_EX_4KAIMS_3840x2160) || (reso == camReso_H264Vbr_EX_4KAIMS_WQHD) || (reso == camReso_H264Vbr_EX_4KAIMS_FHD)) {
            upperBitrate = 24576;
        }
    }
    else if (model == camKind_H264Vbr_EX_AIMS_X) {
        if ((reso == camReso_H264Vbr_EX_PTZMS_3072x1728) || (reso == camReso_H264Vbr_EX_PTZMS_WQHD) || (reso == camReso_H264Vbr_EX_PTZMS_FHD)) {
            upperBitrate = 24576;
        }
    }
    else if (model == camKind_H264Vbr_EX_4K_5M6M) {
        if ((reso == camReso_H264Vbr_EX_4K_5M6M_3072x2304) || (reso == camReso_H264Vbr_EX_4K_5M6M_2560x1920) || (reso == camReso_H264Vbr_EX_4K_5M6M_3840x2160) || (reso == camReso_H264Vbr_EX_4K_5M6M_3328x1872) || (reso == camReso_H264Vbr_EX_4K_5M6M_3072x1728) || (reso == camReso_H264Vbr_EX_4K_5M6M_2560x1440)) {
            upperBitrate = 24576;
        }
    }
    else if (model == camKind_H264Vbr_EX_IPROMINI) {
        if ((reso == camReso_H264Vbr_EX_IPROMINI_2048x1536) || (reso == camReso_H264Vbr_EX_IPROMINI_FHD)) {
            upperBitrate = 24576;
        } else if ((reso == camReso_H264Vbr_EX_IPROMINI_SXVGA) || (reso == camReso_H264Vbr_EX_IPROMINI_VGA) || (reso == camReso_H264Vbr_EX_IPROMINI_HD) || (reso == camReso_H264Vbr_EX_IPROMINI_HVGAW)) {
            upperBitrate = 12288;
        }
    }
    else if (model == camKind_H264Vbr_NextS) {
        if (reso == 0){
            upperBitrate = 24576;
        } else if (reso == 1) {
            upperBitrate = 12288;
        } else if (reso == 2) {
            upperBitrate = 12288;
        }
    }
    else if ((model == camKind_H264Vbr_EX1) || (model == camKind_H264Vbr_EX2) || (model == camKind_H264Vbr_EX3)) {
        if ((reso == 0) || (reso == 1) || (reso == 2) || (reso == 6) ||
            (reso == 7) || (reso == 8)) {
            upperBitrate = 24576;
        } else if ((reso == 3) || (reso == 4) || (reso == 5) || (reso == 10)) {
            upperBitrate = 12288;
        } else if (reso == 9) {
            if (fps == 6) {
                upperBitrate = 24576;
            } else {
                upperBitrate = 12288;
            }
        }
    } else if (model == camKind_H264Vbr_EX_4K) {
        if ((reso == 0) || (reso == 1) || (reso == 2)) {
            upperBitrate = 24576;
        } else if ((reso == 3) || (reso == 4)) {
            upperBitrate = 12288;
        }
    } else if ((model == camKind_H264Vbr_EX_9M) || (model == camKind_H264Vbr_EX_AI360)){
        if ((reso == 0) || (reso == 1) || (reso == 2) || (reso == 6) || (reso == 7) ||
            (reso == 10) || (reso == 11)) {
            upperBitrate = 24576;
        } else if ((reso == 3) || (reso == 4) || (reso == 5) || (reso == 8) ||
                   (reso == 9) || (reso == 12)) {
            upperBitrate = 12288;
        }
    } else if (model == camKind_H264Vbr_EX_AIMS_30ips) {
        if ((reso == camReso_H264Vbr_EX_AIMS_30IPS_2688x1520) || (reso == camReso_H264Vbr_EX_AIMS_30IPS_2560x1440) || (reso == camReso_H264Vbr_EX_AIMS_30IPS_FHD)) {
            upperBitrate = 24576;
        }
    } else if (model == camKind_H264Vbr_EX_AIMS_15ips) {
        if ((reso == camReso_H264Vbr_EX_AIMS_15IPS_3840x2160) || (reso == camReso_H264Vbr_EX_AIMS_15IPS_3328x1872) || (reso == camReso_H264Vbr_EX_AIMS_15IPS_2560x1440) || (reso == camReso_H264Vbr_EX_AIMS_15IPS_FHD)) {
            upperBitrate = 24576;
        }
    } else if (model == camKind_H264Vbr_EX_MS) {
        if ((reso == 0) || (reso == 2) || (reso == 3) || (reso == 4)) {
            upperBitrate = 24576;
        } else if ((reso == 1) || (reso == 5)) {
            upperBitrate = 12288;
        }
    } else if (model == camKind_H264Vbr_EX_AI || model == camKind_H264Vbr_EX_AI_4K ) {
        upperBitrate = 24576;
    } else if (model == camKind_H264Vbr_S2) {
        upperBitrate = 40960;
    } else if (model == camKind_H264Vbr_4K) {
        upperBitrate = 40960;
    } else if (model == camKind_H264Vbr_9M) {
        upperBitrate = 30720;
    } else if ((model == camKind_H264Vbr_EX_U) || (model == camKind_H264Vbr_EX_MIC_U)) {
        switch(reso) {
            case 0: 
                upperBitrate = 24576;
                break;
            case 1: 
                upperBitrate = 12288;
                break;
            case 2: 
                upperBitrate = 12288;
                break;
            case 3: 
                upperBitrate = 24576;
                break;
            case 4: 
                upperBitrate = 24576;
                break;
            case 5: 
                upperBitrate = 12288;
                break;
            case 6: 
                upperBitrate = 12288;
                break;
            default:
                break;
        }
    } else {

    }

    if (upperBitrate == 40960) {
        if (Number(objParts[uiIndexMaxKbpsH264Vbr].value) > 40960) {
            $(objParts[uiIndexMaxKbpsH264Vbr]).removeClass('outputNumStyle');
            $(objParts[uiIndexMaxKbpsH264Vbr]).addClass('outputNumStyleAlert');
            uiMsgDialogPopup(CAMUPPERBITRATEOVER, ALARTMSGMODE);
            return false;
        } else {
            $(objParts[uiIndexMaxKbpsH264Vbr]).removeClass('outputNumStyleAlert');
            $(objParts[uiIndexMaxKbpsH264Vbr]).addClass('outputNumStyle');
        }
    } else if (upperBitrate == 30720) {
        if (Number(objParts[uiIndexMaxKbpsH264Vbr].value) > 30720) {
            $(objParts[uiIndexMaxKbpsH264Vbr]).removeClass('outputNumStyle');
            $(objParts[uiIndexMaxKbpsH264Vbr]).addClass('outputNumStyleAlert');
            uiMsgDialogPopup(CAMUPPERBITRATEOVER, ALARTMSGMODE);
            return false;
        } else {
            $(objParts[uiIndexMaxKbpsH264Vbr]).removeClass('outputNumStyleAlert');
            $(objParts[uiIndexMaxKbpsH264Vbr]).addClass('outputNumStyle');
        }
    } else if (upperBitrate == 24576) {
        if (Number(objParts[uiIndexMaxKbpsH264Vbr].value) > 24576) {
            $(objParts[uiIndexMaxKbpsH264Vbr]).removeClass('outputNumStyle');
            $(objParts[uiIndexMaxKbpsH264Vbr]).addClass('outputNumStyleAlert');
            uiMsgDialogPopup(CAMUPPERBITRATEOVER, ALARTMSGMODE);
            return false;
        } else {
            $(objParts[uiIndexMaxKbpsH264Vbr]).removeClass('outputNumStyleAlert');
            $(objParts[uiIndexMaxKbpsH264Vbr]).addClass('outputNumStyle');
        }
    } else if (upperBitrate == 12288) {
        if (Number(objParts[uiIndexMaxKbpsH264Vbr].value) > 12288) {
            $(objParts[uiIndexMaxKbpsH264Vbr]).removeClass('outputNumStyle');
            $(objParts[uiIndexMaxKbpsH264Vbr]).addClass('outputNumStyleAlert');
            uiMsgDialogPopup(CAMUPPERBITRATEOVER, ALARTMSGMODE);
            return false;
        } else {
            $(objParts[uiIndexMaxKbpsH264Vbr]).removeClass('outputNumStyleAlert');
            $(objParts[uiIndexMaxKbpsH264Vbr]).addClass('outputNumStyle');
        }
    } else {
        $(objParts[uiIndexMaxKbpsH264Vbr]).removeClass('outputNumStyleAlert');
        $(objParts[uiIndexMaxKbpsH264Vbr]).addClass('outputNumStyle');
        $(objParts[uiIndexAvgKbpsH264Vbr]).removeClass('outputNumStyleAlert');
        $(objParts[uiIndexAvgKbpsH264Vbr]).addClass('outputNumStyle');
    }
    return true;
}


function uiGetH264VbrObject(no, partsObj) {
    switch (no) {
        case '1' :
            partsObj[uiIndexCamNumH264Vbr] = frmNWDR.txtCamNumH264Vbr_1;
            partsObj[uiIndexModelH264Vbr] = frmNWDR.selModelH264Vbr_1;
            partsObj[uiIndexResoH264Vbr] = frmNWDR.selResoH264Vbr_1;
            partsObj[uiIndexQualH264Vbr] = frmNWDR.selQualH264Vbr_1;
            partsObj[uiIndexFpsH264Vbr] = frmNWDR.selFpsH264Vbr_1;
            partsObj[uiIndexSceneLocationH264Vbr] = frmNWDR.selSceneLocationH264Vbr_1;
            partsObj[uiIndex_s_scene_gopcontrol_1_h264] = txt_s_scene_gopcontrol_1_h264_1;
            partsObj[uiIndex_s_scene_gopcontrol_2_h264] = txt_s_scene_gopcontrol_2_h264_1;
            partsObj[uiIndexSceneGopControlH264Vbr] = frmNWDR.selSceneGopControlH264Vbr_1;
            partsObj[uiIndex_s_scene_smartfacialcoding_h264] = txt_s_scene_smartfacialcoding_h264_1;
            partsObj[uiIndex_s_scene_smartfacialcoding_h264_ai] = txt_s_scene_smartfacialcoding_h264_ai_1;
            partsObj[uiIndex_s_scene_smartcoding_viqs_h264] = txt_s_scene_smartfacialcoding_h264_viqs_1;
            partsObj[uiIndexSceneSmartFacialCodingH264Vbr] = frmNWDR.selSceneSmartFacialCodingH264Vbr_1;
            partsObj[uiIndexSceneIllumNormalH264Vbr] = frmNWDR.selSceneIllumNormalH264Vbr_1;
            partsObj[uiIndexSceneIllumLowH264Vbr] = frmNWDR.selSceneIllumLowH264Vbr_1;
            partsObj[uiIndexSceneMotionNormalH264Vbr] = frmNWDR.selSceneMotionNormalH264Vbr_1;
            partsObj[uiIndexSceneMotionLowH264Vbr] = frmNWDR.selSceneMotionLowH264Vbr_1;
            partsObj[uiIndexSceneIllumNormalHourH264Vbr] = txt_s_scene_illum_h264_normal_hour_1;
            partsObj[uiIndexSceneMotionNormalHourH264Vbr] = txt_s_scene_motion_h264_normal_hour_1;
            partsObj[uiIndexSceneIllumLowHourH264Vbr] = txt_s_scene_illum_h264_low_hour_1;
            partsObj[uiIndexSceneMotionLowHourH264Vbr] = txt_s_scene_motion_h264_low_hour_1;
            partsObj[uiIndexSceneImageNormalH264Vbr] = frmNWDR.img_h264vbr_scene_normal_1;
            partsObj[uiIndexSceneImageLowH264Vbr] = frmNWDR.img_h264vbr_scene_low_1;
            partsObj[uiIndexMaxKbpsH264Vbr] = frmNWDR.selMaxKbpsH264Vbr_1;
            partsObj[uiIndexAvgKbpsH264Vbr] = frmNWDR.selAvgKbpsH264Vbr_1;
            partsObj[uiIndexCompkindH264Vbr] = frmNWDR.selCompkindVbr;
            partsObj[uiIndexSceneSmartCodingPicSkipH264Vbr] = frmNWDR.selSceneSmartCodingPicSkipH264Vbr_1;
            partsObj[uiIndexSceneSmartCodingNewSH264Vbr] = frmNWDR.selSceneSmartCodingNewSH264Vbr_1;
            break;

        case '2' :
            partsObj[uiIndexCamNumH264Vbr] = frmNWDR.txtCamNumH264Vbr_2;
            partsObj[uiIndexModelH264Vbr] = frmNWDR.selModelH264Vbr_2;
            partsObj[uiIndexResoH264Vbr] = frmNWDR.selResoH264Vbr_2;
            partsObj[uiIndexQualH264Vbr] = frmNWDR.selQualH264Vbr_2;
            partsObj[uiIndexFpsH264Vbr] = frmNWDR.selFpsH264Vbr_2;
            partsObj[uiIndexSceneLocationH264Vbr] = frmNWDR.selSceneLocationH264Vbr_2;
            partsObj[uiIndex_s_scene_gopcontrol_1_h264] = txt_s_scene_gopcontrol_1_h264_2;
            partsObj[uiIndex_s_scene_gopcontrol_2_h264] = txt_s_scene_gopcontrol_2_h264_2;
            partsObj[uiIndexSceneGopControlH264Vbr] = frmNWDR.selSceneGopControlH264Vbr_2;
            partsObj[uiIndex_s_scene_smartfacialcoding_h264] = txt_s_scene_smartfacialcoding_h264_2;
            partsObj[uiIndex_s_scene_smartfacialcoding_h264_ai] = txt_s_scene_smartfacialcoding_h264_ai_2;
            partsObj[uiIndex_s_scene_smartcoding_viqs_h264] = txt_s_scene_smartfacialcoding_h264_viqs_2;
            partsObj[uiIndexSceneSmartFacialCodingH264Vbr] = frmNWDR.selSceneSmartFacialCodingH264Vbr_2;
            partsObj[uiIndexSceneIllumNormalH264Vbr] = frmNWDR.selSceneIllumNormalH264Vbr_2;
            partsObj[uiIndexSceneIllumLowH264Vbr] = frmNWDR.selSceneIllumLowH264Vbr_2;
            partsObj[uiIndexSceneMotionNormalH264Vbr] = frmNWDR.selSceneMotionNormalH264Vbr_2;
            partsObj[uiIndexSceneMotionLowH264Vbr] = frmNWDR.selSceneMotionLowH264Vbr_2;
            partsObj[uiIndexSceneIllumNormalHourH264Vbr] = txt_s_scene_illum_h264_normal_hour_2;
            partsObj[uiIndexSceneMotionNormalHourH264Vbr] = txt_s_scene_motion_h264_normal_hour_2;
            partsObj[uiIndexSceneIllumLowHourH264Vbr] = txt_s_scene_illum_h264_low_hour_2;
            partsObj[uiIndexSceneMotionLowHourH264Vbr] = txt_s_scene_motion_h264_low_hour_2;
            partsObj[uiIndexSceneImageNormalH264Vbr] = frmNWDR.img_h264vbr_scene_normal_2;
            partsObj[uiIndexSceneImageLowH264Vbr] = frmNWDR.img_h264vbr_scene_low_2;
            partsObj[uiIndexMaxKbpsH264Vbr] = frmNWDR.selMaxKbpsH264Vbr_2;
            partsObj[uiIndexAvgKbpsH264Vbr] = frmNWDR.selAvgKbpsH264Vbr_2;
            partsObj[uiIndexSceneSmartCodingPicSkipH264Vbr] = frmNWDR.selSceneSmartCodingPicSkipH264Vbr_2;
            partsObj[uiIndexSceneSmartCodingNewSH264Vbr] = frmNWDR.selSceneSmartCodingNewSH264Vbr_2;
            break;

        case '3' :
            partsObj[uiIndexCamNumH264Vbr] = frmNWDR.txtCamNumH264Vbr_3;
            partsObj[uiIndexModelH264Vbr] = frmNWDR.selModelH264Vbr_3;
            partsObj[uiIndexResoH264Vbr] = frmNWDR.selResoH264Vbr_3;
            partsObj[uiIndexQualH264Vbr] = frmNWDR.selQualH264Vbr_3;
            partsObj[uiIndexFpsH264Vbr] = frmNWDR.selFpsH264Vbr_3;
            partsObj[uiIndexSceneLocationH264Vbr] = frmNWDR.selSceneLocationH264Vbr_3;
            partsObj[uiIndex_s_scene_gopcontrol_1_h264] = txt_s_scene_gopcontrol_1_h264_3;
            partsObj[uiIndex_s_scene_gopcontrol_2_h264] = txt_s_scene_gopcontrol_2_h264_3;
            partsObj[uiIndexSceneGopControlH264Vbr] = frmNWDR.selSceneGopControlH264Vbr_3;
            partsObj[uiIndex_s_scene_smartfacialcoding_h264] = txt_s_scene_smartfacialcoding_h264_3;
            partsObj[uiIndex_s_scene_smartfacialcoding_h264_ai] = txt_s_scene_smartfacialcoding_h264_ai_3;
            partsObj[uiIndex_s_scene_smartcoding_viqs_h264] = txt_s_scene_smartfacialcoding_h264_viqs_3;
            partsObj[uiIndexSceneSmartFacialCodingH264Vbr] = frmNWDR.selSceneSmartFacialCodingH264Vbr_3;
            partsObj[uiIndexSceneIllumNormalH264Vbr] = frmNWDR.selSceneIllumNormalH264Vbr_3;
            partsObj[uiIndexSceneIllumLowH264Vbr] = frmNWDR.selSceneIllumLowH264Vbr_3;
            partsObj[uiIndexSceneMotionNormalH264Vbr] = frmNWDR.selSceneMotionNormalH264Vbr_3;
            partsObj[uiIndexSceneMotionLowH264Vbr] = frmNWDR.selSceneMotionLowH264Vbr_3;
            partsObj[uiIndexSceneIllumNormalHourH264Vbr] = txt_s_scene_illum_h264_normal_hour_3;
            partsObj[uiIndexSceneMotionNormalHourH264Vbr] = txt_s_scene_motion_h264_normal_hour_3;
            partsObj[uiIndexSceneIllumLowHourH264Vbr] = txt_s_scene_illum_h264_low_hour_3;
            partsObj[uiIndexSceneMotionLowHourH264Vbr] = txt_s_scene_motion_h264_low_hour_3;
            partsObj[uiIndexSceneImageNormalH264Vbr] = frmNWDR.img_h264vbr_scene_normal_3;
            partsObj[uiIndexSceneImageLowH264Vbr] = frmNWDR.img_h264vbr_scene_low_3;
            partsObj[uiIndexMaxKbpsH264Vbr] = frmNWDR.selMaxKbpsH264Vbr_3;
            partsObj[uiIndexAvgKbpsH264Vbr] = frmNWDR.selAvgKbpsH264Vbr_3;
            partsObj[uiIndexSceneSmartCodingPicSkipH264Vbr] = frmNWDR.selSceneSmartCodingPicSkipH264Vbr_3;
            partsObj[uiIndexSceneSmartCodingNewSH264Vbr] = frmNWDR.selSceneSmartCodingNewSH264Vbr_3;
            break;
    }
}


function uiSelectListBoxValue(obj, value, defvalue) {
    var listLength = obj.length;
    for (var idx = 0; idx < listLength; idx++) {
        if (value == Number(obj.options[idx].value)) {
            obj.selectedIndex = idx;
            return;
        }
    }

    if (value != defvalue) {
        uiSelectListBoxValue(obj, defvalue, defvalue);
    }
}


function uiSelectListBoxText(obj, text, deftext) {
    var listLength = obj.length;
    for (var idx = 0; idx < listLength; idx++) {
        if (text == obj.options[idx].text) {
            obj.selectedIndex = idx;
            return;
        }
    }

    if (text != deftext) {
        uiSelectListBoxText(obj, deftext, deftext);
    }
}


function uiSetTextBoxValue(obj, value, valid) {
    if (0 == valid) {
        $(obj).removeClass('outputNumStyle');
        $(obj).addClass('outputNumStyleInvalid');
    }
    else
    {
        $(obj).removeClass('outputNumStyleInvalid');
        $(obj).addClass('outputNumStyle');
    }

    obj.value = value;
}

function IsH265Exstreme(model) {
    if (model < camKind_H264Vbr_S2) {
        return true;
    }
    return false;
}
