var uiIndexCamNumH265Vbr = 0;
var uiIndexModelH265Vbr = 1;
var uiIndexResoH265Vbr = 2;
var uiIndexQualH265Vbr = 3;
var uiIndexFpsH265Vbr = 4;
var uiIndexSceneLocationH265Vbr = 5;
var uiIndexSceneSmartCodingH265Vbr = 6;
var uiIndex_scene_smartcoding_face_h265_1 = 7;
var uiIndex_scene_smartcoding_viqs_h265_1 = 8;
var uiIndex_scene_smartcoding_aiface_h265_1 = 9;
var uiIndexSceneSmartCodingFaceH265Vbr = 10;
var uiIndexSceneSmartCodingPicSkipH265Vbr = 11;
var uiIndexSceneIllumNormalH265Vbr = 12;
var uiIndexSceneIllumLowH265Vbr = 13;
var uiIndexSceneMotionNormalH265Vbr = 14;
var uiIndexSceneMotionLowH265Vbr = 15;
var uiIndexSceneIllumNormalHourH265Vbr = 16;
var uiIndexSceneMotionNormalHourH265Vbr = 17;
var uiIndexSceneIllumLowHourH265Vbr = 18;
var uiIndexSceneMotionLowHourH265Vbr = 19;
var uiIndexSceneImageNormalH265Vbr = 20;
var uiIndexSceneImageLowH265Vbr = 21;
var uiIndexAvgKbpsH265Vbr = 22;
var uiIndexMaxKbpsH265Vbr = 23;
var uiIndexCompkindH265Vbr = 24;
var uiIndexSceneSmartCodingNewSH265Vbr = 25;

function uiInitloadH265Vbr() {
    uiInitH265Vbr('1', camKind_H265Vbr_EX_Next_4K_U, null);
    uiInitH265Vbr('2', camKind_H265Vbr_EX_Next_2M_U2, null);
    uiInitH265Vbr('3', camKind_H265Vbr_EX_Next_5M_U, null);
}


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

    uiGetH265VbrObject(no, objParts);

    var model = objParts[uiIndexModelH265Vbr].selectedIndex;
    var fps = Number(objParts[uiIndexFpsH265Vbr].options[objParts[uiIndexFpsH265Vbr].selectedIndex].text);

    uiSetH265VbrFpsText(no, model, fps);
}



function uiChangeCompkindVbr(compkind) {
    gReload_flg = 1;

    if (compkind != COMPKIND_H264) {
        uiSetH265VbrCompkind();
        gCompkind = COMPKIND_H265;
    } else {
        uiSetH264VbrCompkind();
        gCompkind = COMPKIND_H264;
    }
}


function uiCheck_Compkind() {
    if (gReload_flg != 0) {
        if (gCompkind != COMPKIND_H264) {
            uiInitH265VbrCompkind();
        } else {
            uiInitH264VbrCompkind();
        }
    }
    gReload_flg = 0;
    gCompkind = 0;
}

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

    uiGetH265VbrObject('1', objParts);

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


function uiInitH265Vbr(no, model, reso) {
    uiSetH265VbrModel(no, model);
    reso = uiSetH265VbrResoValue(no, model, reso);
    var qual = uiSetH265VbrQualIndex(no, null);
    var fps = uiSetH265VbrFpsIndex(no, model, null);
    var location = uiSetH265VbrLocationIndex(no, model, null);
    uiChangeH265VbrSampleImage(no);
    var smartcoding = uiSetH265VbrSmartCoding(no, null);
    var smartcoding = uiSetH265VbrSmartCodingFace(no, model, null, smartcoding);
    var smartpicskip = uiSetH265VbrSmartCodingPicSkip(no, model);
    var illumnormal = uiSetH265VbrIllumPercentage(no, null);
    uiChangeH265VbrIllumPercentage(no);
    var motionnormal = uiSetH265VbrIllumMotionNormalPercentage(no, null);
    var motionlow = uiSetH265VbrIllumMotionLowPercentage(no, null);
    uiChangeH265VbrTimeAllocation(no);
    uiChangeH265VbrBitrate(no, model);
}


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

    uiGetH265VbrObject(no, objParts);

    var model = objParts[uiIndexModelH265Vbr].selectedIndex;
    var reso = objParts[uiIndexResoH265Vbr].options[objParts[uiIndexResoH265Vbr].selectedIndex].text;
    var qual = Number(objParts[uiIndexQualH265Vbr].options[objParts[uiIndexQualH265Vbr].selectedIndex].value);
    var fps = Number(objParts[uiIndexFpsH265Vbr].options[objParts[uiIndexFpsH265Vbr].selectedIndex].text);
    var smartcoding = Number(objParts[uiIndexSceneSmartCodingH265Vbr].options[objParts[uiIndexSceneSmartCodingH265Vbr].selectedIndex].value);
    var smartcodingface = Number(objParts[uiIndexSceneSmartCodingFaceH265Vbr].options[objParts[uiIndexSceneSmartCodingFaceH265Vbr].selectedIndex].value);
    var illumnormal = Number(objParts[uiIndexSceneIllumNormalH265Vbr].value);
    var motionnormal = Number(objParts[uiIndexSceneMotionNormalH265Vbr].value);
    var motionlow = Number(objParts[uiIndexSceneMotionLowH265Vbr].value);

    var txt_s_scene_smartcoding_face_id;
    var selSceneSmartFacialCoding_id;
    var txt_s_scene_smartcoding_picskip_id;
    var selSceneSmartCodingPicSkip_id;
    var item_scene_smartcoding_id;
    var item_scene_smartcoding_skip_id;
    var item_scene_smartcoding_news_id;
    switch (no) {
        case '1':
            txt_s_scene_smartcoding_face_id = "txt_s_scene_smartcoding_face_h265_1";
            selSceneSmartFacialCoding_id = "selSceneSmartCodingFaceH265Vbr_1";
            txt_s_scene_smartcoding_picskip_id = "txt_s_scene_smartcoding_picskip_h265_1";
            selSceneSmartCodingPicSkip_id = "selSceneSmartCodingPicSkipH265Vbr_1";

            item_scene_smartcoding_id = "item_scene_smartcoding_h265_1";
            item_scene_smartcoding_skip_id = "item_scene_smartcoding_picskip_h265_1";
            item_scene_smartcoding_news_id = "item_scene_smartcoding_news_h265_1";
            break;
        case '2':
            txt_s_scene_smartcoding_face_id = "txt_s_scene_smartcoding_face_h265_2";
            selSceneSmartFacialCoding_id = "selSceneSmartCodingFaceH265Vbr_2";
            txt_s_scene_smartcoding_picskip_id = "txt_s_scene_smartcoding_picskip_h265_2";
            selSceneSmartCodingPicSkip_id = "selSceneSmartCodingPicSkipH265Vbr_2";

            item_scene_smartcoding_id = "item_scene_smartcoding_h265_2";
            item_scene_smartcoding_skip_id = "item_scene_smartcoding_picskip_h265_2";
            item_scene_smartcoding_news_id = "item_scene_smartcoding_news_h265_2";
            break;
        case '3':
            txt_s_scene_smartcoding_face_id = "txt_s_scene_smartcoding_face_h265_3";
            selSceneSmartFacialCoding_id = "selSceneSmartCodingFaceH265Vbr_3";
            txt_s_scene_smartcoding_picskip_id = "txt_s_scene_smartcoding_picskip_h265_3";
            selSceneSmartCodingPicSkip_id = "selSceneSmartCodingPicSkipH265Vbr_3";

            item_scene_smartcoding_id = "item_scene_smartcoding_h265_3";
            item_scene_smartcoding_skip_id = "item_scene_smartcoding_picskip_h265_3";
            item_scene_smartcoding_news_id = "item_scene_smartcoding_news_h265_3";
            break;
        default:
            txt_s_scene_smartcoding_face_id = "txt_s_scene_smartcoding_face_h265_1";
            selSceneSmartFacialCoding_id = "selSceneSmartCodingFaceH265Vbr_1";
            txt_s_scene_smartcoding_picskip_id = "txt_s_scene_smartcoding_picskip_h265_1";
            selSceneSmartCodingPicSkip_id = "selSceneSmartCodingPicSkipH265Vbr_1";

            item_scene_smartcoding_id = "item_scene_smartcoding_h265_1";
            item_scene_smartcoding_skip_id = "item_scene_smartcoding_picskip_h265_1";
            item_scene_smartcoding_news_id = "item_scene_smartcoding_news_h265_1";
            break;
    }
    var modelname = objParts[uiIndexModelH265Vbr].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 == '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)')) {
        
        document.getElementById(txt_s_scene_smartcoding_face_id).innerText = s_scene_smartviqs;
        document.getElementById(selSceneSmartFacialCoding_id).className = "sCamSmartCordingSettingVbrWidth";
        
        document.getElementById(txt_s_scene_smartcoding_picskip_id).style.display ="block";
        document.getElementById(selSceneSmartCodingPicSkip_id).style.display ="block";

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

        smartcoding = Number(objParts[uiIndexSceneSmartCodingNewSH265Vbr].options[objParts[uiIndexSceneSmartCodingNewSH265Vbr].selectedIndex].value);
    } else {

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

        document.getElementById(txt_s_scene_smartcoding_picskip_id).style.display ="none";
        document.getElementById(selSceneSmartCodingPicSkip_id).style.display ="none";

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

    uiSetH265VbrSmartCoding(no, smartcoding);
    uiSetH265VbrSmartCodingFace(no, model, smartcodingface, smartcoding);

    if (1 == modelchange) {
        uiSetH265VbrResoText(no, model, reso);
        uiSetH265VbrQualIndex(no, qual);
        uiSetH265VbrFpsText(no, model, fps);
        uiSetH265VbrLocationIndex(no, model, null);
        uiSetH265VbrSmartCodingPicSkip(no, model);
        uiSetH265VbrIllumPercentage(no, illumnormal);
        uiSetH265VbrIllumMotionNormalPercentage(no, motionnormal);
        uiSetH265VbrIllumMotionLowPercentage(no, motionlow);
    } else if (2 == modelchange) {
        uiSetH265VbrFpsText(no, model, fps);
    }

    uiChangeH265VbrSampleImage(no);
    uiChangeH265VbrIllumPercentage(no);
    uiChangeH265VbrTimeAllocation(no);
    uiChangeH265VbrBitrate(no, model);
    if (uiCheckH265CamUpperBitrate(no) != true) {
        uiAllResultGrayOut();
        return;
    }

    calcdata();
}


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

    uiGetH265VbrObject(no, objParts);

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


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

    uiGetH265VbrObject(no, objParts);

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


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

    uiGetH265VbrObject(no, objParts);

    objParts[uiIndexResoH265Vbr].length = camInfo_H265Vbr[model][1].length - 1;
    for (var idx = 0; idx < objParts[uiIndexResoH265Vbr].length; idx++) {
        objParts[uiIndexResoH265Vbr].options[idx].value = idx;
        objParts[uiIndexResoH265Vbr].options[idx].text = resoInfo_H265Vbr[camInfo_H265Vbr[model][1][idx + 1]][resoNameH265Vbr];
    }
    if (null == reso) {
        if (no == 2) {
            uiSelectListBoxText(objParts[uiIndexResoH265Vbr], resoInfo_H265Vbr[camReso_H265Vbr_SXVGA][0], resoInfo_H265Vbr[camReso_H265Vbr_FHD][0]);
        } else if (no == 3) {
            uiSelectListBoxText(objParts[uiIndexResoH265Vbr], resoInfo_H265Vbr[camReso_H265Vbr_HD][0], resoInfo_H265Vbr[camReso_H265Vbr_FHD][0]);
        } else {
            uiSelectListBoxText(objParts[uiIndexResoH265Vbr], resoInfo_H265Vbr[camReso_H265Vbr_FHD][0], resoInfo_H265Vbr[camReso_H265Vbr_FHD][0]);
        }
    } else {
        uiSelectListBoxText(objParts[uiIndexResoH265Vbr], resoInfo_H265Vbr[reso][0], resoInfo_H265Vbr[camInfo_H265Vbr[model][1][0]][0]);
    }

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


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

    uiGetH265VbrObject(no, objParts);

    objParts[uiIndexResoH265Vbr].length = camInfo_H265Vbr[model][1].length - 1;
    for (var idx = 0; idx < objParts[uiIndexResoH265Vbr].length; idx++) {
        objParts[uiIndexResoH265Vbr].options[idx].value = idx;
        objParts[uiIndexResoH265Vbr].options[idx].text = resoInfo_H265Vbr[camInfo_H265Vbr[model][1][idx + 1]][resoNameH265Vbr];
    }
    uiSelectListBoxText(objParts[uiIndexResoH265Vbr], reso, resoInfo_H265Vbr[camInfo_H265Vbr[model][1][0]][0]);

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


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

    uiGetH265VbrObject(no, objParts);

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

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


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

    uiGetH265VbrObject(no, objParts);

    var reso = objParts[uiIndexResoH265Vbr].selectedIndex;

    if (null == fps) {
        if (model == camKind_H265Vbr_EX_Next_4K_U) {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
        }
        else if (model == camKind_H265Vbr_EX_Next_2M_U2) {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
        }
        else if (model == camKind_H265Vbr_EX_Next_5M_U) {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
        }
        else if (model == camKind_H265Vbr_EX_Next_Bullet_2M_S) {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
        }
        else if (model == camKind_H265Vbr_EX_Next_Bullet_5M_S) {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
        }
        else if (model == camKind_H265Vbr_EX_Next_Bullet_4K_S) {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
        }
        else if (model == camKind_H265Vbr_EX_NextPTZ_2M_X) {
            if (reso == camReso_H265Vbr_EX_PTZ_HVGAW) {
                objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 2;
            }
            else {
                objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
            }
        }
        else if (model == camKind_H265Vbr_EX_NextPTZ_4K_X) {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
        }
        else if (model == camKind_H265Vbr_EX_Next_2M_S) {
            if (reso == camReso_H265Vbr_EX_PTZ_HVGAW) {
                objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 2;
            }
            else {
                objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
            }
        }
        else if (model == camKind_H265Vbr_EX_Next_2M_X) {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
        }
        else if ((model == camKind_H265Vbr_EX_Next_5M_XCnr) ||
                 (model == camKind_H265Vbr_EX_Next_5M_X) || 
                 (model == camKind_H265Vbr_EX_Next_6M_X) || 
                 (model == camKind_H265Vbr_EX_Next_4K_X) || 
                 (model == camKind_H265Vbr_EX_NextPTZ_2M_S) || 
                 (model == camKind_H265Vbr_EX_NextPTZ_6M_S) || 
                 (model == camKind_H265Vbr_EX_NextPTZ_4K_S) || 
                 (model == camKind_H265Vbr_EX_NextPTZ_6M2_S) || 
                 (model == camKind_H265Vbr_EX_NextPTZ_4K2_S) || 
                 (model == camKind_H265Vbr_EX_Next_4M_S)) {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
        }
        else if ((model == camKind_H265Vbr_EX_Next_2M_U) || (model == camKind_H265Vbr_EX_MIC_U)) {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
            CALC_AUDIOAACLDSELECTED = false;

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

            if (frmNWDR.chkaudio.checked == true) {
                objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 2;
                CALC_AUDIOAACLDSELECTED = true;
            }
        }
        else if ((model == camKind_H265Vbr_NextPTZ_S) || (model == camKind_H265Vbr_NextPTZ_U) || (model == camKind_H265Vbr_NextPT_S) || (model == camKind_H265Vbr_EX_AIMS_X_PTZ)) {
            if (reso == camReso_H265Vbr_EX_PTZ_HVGAW) {
                objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 2;
            }
            else {
                objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
            }
        }
        else if (model == camKind_H265Vbr_Next5MPTZ_S) {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
        }
        else if ((model == camKind_H265Vbr_EX_AIMS) || (model == camKind_H265Vbr_EX_AIMS_U)) {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
        }
        else if (model == camKind_H265Vbr_EX_AIMS_4K) {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
        }
        else if (model == camKind_H265Vbr_EX_AIMS_X) {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
        }
        else if (model == camKind_H265Vbr_EX_4K_5M6M) {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
        }
        else if (model == camKind_H265Vbr_EX_IPROMINI) {
            if (reso == camReso_H265Vbr_EX_IPROMINI_2048x1536) {
                objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 2;
            } else {
                objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
            }
        }
        else if (model == camKind_H265Vbr_NextS) {
            if ((reso == camReso_H265Vbr_EX_FHD) || (reso == camReso_H265Vbr_EX_HD)) {
                objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
            }
            else {
                objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 2;
            }
        }
        else if ((model == camKind_H265Vbr_01) || (model == camKind_H265Vbr_02) || (model == camKind_H265Vbr_03)) {
            if (reso == camReso_H265Vbr_EX_FHD || reso == camReso_H265Vbr_EX_HD) {
                objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
            } else {
                objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 2;
            }
        }
        else if (model == camKind_H265Vbr_EX_4K) {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
        }
        else if (model == camKind_H265Vbr_EX_AI360) {
            if (reso == camReso_H265Vbr_EX_9M_2560x1920 || reso == camReso_H265Vbr_EX_9M_2048x1536 
                || reso == camReso_H265Vbr_EX_9M_2560x1440) {
                objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 2;
            }
            else {
                objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
            }
        }
        else if (model == camKind_H265Vbr_EX_9M) {
            if (reso == camReso_H265Vbr_EX_9M_2560x1920 || reso == camReso_H265Vbr_EX_9M_2048x1536 
                || reso == camReso_H265Vbr_EX_9M_2560x1440) {
                objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 2;
            }
            else {
                objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
            }
        }
        else if (model == camKind_H265Vbr_EX_AIMS_30ips) {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
        }
        else if (model == camKind_H265Vbr_EX_AIMS_15ips) {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
        }
        else if (model == camKind_H265Vbr_EX_MS) {
            if ( reso == camReso_H265Vbr_EX_MS_3840x2160 || reso == camReso_H265Vbr_EX_MS_2560x1440) {
                objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 2;
            }
            else {
                objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
            }
        }
         else if (model == camKind_H265Vbr_EX_AI || model == camKind_H265Vbr_EX_AI_4K) {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
        }

    } else {
        objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
    }
    for (var idx = 0; idx < objParts[uiIndexFpsH265Vbr].length; idx++) {
        objParts[uiIndexFpsH265Vbr].options[idx].value = idx;
        objParts[uiIndexFpsH265Vbr].options[idx].text = fpsInfo_H265Vbr[model][idx + 1];
    }

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

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


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

    uiGetH265VbrObject(no, objParts);

    var reso = objParts[uiIndexResoH265Vbr].selectedIndex;

    if ((model == camKind_H265Vbr_EX_Next_4K_U)) {
        objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
    }
    else if ((model == camKind_H265Vbr_EX_Next_2M_U2)) {
        objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
    }
    else if ((model == camKind_H265Vbr_EX_Next_5M_U)) {
        objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
    }
    else if ((model == camKind_H265Vbr_EX_Next_Bullet_2M_S)) {
        objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
    }
    else if ((model == camKind_H265Vbr_EX_Next_Bullet_5M_S)) {
        objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
    }
    else if ((model == camKind_H265Vbr_EX_Next_Bullet_4K_S)) {
        objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
    }
    else if ((model == camKind_H265Vbr_EX_NextPTZ_2M_X)) {
        if (reso == camReso_H265Vbr_EX_PTZ_HVGAW) {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 2;
        }
        else {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
        }
    }
    else if ((model == camKind_H265Vbr_EX_NextPTZ_4K_X)) {
        objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
    }
    else if ((model == camKind_H265Vbr_EX_Next_2M_S)) {
        if (reso == camReso_H265Vbr_EX_PTZ_HVGAW) {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 2;
        }
        else {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
        }
    }
    else if ((model == camKind_H265Vbr_EX_Next_2M_X)) {
        objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
    }
    else if ((model == camKind_H265Vbr_EX_Next_5M_XCnr) || 
             (model == camKind_H265Vbr_EX_Next_5M_X) || 
             (model == camKind_H265Vbr_EX_Next_6M_X) || 
             (model == camKind_H265Vbr_EX_Next_4K_X) || 
             (model == camKind_H265Vbr_EX_NextPTZ_2M_S) || 
             (model == camKind_H265Vbr_EX_NextPTZ_6M_S) || 
             (model == camKind_H265Vbr_EX_NextPTZ_4K_S) || 
             (model == camKind_H265Vbr_EX_NextPTZ_6M2_S) || 
             (model == camKind_H265Vbr_EX_NextPTZ_4K2_S) || 
             (model == camKind_H265Vbr_EX_Next_4M_S)) {
        objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
    }
    else if ((model == camKind_H265Vbr_EX_Next_2M_U) || (model == camKind_H265Vbr_EX_MIC_U)) {
        objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
        CALC_AUDIOAACLDSELECTED = false;

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

        if (frmNWDR.chkaudio.checked == true) {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 2;
            CALC_AUDIOAACLDSELECTED = true;
        }
    }
    else if ((model == camKind_H265Vbr_NextPTZ_S) || (model == camKind_H265Vbr_NextPTZ_U) || (model == camKind_H265Vbr_NextPT_S) || (model == camKind_H265Vbr_EX_AIMS_X_PTZ)) {
        if (reso == camReso_H265Vbr_EX_PTZ_HVGAW) {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 2;
        }
        else {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
        }
    }
    else if (model == camKind_H265Vbr_Next5MPTZ_S) {
        objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
    }
    else if ((model == camKind_H265Vbr_EX_AIMS) || (model == camKind_H265Vbr_EX_AIMS_U)) {
        objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
    }
    else if (model == camKind_H265Vbr_EX_AIMS_4K) {
        objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
    }
    else if (model == camKind_H265Vbr_EX_AIMS_X) {
        objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
    }
    else if (model == camKind_H265Vbr_EX_4K_5M6M) {
        objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
    }
    else if (model == camKind_H265Vbr_EX_IPROMINI) {
        if (reso == camReso_H265Vbr_EX_IPROMINI_2048x1536) {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 2;
        } else {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
        }
    }
    else if (model == camKind_H265Vbr_NextS) {
        if ((reso == camReso_H265Vbr_EX_FHD) || (reso == camReso_H265Vbr_EX_HD)) {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
        }
        else {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 2;
        }
    }
    else if ((model == camKind_H265Vbr_01) || (model == camKind_H265Vbr_02) || (model == camKind_H265Vbr_03)) {
        if (reso == camReso_H265Vbr_EX_FHD || reso == camReso_H265Vbr_EX_HD) {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
        } else {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 2;
        }
    }
    else if (model == camKind_H265Vbr_EX_4K) {
        objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
    }
    else if (model == camKind_H265Vbr_EX_AI360) {
        if (reso == camReso_H265Vbr_EX_9M_2560x1920 || reso == camReso_H265Vbr_EX_9M_2048x1536
            || reso == camReso_H265Vbr_EX_9M_2560x1440) {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 2;
        }
        else {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
        }
    }
    else if (model == camKind_H265Vbr_EX_9M) {
        if (reso == camReso_H265Vbr_EX_9M_2560x1920 || reso == camReso_H265Vbr_EX_9M_2048x1536
            || reso == camReso_H265Vbr_EX_9M_2560x1440) {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 2;
        }
        else {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
        }
    }
    else if (model == camKind_H265Vbr_EX_AIMS_30ips) {
        objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
    }
    else if (model == camKind_H265Vbr_EX_AIMS_15ips) {
        objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
    }
    else if (model == camKind_H265Vbr_EX_MS) {
        if ( reso == camReso_H265Vbr_EX_AIMS_15IPS_3840x2160 || reso == camReso_H265Vbr_EX_AIMS_15IPS_3328x1872) {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 2;
        }
        else {
            objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
        }
    }
    else if (model == camKind_H265Vbr_EX_U) {
        objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
    }
    else if (model == camKind_H265Vbr_EX_AI || model == camKind_H265Vbr_EX_AI_4K) {
        objParts[uiIndexFpsH265Vbr].length = fpsInfo_H265Vbr[model].length - 1;
    }

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

    uiSelectListBoxText(objParts[uiIndexFpsH265Vbr], fps, fpsInfo_H265Vbr[model][fpsInfo_H265Vbr[model][0] + 1]);

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

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

    uiGetH265VbrObject(no, objParts);

    objParts[uiIndexSceneLocationH265Vbr].length = camSceneInfo_H265Vbr[model].length;
    for (var idx = 0; idx < objParts[uiIndexSceneLocationH265Vbr].length; idx++) {
        objParts[uiIndexSceneLocationH265Vbr].options[idx].value = idx;
        objParts[uiIndexSceneLocationH265Vbr].options[idx].text = camSceneInfo_H265Vbr[model][idx][0];
    }
    if (null == location) {
        if (no == 2) {
            uiSelectListBoxValue(objParts[uiIndexSceneLocationH265Vbr], 4, 4);
        } else if (no == 3) {
            uiSelectListBoxValue(objParts[uiIndexSceneLocationH265Vbr], 1, 1);
        } else {
            uiSelectListBoxValue(objParts[uiIndexSceneLocationH265Vbr], 0, 0);
        }
    } else {
        uiSelectListBoxValue(objParts[uiIndexSceneLocationH265Vbr], location, 0);
    }

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


function uiSetH265VbrSmartCoding(no, smartcodign) {
    var objParts = new Array();

    uiGetH265VbrObject(no, objParts);

    var model = objParts[uiIndexModelH265Vbr].selectedIndex;

    var item_scene_smartcoding_id;
    var item_scene_smartcoding_skip_id;
    var item_scene_smartcoding_news_id;
    var selSceneSmartFacialCoding_id;
    switch (no) {
        case '1':
            item_scene_smartcoding_id = "item_scene_smartcoding_h265_1";
            item_scene_smartcoding_skip_id = "item_scene_smartcoding_picskip_h265_1";
            item_scene_smartcoding_news_id = "item_scene_smartcoding_news_h265_1";
            selSceneSmartFacialCoding_id = "selSceneSmartCodingFaceH265Vbr_1";
            break;
        case '2':
            item_scene_smartcoding_id = "item_scene_smartcoding_h265_2";
            item_scene_smartcoding_skip_id = "item_scene_smartcoding_picskip_h265_2";
            item_scene_smartcoding_news_id = "item_scene_smartcoding_news_h265_2";
            selSceneSmartFacialCoding_id = "selSceneSmartCodingFaceH265Vbr_2";
            break;
        case '3':
            item_scene_smartcoding_id = "item_scene_smartcoding_h265_3";
            item_scene_smartcoding_skip_id = "item_scene_smartcoding_picskip_h265_3";
            item_scene_smartcoding_news_id = "item_scene_smartcoding_news_h265_3";
            selSceneSmartFacialCoding_id = "selSceneSmartCodingFaceH265Vbr_3";
            break;
        default:
            item_scene_smartcoding_id = "item_scene_smartcoding_h265_1";
            item_scene_smartcoding_skip_id = "item_scene_smartcoding_picskip_h265_1";
            item_scene_smartcoding_news_id = "item_scene_smartcoding_news_h265_1";
            selSceneSmartFacialCoding_id = "selSceneSmartCodingFaceH265Vbr_1";
            break;
    }
    var modelname = objParts[uiIndexModelH265Vbr].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 == '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)')) {
 
        document.getElementById(item_scene_smartcoding_id).style.display ="none";
        document.getElementById(item_scene_smartcoding_skip_id).style.display ="table-cell";
        document.getElementById(item_scene_smartcoding_news_id).style.display ="table-cell";
        
        document.getElementById(selSceneSmartFacialCoding_id).className = "sCamSmartCordingSettingVbrWidth";
    } else {
        document.getElementById(item_scene_smartcoding_id).style.display ="table-cell";
        document.getElementById(item_scene_smartcoding_skip_id).style.display ="none";
        document.getElementById(item_scene_smartcoding_news_id).style.display ="none";

        document.getElementById(selSceneSmartFacialCoding_id).className = "sCamSmartFacialCordingSettingVbrWidth";
    }

    objParts[uiIndexSceneSmartCodingH265Vbr].length = camSmartCodingInfo_H265Vbr.length - 1;
    for (var idx = 0; idx < objParts[uiIndexSceneSmartCodingH265Vbr].length; idx++) {
        objParts[uiIndexSceneSmartCodingH265Vbr].options[idx].value = idx;
        objParts[uiIndexSceneSmartCodingH265Vbr].options[idx].text = camSmartCodingInfo_H265Vbr[idx + 1];
    }
    if (null == smartcodign) {
        if ((modelname == 'S854**(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 == 'S856*/S857*(AI Multi-Sensor)')) {
            uiSelectListBoxValue(objParts[uiIndexSceneSmartCodingH265Vbr], 0, 1);
        } else {
            uiSelectListBoxValue(objParts[uiIndexSceneSmartCodingH265Vbr], 1, 1);
		}
    } else {
       uiSelectListBoxValue(objParts[uiIndexSceneSmartCodingH265Vbr], smartcodign, 1);
    }

    objParts[uiIndexSceneSmartCodingNewSH265Vbr].length = camSmartCodingInfo_H265Vbr.length - 1;
    for (var idx = 0; idx < objParts[uiIndexSceneSmartCodingNewSH265Vbr].length; idx++) {
        objParts[uiIndexSceneSmartCodingNewSH265Vbr].options[idx].value = idx;
        objParts[uiIndexSceneSmartCodingNewSH265Vbr].options[idx].text = camSmartCodingInfo_H265Vbr[idx + 1];
    }
    if (null == smartcodign) {
        if ((modelname == 'S854**(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 == 'S856*/S857*(AI Multi-Sensor)')) {
            uiSelectListBoxValue(objParts[uiIndexSceneSmartCodingNewSH265Vbr], 0, 1);
            } else {
                uiSelectListBoxValue(objParts[uiIndexSceneSmartCodingNewSH265Vbr], 1, 1);
            }
    } else {
        uiSelectListBoxValue(objParts[uiIndexSceneSmartCodingNewSH265Vbr], smartcodign, 1);
    }

    if ((modelname == 'S854**(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 == 'S856*/S857*(AI Multi-Sensor)')) {
        return Number(objParts[uiIndexSceneSmartCodingNewSH265Vbr].options[objParts[uiIndexSceneSmartCodingNewSH265Vbr].selectedIndex].value);
	}
    return Number(objParts[uiIndexSceneSmartCodingH265Vbr].options[objParts[uiIndexSceneSmartCodingH265Vbr].selectedIndex].value);
}


function uiSetH265VbrSmartCodingFace(no, model, smartcodignface, smartcoding) {
    var objParts = new Array();

    uiGetH265VbrObject(no, objParts);
    
    var modelidx = objParts[uiIndexModelH265Vbr].selectedIndex;
    var modelname = objParts[uiIndexModelH265Vbr].options[modelidx].text;

    motionLabelNormal = '#txt_s_scene_motion_h265_normal_1';
    motionLabelLow = '#txt_s_scene_motion_h265_low_1';
    aiLabelNormal = '#txt_s_scene_motion_h265_normal_ai_1';
    aiLabelLow = '#txt_s_scene_motion_h265_low_ai_1';
    if (no == 2) {
        motionLabelNormal = '#txt_s_scene_motion_h265_normal_2';
        motionLabelLow = '#txt_s_scene_motion_h265_low_2';
        aiLabelNormal = '#txt_s_scene_motion_h265_normal_ai_2';
        aiLabelLow = '#txt_s_scene_motion_h265_low_ai_2';
    }
    else if (no == 3) {
        motionLabelNormal = '#txt_s_scene_motion_h265_normal_3';
        motionLabelLow = '#txt_s_scene_motion_h265_low_3';
        aiLabelNormal = '#txt_s_scene_motion_h265_normal_ai_3';
        aiLabelLow = '#txt_s_scene_motion_h265_low_ai_3';
    }

    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 == '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)')) {
        objParts[uiIndexSceneSmartCodingFaceH265Vbr].length = camSmartCodingSmartVIQSInfo_H265Vbr.length - 1;
        for (var idx = 0; idx < objParts[uiIndexSceneSmartCodingFaceH265Vbr].length; idx++) {
            objParts[uiIndexSceneSmartCodingFaceH265Vbr].options[idx].value = idx;
            objParts[uiIndexSceneSmartCodingFaceH265Vbr].options[idx].text = camSmartCodingSmartVIQSInfo_H265Vbr[idx + 1];
        }
    } else if (smartcoding == 0) {
        objParts[uiIndexSceneSmartCodingFaceH265Vbr].length = 1;
        objParts[uiIndexSceneSmartCodingFaceH265Vbr].options[0].value = 0;
        objParts[uiIndexSceneSmartCodingFaceH265Vbr].options[0].text = camSmartCodingSmartVIQSInfo_H265Vbr[1];
    } else {
        if ( model == camKind_H265Vbr_EX_MIC_U ) {
            if ((frmNWDR.chkaudio.checked == true) && (document.getElementById('camRecAudio_AACLC').checked == true)) {
                objParts[uiIndexSceneSmartCodingFaceH265Vbr].length = camSmartCodingFaceInfo_H265Vbr.length - 2;
            } else {
                objParts[uiIndexSceneSmartCodingFaceH265Vbr].length = camSmartCodingFaceInfo_H265Vbr.length - 1;
            }
            for (var idx = 0; idx < objParts[uiIndexSceneSmartCodingFaceH265Vbr].length; idx++) {
                objParts[uiIndexSceneSmartCodingFaceH265Vbr].options[idx].value = idx;
                objParts[uiIndexSceneSmartCodingFaceH265Vbr].options[idx].text = camSmartCodingFaceInfo_H265Vbr[idx + 1];
            }
        } else {
            objParts[uiIndexSceneSmartCodingFaceH265Vbr].length = camSmartCodingFaceInfo_H265Vbr.length - 1;
            for (var idx = 0; idx < objParts[uiIndexSceneSmartCodingFaceH265Vbr].length; idx++) {
                objParts[uiIndexSceneSmartCodingFaceH265Vbr].options[idx].value = idx;
                objParts[uiIndexSceneSmartCodingFaceH265Vbr].options[idx].text = camSmartCodingFaceInfo_H265Vbr[idx + 1];
            }
        }
    }

    if (null == smartcodignface) {
       uiSelectListBoxValue(objParts[uiIndexSceneSmartCodingFaceH265Vbr], 1, 1);
    } else {
       uiSelectListBoxValue(objParts[uiIndexSceneSmartCodingFaceH265Vbr], smartcodignface, 1);
    }
    if ((model == camKind_H265Vbr_EX_Next_4K_U) || (model == camKind_H265Vbr_EX_Next_2M_U2) || (model == camKind_H265Vbr_EX_Next_5M_U) || (model == camKind_H264Vbr_EX_Next_2M_S) || (model == camKind_H264Vbr_EX_Next_4M_S) || (model == camKind_H265Vbr_EX_Next_2M_U) || (model == camKind_H264Vbr_EX_Next_4M_U) || (model == camKind_H265Vbr_EX_U) || (model == camKind_H265Vbr_EX_MIC_U) || (model == camKind_H265Vbr_NextPT_S) || (model == camKind_H265Vbr_EX_AI360) || ( model == camKind_H265Vbr_NextPTZ_U)) {
        objParts[uiIndex_scene_smartcoding_face_h265_1].style.display = 'none';
        objParts[uiIndex_scene_smartcoding_viqs_h265_1].style.display = 'block';
        objParts[uiIndex_scene_smartcoding_aiface_h265_1].style.display = 'none';
        $(motionLabelNormal)[0].style.display = 'inline';
        $(motionLabelLow)[0].style.display = 'inline';
        $(aiLabelNormal)[0].style.display = 'none';
        $(aiLabelLow)[0].style.display = 'none';
    }
    else if (model == camKind_H265Vbr_EX_AI || model == camKind_H265Vbr_EX_AI_4K) {
        objParts[uiIndex_scene_smartcoding_face_h265_1].style.display = 'none';
        objParts[uiIndex_scene_smartcoding_viqs_h265_1].style.display = 'none';
        objParts[uiIndex_scene_smartcoding_aiface_h265_1].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_scene_smartcoding_face_h265_1].style.display = 'block';
        objParts[uiIndex_scene_smartcoding_viqs_h265_1].style.display = 'none';
        objParts[uiIndex_scene_smartcoding_aiface_h265_1].style.display = 'none';
        var aaa = $(motionLabelNormal);
        $(motionLabelNormal)[0].style.display = 'inline';
        $(motionLabelLow)[0].style.display = 'inline';
        $(aiLabelNormal)[0].style.display = 'none';
        $(aiLabelLow)[0].style.display = 'none';
    }

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


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

    uiGetH265VbrObject(no, objParts);
    
    var txt_s_scene_smartcoding_face_id;
    var txt_s_scene_smartcoding_picskip_id;
    var selSceneSmartCodingPicSkip_id;
    switch (no) {
        case '1':
            txt_s_scene_smartcoding_face_id = "txt_s_scene_smartcoding_face_h265_1";
            txt_s_scene_smartcoding_picskip_id = "txt_s_scene_smartcoding_picskip_h265_1";
            selSceneSmartCodingPicSkip_id = "selSceneSmartCodingPicSkipH265Vbr_1";
            break;
        case '2':
            txt_s_scene_smartcoding_face_id = "txt_s_scene_smartcoding_face_h265_2";
            txt_s_scene_smartcoding_picskip_id = "txt_s_scene_smartcoding_picskip_h265_2";
            selSceneSmartCodingPicSkip_id = "selSceneSmartCodingPicSkipH265Vbr_2";
            break;
        case '3':
            txt_s_scene_smartcoding_face_id = "txt_s_scene_smartcoding_face_h265_3";
            txt_s_scene_smartcoding_picskip_id = "txt_s_scene_smartcoding_picskip_h265_3";
            selSceneSmartCodingPicSkip_id = "selSceneSmartCodingPicSkipH265Vbr_3";
            break;
        default:
            txt_s_scene_smartcoding_face_id = "txt_s_scene_smartcoding_face_h265_1";
            txt_s_scene_smartcoding_picskip_id = "txt_s_scene_smartcoding_picskip_h265_1";
            selSceneSmartCodingPicSkip_id = "selSceneSmartCodingPicSkipH265Vbr_1";
            break;
    }

    var modelidx = objParts[uiIndexModelH265Vbr].selectedIndex;
    var modelname = objParts[uiIndexModelH265Vbr].options[modelidx].text;

    objParts[uiIndexSceneSmartCodingPicSkipH265Vbr].length = 1;
    objParts[uiIndexSceneSmartCodingPicSkipH265Vbr].options[0].value = 0;
    objParts[uiIndexSceneSmartCodingPicSkipH265Vbr].options[0].text = camSmartCodingSmartPicSkipInfo_H265Vbr[1];


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


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

    uiGetH265VbrObject(no, objParts);

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

    var illumlow = 100 - Number(objParts[uiIndexSceneIllumNormalH265Vbr].value);
    objParts[uiIndexSceneIllumLowH265Vbr].value = illumlow;

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


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

    uiGetH265VbrObject(no, objParts);

    var illumlow = 100 - Number(objParts[uiIndexSceneIllumNormalH265Vbr].value);
    objParts[uiIndexSceneIllumLowH265Vbr].value = illumlow;

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


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

    uiGetH265VbrObject(no, objParts);

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

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


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

    uiGetH265VbrObject(no, objParts);

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

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


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

    uiGetH265VbrObject(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[uiIndexSceneIllumNormalH265Vbr].value) / 100);
    rechours_illum_normal = Math.floor(rechours_illum_normal * 10) / 10;
    objParts[uiIndexSceneIllumNormalHourH265Vbr].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[uiIndexSceneIllumLowHourH265Vbr].innerHTML = rechours_illum_low + '<br>' + s_txtTimeHour;

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

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


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

    uiGetH265VbrObject(no, objParts);

    var model = objParts[uiIndexModelH265Vbr].selectedIndex;
    var location = Number(objParts[uiIndexSceneLocationH265Vbr].options[objParts[uiIndexSceneLocationH265Vbr].selectedIndex].value);

    objParts[uiIndexSceneImageNormalH265Vbr].src = camSceneInfo_H265Vbr[model][location][1][0];
    objParts[uiIndexSceneImageLowH265Vbr].src = camSceneInfo_H265Vbr[model][location][1][1];
}


 function WindowOpen(src, x, y) {
    var Win1 = window.open('', 'subWindow', 'width=' + x + ',height=' + y + '');
    var html_text = '<!DOCTYPE html><html><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><title>Reference Video</title></head><body style="margin: 0; background: black; overflow: hidden;"><iframe width="405" height="228" src="' + src + '" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></body></html>';
    Win1.document.write(html_text);
    Win1.document.close();
}

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

    uiGetH265VbrObject(no, objParts);

    var model = Number(objParts[uiIndexModelH265Vbr].options[objParts[uiIndexModelH265Vbr].selectedIndex].value);
    var location = Number(objParts[uiIndexSceneLocationH265Vbr].options[objParts[uiIndexSceneLocationH265Vbr].selectedIndex].value);

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

    WindowOpen(movieurl, 405, 228);

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

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


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

    uiGetH265VbrObject(no, objParts);

    var model = Number(objParts[uiIndexModelH265Vbr].options[objParts[uiIndexModelH265Vbr].selectedIndex].value);
    var modelname = objParts[uiIndexModelH265Vbr].options[model].text;
    var reso = Number(objParts[uiIndexResoH265Vbr].options[objParts[uiIndexResoH265Vbr].selectedIndex].value);
    var resostr = objParts[uiIndexResoH265Vbr].options[objParts[uiIndexResoH265Vbr].selectedIndex].text;
    var qual = Number(objParts[uiIndexQualH265Vbr].options[objParts[uiIndexQualH265Vbr].selectedIndex].value);
    var fps = Number(objParts[uiIndexFpsH265Vbr].options[objParts[uiIndexFpsH265Vbr].selectedIndex].value);
    var location = Number(objParts[uiIndexSceneLocationH265Vbr].options[objParts[uiIndexSceneLocationH265Vbr].selectedIndex].value);
    var smartcoding =Number(objParts[uiIndexSceneSmartCodingH265Vbr].options[objParts[uiIndexSceneSmartCodingH265Vbr].selectedIndex].value);
    var smartcodingstr =objParts[uiIndexSceneSmartCodingH265Vbr].options[objParts[uiIndexSceneSmartCodingH265Vbr].selectedIndex].text;
    if (smartcoding == 1) {
        smartcoding = smartcoding + 2;
    }
    var smartcodingface =Number(objParts[uiIndexSceneSmartCodingFaceH265Vbr].options[objParts[uiIndexSceneSmartCodingFaceH265Vbr].selectedIndex].value);
    var smartcodingfacestr = objParts[uiIndexSceneSmartCodingFaceH265Vbr].options[objParts[uiIndexSceneSmartCodingFaceH265Vbr].selectedIndex].text;
    if (smartcodingface == 1) {
        if((model != camKind_H265Vbr_EX_U)
            && (model != camKind_H265Vbr_EX_MIC_U)
            && (model != camKind_H265Vbr_NextPT_S)
            && (model != camKind_H265Vbr_EX_AI360)
            && (modelname != 'U613**/U653**')
            && (modelname != 'S613**/S653**')
            && (modelname != 'S854**(Multi-Sensor)')
            && (modelname != 'U854**(Multi-Sensor)')
            && (modelname != 'S857**(4K Multi-Sensor)')
            && (modelname != 'X865**(Multi-Sensor)')
            && (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 != 'S856*/S857*(AI Multi-Sensor)')) {
            smartcodingface = smartcodingface + 1;
        }
    } else if (smartcodingface == 2) {
        if ((model == camKind_H265Vbr_NextPT_S) || (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)')) {
            smartcodingface = smartcodingface + 1;
        }
    }

    var illmnormal = Number(objParts[uiIndexSceneIllumNormalH265Vbr].options[objParts[uiIndexSceneIllumNormalH265Vbr].selectedIndex].value);
    var illmlow = Number(objParts[uiIndexSceneIllumLowH265Vbr].value);
    var motionnormal = Number(objParts[uiIndexSceneMotionNormalH265Vbr].options[objParts[uiIndexSceneMotionNormalH265Vbr].selectedIndex].value);
    var motionlow = Number(objParts[uiIndexSceneMotionLowH265Vbr].options[objParts[uiIndexSceneMotionLowH265Vbr].selectedIndex].value);

    var maxBitrate = 0;
    var stilBitrateNormal = 0;
    var stilBitrateLow = 0;
    var moveBitrateNormal = 0;
    var moveBitrateLow = 0;

    if (vbrCamInfTable[model][vbrCamInfTable_Enable] == 1 ) {
        stilBitrateNormal = VbrCalcCoefMethod(model, vbr_h265, resostr, qual, fps, location, vbrCamInfTable[model][vbrCamInfTable_SCType], smartcodingstr, smartcodingfacestr, 0, 0);
        maxBitrate = (0 < illmnormal && 100 > motionnormal && stilBitrateNormal > maxBitrate) ? stilBitrateNormal : maxBitrate;
        stilBitrateLow = VbrCalcCoefMethod(model, vbr_h265, resostr, qual, fps, location, vbrCamInfTable[model][vbrCamInfTable_SCType], smartcodingstr, smartcodingfacestr, 1, 0);
        maxBitrate = (0 < illmlow && 100 > motionlow && stilBitrateLow > maxBitrate) ? stilBitrateLow : maxBitrate;

        moveBitrateNormal = VbrCalcCoefMethod(model, vbr_h265, resostr, qual, fps, location, vbrCamInfTable[model][vbrCamInfTable_SCType], smartcodingstr, smartcodingfacestr, 0, 1);
        maxBitrate = (0 < illmnormal && 0 < motionnormal && moveBitrateNormal > maxBitrate) ? moveBitrateNormal : maxBitrate;
        moveBitrateLow = VbrCalcCoefMethod(model, vbr_h265, resostr, qual, fps, location, vbrCamInfTable[model][vbrCamInfTable_SCType], smartcodingstr, smartcodingfacestr, 1, 1);
        maxBitrate = (0 < illmlow && 0 < motionlow && moveBitrateLow > maxBitrate) ? moveBitrateLow : maxBitrate;
    } else {
        model = model - camKind_H265Vbr_EX_MIC_U;

        stilBitrateNormal = camBitrate_H265Vbr[model][location][bitrate_Normal][0][smartcoding][smartcodingface][reso][qual][fps]; 
        maxBitrate = (0 < illmnormal && 100 > motionnormal && stilBitrateNormal > maxBitrate) ? stilBitrateNormal : maxBitrate;
        stilBitrateLow = camBitrate_H265Vbr[model][location][bitrate_Low][0][smartcoding][smartcodingface][reso][qual][fps]; 
        maxBitrate = (0 < illmlow && 100 > motionlow && stilBitrateLow > maxBitrate) ? stilBitrateLow : maxBitrate;

        moveBitrateNormal = camBitrate_H265Vbr[model][location][bitrate_Normal][1][smartcoding][smartcodingface][reso][qual][fps]; 
        maxBitrate = (0 < illmnormal && 0 < motionnormal && moveBitrateNormal > maxBitrate) ? moveBitrateNormal : maxBitrate;
        moveBitrateLow = camBitrate_H265Vbr[model][location][bitrate_Low][1][smartcoding][smartcodingface][reso][qual][fps]; 
        maxBitrate = (0 < illmlow && 0 < motionlow && moveBitrateLow > maxBitrate) ? moveBitrateLow : maxBitrate;
    }


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

        uiSetTextBoxValue(objParts[uiIndexMaxKbpsH265Vbr], Math.ceil(maxBitrate), 1);
        uiSetTextBoxValue(objParts[uiIndexAvgKbpsH265Vbr], Math.ceil(avgBitrate), 1);
    }
}


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

    uiGetH265VbrObject(no, objParts);

    var model = Number(objParts[uiIndexModelH265Vbr].options[objParts[uiIndexModelH265Vbr].selectedIndex].value);
    var reso = Number(objParts[uiIndexResoH265Vbr].options[objParts[uiIndexResoH265Vbr].selectedIndex].value);
    var fps = Number(objParts[uiIndexFpsH265Vbr].options[objParts[uiIndexFpsH265Vbr].selectedIndex].value);

    if ((model == camKind_H265Vbr_EX_Next_2M_U2) ||
        (model == camKind_H265Vbr_EX_Next_2M_S) || 
        (model == camKind_H265Vbr_EX_NextPTZ_2M_S) || 
        (model == camKind_H265Vbr_EX_NextPTZ_2M_X) ||
        (model == camKind_H265Vbr_EX_Next_Bullet_2M_S) ||
        (model == camKind_H265Vbr_EX_NextPTZ_2M_X)) {

        if (reso == camReso_H265Vbr_EX_2M_FHD) {
            upperBitrate = 24576;
        } else if ((reso == camReso_H265Vbr_EX_2M_HD) || (reso == camReso_H265Vbr_EX_2M_HVGAW)) {
            upperBitrate = 12288;
        }
    }
    else if (model == camKind_H265Vbr_EX_Next_4K_U) {
        if ((reso == camReso_H265Vbr_EX_U_4K_3840x2160) || (reso == camReso_H265Vbr_EX_U_4K_2560x1440) || (reso == camReso_H265Vbr_EX_U_4K_FHD)) {
            upperBitrate = 24576;
        } else if (reso == camReso_H265Vbr_EX_U_4K_HD) {
            upperBitrate = 12288;
        }
    }
    else if (model == camKind_H265Vbr_EX_Next_5M_U) {
        if ((reso == camReso_H265Vbr_EX_U_5M_2560x1440) || (reso == camReso_H265Vbr_EX_U_5M_FHD)) {
            upperBitrate = 24576;
        } else if (reso == camReso_H265Vbr_EX_U_5M_HD) {
            upperBitrate = 12288;
        }
    }
    else if (model == camKind_H265Vbr_EX_Next_Bullet_5M_S) {
        if ((reso == camReso_H265Vbr_EX_5M_3072x1728) || (reso == camReso_H265Vbr_EX_5M_2560x1440)) {
            upperBitrate = 24576;
        }
    }
    else if (model == camKind_H265Vbr_EX_NextPTZ_6M2_S) {
        if ((reso == camReso_H265Vbr_EX_PTZ_6M_3328x1872) || (reso == camReso_H265Vbr_EX_PTZ_6M_2560x1440)) {
            upperBitrate = 24576;
        }
    }
    else if ((model == camKind_H265Vbr_EX_Next_Bullet_4K_S) || 
             (model == camKind_H265Vbr_EX_NextPTZ_4K2_S) ||
             (model == camKind_H265Vbr_EX_NextPTZ_4K_X)) {

        if ((reso == camReso_H265Vbr_EX_4K_3840x2160) || (reso == camReso_H265Vbr_EX_4K_2560x1440)) {
            upperBitrate = 24576;
        }
    }
    else if (model == camKind_H265Vbr_EX_Next_4M_S) {
        if ((reso == camReso_H265Vbr_EX_4M_2688x1520) || (reso == camReso_H265Vbr_EX_4M_2560x1440) || (reso == camReso_H265Vbr_EX_4M_FHD)) {
            upperBitrate = 24576;
        } else if (reso == camReso_H265Vbr_EX_4M_HD) {
            upperBitrate = 12288;
        }
    }
    else if (model == camKind_H265Vbr_EX_NextPTZ_6M_S) {
        if ((reso == camReso_H265Vbr_EX_PTZ_6M_3328x1872) || (reso == camReso_H265Vbr_EX_PTZ_6M_2560x1440)) {
            upperBitrate = 24576;
        }
    }
    else if (model == camKind_H265Vbr_EX_NextPTZ_4K_S) {
        if ((reso == camReso_H265Vbr_EX_PTZ_4K_3840x2160) || (reso == camReso_H265Vbr_EX_PTZ_4K_2560x1440)) {
            upperBitrate = 24576;
        }
    }
    else if (model == camKind_H265Vbr_EX_Next_2M_U) {
        if (reso == camReso_H265Vbr_EX_U_2M_FHD) {
            upperBitrate = 24576;
        } else if ((reso == camReso_H265Vbr_EX_U_2M_HD) || (reso == camReso_H265Vbr_EX_U_2M_HVGAW)) {
            upperBitrate = 12288;
        }
    }
    else if (model == camKind_H265Vbr_EX_Next_4M_U) {
        if ((reso == camReso_H265Vbr_EX_U_4M_2560x1440) || (reso == camReso_H265Vbr_EX_U_4M_FHD)) {
            upperBitrate = 24576;
        } else if (reso == camReso_H265Vbr_EX_U_4M_HD) {
            upperBitrate = 12288;
        }
    }
    else if (model == camKind_H265Vbr_EX_Next_2M_X) {
        if (reso == camReso_H265Vbr_EX_X_2M_FHD) {
            upperBitrate = 24576;
        } else if ((reso == camReso_H265Vbr_EX_X_2M_HD) || (reso == camReso_H265Vbr_EX_X_2M_HVGAW)) {
            upperBitrate = 12288;
        }
    }
    else if (model == camKind_H265Vbr_EX_Next_5M_X) {
        if ((reso == camReso_H265Vbr_EX_X_5M_3072x1728) || (reso == camReso_H265Vbr_EX_X_5M_2560x1440) || (reso == camReso_H265Vbr_EX_X_5M_FHD)) {
            upperBitrate = 24576;
        } else if ((reso == camReso_H265Vbr_EX_X_5M_HD)) {
            upperBitrate = 12288;
        }
    }
    else if (model == camKind_H265Vbr_EX_Next_6M_X) {
        if ((reso == camReso_H265Vbr_EX_X_6M_3328x1872) || (reso == camReso_H265Vbr_EX_X_6M_2560x1440) || (reso == camReso_H265Vbr_EX_X_6M_FHD)) {
            upperBitrate = 24576;
        } else if ((reso == camReso_H265Vbr_EX_X_6M_HD)) {
            upperBitrate = 12288;
        }
    }
    else if (model == camKind_H265Vbr_EX_Next_4K_X) {
        if ((reso == camReso_H265Vbr_EX_X_4K_3840x2160) || (reso == camReso_H265Vbr_EX_X_4K_2560x1440) || (reso == camReso_H265Vbr_EX_X_4K_FHD)) {
            upperBitrate = 24576;
        } else if ((reso == camReso_H265Vbr_EX_X_4K_HD)) {
            upperBitrate = 12288;
        }
    }
    else if (model == camKind_H265Vbr_EX_Next_5M_XCnr) {
        if ((reso == camReso_H265Vbr_EX_XCnr_5M_3072x1728) || (reso == camReso_H265Vbr_EX_XCnr_5M_2560x1440)) {
            upperBitrate = 24576;
        }
    }
    else if ((model == camKind_H264Vbr_NextPTZ_S) || (model == camKind_H264Vbr_NextPTZ_U) || (model == camKind_H265Vbr_NextPT_S) || (model == camKind_H265Vbr_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_H265Vbr_Next5MPTZ_S) {
        if ((reso == camReso_H265Vbr_EX_5MPTZ_5M) || (reso == camReso_H265Vbr_EX_5MPTZ_WQHD)) {
            upperBitrate = 24576;
        }
    }
    else if ((model == camKind_H265Vbr_EX_AIMS) || (model == camKind_H265Vbr_EX_AIMS_U)) {
        if ((reso == camReso_H265Vbr_EX_AIMS_4M) || (reso == camReso_H265Vbr_EX_AIMS_WQHD) || (reso == camReso_H265Vbr_EX_AIMS_FHD)) {
            upperBitrate = 24576;
        }
    }
    else if (model == camKind_H265Vbr_EX_AIMS_4K) {
        if ((reso == camReso_H265Vbr_EX_4KAIMS_3840x2160) || (reso == camReso_H265Vbr_EX_4KAIMS_WQHD) || (reso == camReso_H265Vbr_EX_4KAIMS_FHD)) {
            upperBitrate = 24576;
        }
    }
    else if (model == camKind_H265Vbr_EX_AIMS_X) {
        if ((reso == camReso_H265Vbr_EX_PTZMS_3072x1728) || (reso == camReso_H265Vbr_EX_PTZMS_WQHD) || (reso == camReso_H265Vbr_EX_PTZMS_FHD)) {
            upperBitrate = 24576;
        }
    }
    else if (model == camKind_H265Vbr_EX_4K_5M6M) {
        if ((reso == camReso_H265Vbr_EX_4K_5M6M_3072x2304) || (reso == camReso_H265Vbr_EX_5MPTZ_WQHD) || (reso == camReso_H265Vbr_EX_4K_5M6M_3840x2160) || (reso == camReso_H265Vbr_EX_4K_5M6M_3328x1872) || (reso == camReso_H265Vbr_EX_4K_5M6M_3072x1728) || (reso == camReso_H265Vbr_EX_4K_5M6M_2560x1440)) {
            upperBitrate = 24576;
        }
    }
    else if (model == camKind_H265Vbr_EX_IPROMINI) {
        if ((reso == camReso_H265Vbr_EX_IPROMINI_2048x1536) || (reso == camReso_H265Vbr_EX_IPROMINI_FHD)) {
            upperBitrate = 24576;
        } else if ((reso == camReso_H265Vbr_EX_IPROMINI_SXVGA) || (reso == camReso_H265Vbr_EX_IPROMINI_VGA) || (reso == camReso_H265Vbr_EX_IPROMINI_HD) || (reso == camReso_H265Vbr_EX_IPROMINI_HVGAW)) {
            upperBitrate = 12288;
        }
    } else if (model == camKind_H265Vbr_NextS) {
        if (reso == 0){
            upperBitrate = 24576;
        } else if (reso == 1) {
            upperBitrate = 12288;
        } else if (reso == 2) {
            upperBitrate = 12288;
        }
    }
    else if (model == camKind_H265Vbr_01) {
        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_H265Vbr_EX_4K) {
        if ((reso == 0) || (reso == 1) || (reso == 2)) {
            upperBitrate = 24576;
        } else if ((reso == 3) || (reso == 4)) {
            upperBitrate = 12288;
        }
    } else if ((model == camKind_H265Vbr_EX_9M) || (model == camKind_H265Vbr_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_H265Vbr_EX_AIMS_30ips) {
        if ((reso == camReso_H265Vbr_EX_AIMS_30IPS_2688x1520) || (reso == camReso_H265Vbr_EX_AIMS_30IPS_2560x1440) || (reso == camReso_H265Vbr_EX_AIMS_30IPS_FHD)) {
            upperBitrate = 24576;
        }
    } else if (model == camKind_H265Vbr_EX_AIMS_15ips) {
        if ((reso == camReso_H265Vbr_EX_AIMS_15IPS_3840x2160) || (reso == camReso_H265Vbr_EX_AIMS_15IPS_3328x1872) || (reso == camReso_H265Vbr_EX_AIMS_15IPS_2560x1440) || (reso == camReso_H265Vbr_EX_AIMS_15IPS_FHD)) {
            upperBitrate = 24576;
        }
    } else if (model == camKind_H265Vbr_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_H265Vbr_EX_U) || (model == camKind_H265Vbr_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 (model == camKind_H265Vbr_EX_AI || model == camKind_H265Vbr_EX_AI_4K) {
        upperBitrate = 24576;
    }

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


function uiGetH265VbrObject(no, partsObj) {
    switch (no) {
        case '1' :
            partsObj[uiIndexCamNumH265Vbr] = frmNWDR.txtCamNumH265Vbr_1;
            partsObj[uiIndexModelH265Vbr] = frmNWDR.selModelH265Vbr_1;
            partsObj[uiIndexResoH265Vbr] = frmNWDR.selResoH265Vbr_1;
            partsObj[uiIndexQualH265Vbr] = frmNWDR.selQualH265Vbr_1;
            partsObj[uiIndexFpsH265Vbr] = frmNWDR.selFpsH265Vbr_1;
            partsObj[uiIndexSceneLocationH265Vbr] = frmNWDR.selSceneLocationH265Vbr_1;
            partsObj[uiIndexSceneSmartCodingH265Vbr] = frmNWDR.selSceneSmartCodingH265Vbr_1;
            partsObj[uiIndex_scene_smartcoding_face_h265_1] = txt_s_scene_smartcoding_face_h265_1;
            partsObj[uiIndex_scene_smartcoding_viqs_h265_1] = txt_s_scene_smartcoding_viqs_h265_1;
            partsObj[uiIndex_scene_smartcoding_aiface_h265_1] = txt_s_scene_smartcoding_aiface_h265_1;
            partsObj[uiIndexSceneSmartCodingFaceH265Vbr] = frmNWDR.selSceneSmartCodingFaceH265Vbr_1;
            partsObj[uiIndexSceneSmartCodingPicSkipH265Vbr] = frmNWDR.selSceneSmartCodingPicSkipH265Vbr_1;
            partsObj[uiIndexSceneIllumNormalH265Vbr] = frmNWDR.selSceneIllumNormalH265Vbr_1;
            partsObj[uiIndexSceneIllumLowH265Vbr] = frmNWDR.selSceneIllumLowH265Vbr_1;
            partsObj[uiIndexSceneMotionNormalH265Vbr] = frmNWDR.selSceneMotionNormalH265Vbr_1;
            partsObj[uiIndexSceneMotionLowH265Vbr] = frmNWDR.selSceneMotionLowH265Vbr_1;
            partsObj[uiIndexSceneIllumNormalHourH265Vbr] = txt_s_scene_illum_h265_normal_hour_1;
            partsObj[uiIndexSceneMotionNormalHourH265Vbr] = txt_s_scene_motion_h265_normal_hour_1;
            partsObj[uiIndexSceneIllumLowHourH265Vbr] = txt_s_scene_illum_h265_low_hour_1;
            partsObj[uiIndexSceneMotionLowHourH265Vbr] = txt_s_scene_motion_h265_low_hour_1;
            partsObj[uiIndexSceneImageNormalH265Vbr] = frmNWDR.img_h265vbr_scene_normal_1;
            partsObj[uiIndexSceneImageLowH265Vbr] = frmNWDR.img_h265vbr_scene_low_1;
            partsObj[uiIndexMaxKbpsH265Vbr] = frmNWDR.selMaxKbpsH265Vbr_1;
            partsObj[uiIndexAvgKbpsH265Vbr] = frmNWDR.selAvgKbpsH265Vbr_1;
            partsObj[uiIndexCompkindH265Vbr] = frmNWDR.selCompkindVbr;
            partsObj[uiIndexSceneSmartCodingNewSH265Vbr] = frmNWDR.selSceneSmartCodingNewSH265Vbr_1;
            break;

        case '2' :
            partsObj[uiIndexCamNumH265Vbr] = frmNWDR.txtCamNumH265Vbr_2;
            partsObj[uiIndexModelH265Vbr] = frmNWDR.selModelH265Vbr_2;
            partsObj[uiIndexResoH265Vbr] = frmNWDR.selResoH265Vbr_2;
            partsObj[uiIndexQualH265Vbr] = frmNWDR.selQualH265Vbr_2;
            partsObj[uiIndexFpsH265Vbr] = frmNWDR.selFpsH265Vbr_2;
            partsObj[uiIndexSceneLocationH265Vbr] = frmNWDR.selSceneLocationH265Vbr_2;
            partsObj[uiIndexSceneSmartCodingH265Vbr] = frmNWDR.selSceneSmartCodingH265Vbr_2;
            partsObj[uiIndex_scene_smartcoding_face_h265_1] = txt_s_scene_smartcoding_face_h265_2;
            partsObj[uiIndex_scene_smartcoding_viqs_h265_1] = txt_s_scene_smartcoding_viqs_h265_2;
            partsObj[uiIndex_scene_smartcoding_aiface_h265_1] = txt_s_scene_smartcoding_aiface_h265_2;
            partsObj[uiIndexSceneSmartCodingFaceH265Vbr] = frmNWDR.selSceneSmartCodingFaceH265Vbr_2;
            partsObj[uiIndexSceneSmartCodingPicSkipH265Vbr] = frmNWDR.selSceneSmartCodingPicSkipH265Vbr_2;
            partsObj[uiIndexSceneIllumNormalH265Vbr] = frmNWDR.selSceneIllumNormalH265Vbr_2;
            partsObj[uiIndexSceneIllumLowH265Vbr] = frmNWDR.selSceneIllumLowH265Vbr_2;
            partsObj[uiIndexSceneMotionNormalH265Vbr] = frmNWDR.selSceneMotionNormalH265Vbr_2;
            partsObj[uiIndexSceneMotionLowH265Vbr] = frmNWDR.selSceneMotionLowH265Vbr_2;
            partsObj[uiIndexSceneIllumNormalHourH265Vbr] = txt_s_scene_illum_h265_normal_hour_2;
            partsObj[uiIndexSceneMotionNormalHourH265Vbr] = txt_s_scene_motion_h265_normal_hour_2;
            partsObj[uiIndexSceneIllumLowHourH265Vbr] = txt_s_scene_illum_h265_low_hour_2;
            partsObj[uiIndexSceneMotionLowHourH265Vbr] = txt_s_scene_motion_h265_low_hour_2;
            partsObj[uiIndexSceneImageNormalH265Vbr] = frmNWDR.img_h265vbr_scene_normal_2;
            partsObj[uiIndexSceneImageLowH265Vbr] = frmNWDR.img_h265vbr_scene_low_2;
            partsObj[uiIndexMaxKbpsH265Vbr] = frmNWDR.selMaxKbpsH265Vbr_2;
            partsObj[uiIndexAvgKbpsH265Vbr] = frmNWDR.selAvgKbpsH265Vbr_2;
            partsObj[uiIndexSceneSmartCodingNewSH265Vbr] = frmNWDR.selSceneSmartCodingNewSH265Vbr_2;
            break;

        case '3' :
            partsObj[uiIndexCamNumH265Vbr] = frmNWDR.txtCamNumH265Vbr_3;
            partsObj[uiIndexModelH265Vbr] = frmNWDR.selModelH265Vbr_3;
            partsObj[uiIndexResoH265Vbr] = frmNWDR.selResoH265Vbr_3;
            partsObj[uiIndexQualH265Vbr] = frmNWDR.selQualH265Vbr_3;
            partsObj[uiIndexFpsH265Vbr] = frmNWDR.selFpsH265Vbr_3;
            partsObj[uiIndexSceneLocationH265Vbr] = frmNWDR.selSceneLocationH265Vbr_3;
            partsObj[uiIndexSceneSmartCodingH265Vbr] = frmNWDR.selSceneSmartCodingH265Vbr_3;
            partsObj[uiIndex_scene_smartcoding_face_h265_1] = txt_s_scene_smartcoding_face_h265_3;
            partsObj[uiIndex_scene_smartcoding_viqs_h265_1] = txt_s_scene_smartcoding_viqs_h265_3;
            partsObj[uiIndex_scene_smartcoding_aiface_h265_1] = txt_s_scene_smartcoding_aiface_h265_3;
            partsObj[uiIndexSceneSmartCodingFaceH265Vbr] = frmNWDR.selSceneSmartCodingFaceH265Vbr_3;
            partsObj[uiIndexSceneSmartCodingPicSkipH265Vbr] = frmNWDR.selSceneSmartCodingPicSkipH265Vbr_3;
            partsObj[uiIndexSceneIllumNormalH265Vbr] = frmNWDR.selSceneIllumNormalH265Vbr_3;
            partsObj[uiIndexSceneIllumLowH265Vbr] = frmNWDR.selSceneIllumLowH265Vbr_3;
            partsObj[uiIndexSceneMotionNormalH265Vbr] = frmNWDR.selSceneMotionNormalH265Vbr_3;
            partsObj[uiIndexSceneMotionLowH265Vbr] = frmNWDR.selSceneMotionLowH265Vbr_3;
            partsObj[uiIndexSceneIllumNormalHourH265Vbr] = txt_s_scene_illum_h265_normal_hour_3;
            partsObj[uiIndexSceneMotionNormalHourH265Vbr] = txt_s_scene_motion_h265_normal_hour_3;
            partsObj[uiIndexSceneIllumLowHourH265Vbr] = txt_s_scene_illum_h265_low_hour_3;
            partsObj[uiIndexSceneMotionLowHourH265Vbr] = txt_s_scene_motion_h265_low_hour_3;
            partsObj[uiIndexSceneImageNormalH265Vbr] = frmNWDR.img_h265vbr_scene_normal_3;
            partsObj[uiIndexSceneImageLowH265Vbr] = frmNWDR.img_h265vbr_scene_low_3;
            partsObj[uiIndexMaxKbpsH265Vbr] = frmNWDR.selMaxKbpsH265Vbr_3;
            partsObj[uiIndexAvgKbpsH265Vbr] = frmNWDR.selAvgKbpsH265Vbr_3;
            partsObj[uiIndexSceneSmartCodingNewSH265Vbr] = frmNWDR.selSceneSmartCodingNewSH265Vbr_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;
}

