function uiInitload(code, F) {
    frmNWDR.txtCamNumH265Vbr_1.value = '';
    frmNWDR.txtCamNumH265Vbr_2.value = '';
    frmNWDR.txtCamNumH265Vbr_3.value = '';
    frmNWDR.txtCamNumH264Vbr_1.value = '';
    frmNWDR.txtCamNumH264Vbr_2.value = '';
    frmNWDR.txtCamNumH264Vbr_3.value = '';
    frmNWDR.txtCamNumH265_1.value = '';
    frmNWDR.txtCamNumH265_2.value = '';
    frmNWDR.txtCamNumH265_3.value = '';
    frmNWDR.txtCamNumH265_4.value = '';
    frmNWDR.txtCamNumH264_1.value = '';
    frmNWDR.txtCamNumH264_2.value = '';
    frmNWDR.txtCamNumH264_3.value = '';
    frmNWDR.txtCamNumH264_4.value = '';
    frmNWDR.txtCamNumJpeg_1.value = '';
    frmNWDR.txtCamNumJpeg_2.value = '';
    frmNWDR.txtCamNumJpeg_3.value = '';
    frmNWDR.txtCamNumJpeg_4.value = '';

    uiInitH265('1', camKind_H265_U11300, 0);
    uiInitH265('2', camKind_H265_S61501, 0);
    uiInitH265('3', camKind_H265_S85402, 0);
    uiInitH265('4', camKind_H265_X86530, 0);

    uiInitH264('1', camKind_H264_U11300, 0);
    uiInitH264('2', camKind_H264_S61501, 0);
    if (app_dst == 'ja') {
        uiInitH264('3', camKind_H264_Sfv63, 0);
    } else {
        uiInitH264('3', camKind_H264_S85402, 1);
    }
    uiInitH264('4', camKind_H264_X86530, 0);

    uiInitJpeg('1', camKind_Jpeg_U11300, 0);
    uiInitJpeg('2', camKind_Jpeg_S61501, 0);
    if (app_dst == 'ja') {
        uiInitJpeg('3', camKind_Jpeg_Sfv63, 0);
    } else {
        uiInitJpeg('3', camKind_Jpeg_S85402, 0);
    }
    uiInitJpeg('4', camKind_Jpeg_X86530, 0);

    j = 0;
    frmNWDR.selRecHour.length = 24;
    for (var i = 24; i > 0; i--) {
        frmNWDR.selRecHour.options[j].value = [i];
        frmNWDR.selRecHour.options[j].text = [i];
        j++;
    }
    frmNWDR.selRecHour.selectedIndex = 0;

    frmNWDR.sel_HDD.length = defSelHDDcapaGB.length;
    for (var i = 0; i < defSelHDDcapaGB.length; i++) {
        frmNWDR.sel_HDD.options[i].value = defSelHDDcapaGB[i];
        frmNWDR.sel_HDD.options[i].text = defSelHDDcapaTB[i] + sel_hdd_unit;
    }
    frmNWDR.sel_HDD.selectedIndex = 0;

    frmNWDR.sel_RAID.length = sel_raid_str.length;
    for (var i = 0; i < sel_raid_str.length; i++) {
        frmNWDR.sel_RAID.options[i].value = defDelRAIDcode[i];
        frmNWDR.sel_RAID.options[i].text = sel_raid_str[i];
    }

    frmNWDR.sel_RAID.selectedIndex = 0;

    uiHDDchange(frmNWDR.sel_HDD);

    frmNWDR.txtRecDays.value = defDefalutRecDay;

    if (app_dst != 'ja') {
        document.frmNWDR.elements['chksubstream'].checked = false;
        if (SubStream == false) { 
            document.frmNWDR.elements['chksubstream'].style.display = 'none';
        }
    }

    document.frmNWDR.elements['chkaudio'].checked = false;
    document.getElementById('camRecAudio_AACLC').disabled = true;
    document.getElementById('camRecAudio_G726').disabled = true;

    if (app_dst != 'zh') {
      document.frmNWDR.elements['chkhttps'].checked = false;
      document.frmNWDR.elements['chkencdata'].checked = false;
      if (Secure == false) { 
        document.frmNWDR.elements['chkhttps'].style.display = 'none';
        document.frmNWDR.elements['chkencdata'].style.display = 'none';
      }
    }
    frmNWDR.camRecAudio.selectedIndex = 0;
    document.frmNWDR.elements['chkdetail'].checked = false;

    frmNWDR.txtMbpsJpeg_1.value = Number(frmNWDR.txtMbpsJpeg_1.value).toLocaleString();
    frmNWDR.txtMbpsJpeg_2.value = Number(frmNWDR.txtMbpsJpeg_2.value).toLocaleString();
    frmNWDR.txtMbpsJpeg_3.value = Number(frmNWDR.txtMbpsJpeg_3.value).toLocaleString();
    frmNWDR.txtMbpsJpeg_4.value = Number(frmNWDR.txtMbpsJpeg_4.value).toLocaleString();

    uiInitloadH265Vbr();
    uiInitloadH264Vbr();

    $('[id^="chkaudio"]').change(function(e) {

        uiUpdateVbr265('1');
        uiUpdateVbr265('2');
        uiUpdateVbr265('3');
        uiUpdateVbr264('1');
        uiUpdateVbr264('2');
        uiUpdateVbr264('3');
        uiChangeH265('1','7');
        uiChangeH265('2','7');
        uiChangeH265('3','7');
        uiChangeH265('4','7');
        uiChangeH264('1','7');
        uiChangeH264('2','7');
        uiChangeH264('3','7');
        uiChangeH264('4','7');

        uiChangeH265Vbr('1', 1);
        uiChangeH265Vbr('2', 1);
        uiChangeH265Vbr('3', 1);
        uiChangeH264Vbr('1', 1);
        uiChangeH264Vbr('2', 1);
        uiChangeH264Vbr('3', 1);

        if (document.frmNWDR.elements['chkaudio'].checked == false) {
            document.getElementById('camRecAudio_AACLC').disabled = true;
            document.getElementById('camRecAudio_G726').disabled = true;
        } else {
            document.getElementById('camRecAudio_AACLC').disabled = false;
            document.getElementById('camRecAudio_G726').disabled = false;
        }

        calcdata();
    });

    $('[id^="camRecAudio_"]').change(function(e) {
        uiUpdateVbr265('1');
        uiUpdateVbr265('2');
        uiUpdateVbr265('3');
        uiUpdateVbr264('1');
        uiUpdateVbr264('2');
        uiUpdateVbr264('3');
        uiChangeH265('1','7');
        uiChangeH265('2','7');
        uiChangeH265('3','7');
        uiChangeH265('4','7');
        uiChangeH264('1','7');
        uiChangeH264('2','7');
        uiChangeH264('3','7');
        uiChangeH264('4','7');

        uiChangeH265Vbr('1', 1);
        uiChangeH265Vbr('2', 1);
        uiChangeH265Vbr('3', 1);
        uiChangeH264Vbr('1', 1);
        uiChangeH264Vbr('2', 1);
        uiChangeH264Vbr('3', 1);

        calcdata();
    });

    calcdata(); 
}


function uiGetH265Object(no, partsObj) {
    switch (no) {
        case '1' :
            partsObj[0] = frmNWDR.selModelH265_1;
            partsObj[1] = frmNWDR.selResoH265_1;
            partsObj[2] = frmNWDR.selScanH265_1;
            partsObj[3] = frmNWDR.selPrioH265_1;
            partsObj[4] = frmNWDR.selQualH265_1;
            partsObj[5] = frmNWDR.selKbpsH265_1;
            break;

        case '2' :
            partsObj[0] = frmNWDR.selModelH265_2;
            partsObj[1] = frmNWDR.selResoH265_2;
            partsObj[2] = frmNWDR.selScanH265_2;
            partsObj[3] = frmNWDR.selPrioH265_2;
            partsObj[4] = frmNWDR.selQualH265_2;
            partsObj[5] = frmNWDR.selKbpsH265_2;
            break;

        case '3' :
            partsObj[0] = frmNWDR.selModelH265_3;
            partsObj[1] = frmNWDR.selResoH265_3;
            partsObj[2] = frmNWDR.selScanH265_3;
            partsObj[3] = frmNWDR.selPrioH265_3;
            partsObj[4] = frmNWDR.selQualH265_3;
            partsObj[5] = frmNWDR.selKbpsH265_3;
            break;

        case '4' :
            partsObj[0] = frmNWDR.selModelH265_4;
            partsObj[1] = frmNWDR.selResoH265_4;
            partsObj[2] = frmNWDR.selScanH265_4;
            partsObj[3] = frmNWDR.selPrioH265_4;
            partsObj[4] = frmNWDR.selQualH265_4;
            partsObj[5] = frmNWDR.selKbpsH265_4;
            break;
    }
}


function uiInitH265(no, model, reso) {
    uiSetH265Model(no, model);
    var scan = uiSetH265ScanIndex(no, model, null);
    reso = uiSetH265ResoIndex(no, model, scan, reso);
    var prio = uiSetH265PrioIndex(no, model, null);
    var qual = uiSetH265QualIndex(no, model, prio, null);
    uiSetH265bpsIndex(no, model, scan, reso, prio, qual, null);
}


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

    uiGetH265Object(no, objParts);

    if (app_dst == 'ja') {
        objParts[0].length = camInfo_H265.length - (VSeriesNum + H265Num_h265);
    } else {
        objParts[0].length = camInfo_H265.length - H265Num_h265;
    }

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

    if (model == camKind_H265_B51300SC) {
        objParts[0].selectedIndex = camKind_H265_B51300;
    }else if (model == camKind_H265_S61301SC) {
        objParts[0].selectedIndex = camKind_H265_S61301;
    }else if (model == camKind_H265_S61501SC) {
        objParts[0].selectedIndex = camKind_H265_S61501;
    }else if (model == camKind_H265_S85402SC) {
        objParts[0].selectedIndex = camKind_H265_S85402;
    }else if (model == camKind_H265_S85702SC) {
        objParts[0].selectedIndex = camKind_H265_S85702;
    }else if (model == camKind_H265_X86530SC) {
        objParts[0].selectedIndex = camKind_H265_X86530;
    }else if (model == camKind_H265_X86530PTZSC) {
        objParts[0].selectedIndex = camKind_H265_X86530PTZ;
    } else if (model == camKind_H265_U61301SC) {
        objParts[0].selectedIndex = camKind_H265_U61301;
    } else if (model == camKind_H265_S2116SC) {
        objParts[0].selectedIndex = camKind_H265_S2116;
    } else if (model == camKind_H265_S2236SC) {
        objParts[0].selectedIndex = camKind_H265_S2236;
    } else if (model == camKind_H265_S1130SC) {
        objParts[0].selectedIndex = camKind_H265_S1130;
    } else if (model == camKind_H265_S1110SC) {
        objParts[0].selectedIndex = camKind_H265_S1110;
    } else if (model == camKind_H265_S1552SC) {
        objParts[0].selectedIndex = camKind_H265_S1552;
    } else if (model == camKind_H265_S1550SC) {
        objParts[0].selectedIndex = camKind_H265_S1550;
    } else if (model == camKind_H265_S1572SC) {
        objParts[0].selectedIndex = camKind_H265_S1572;
    } else if (model == camKind_H265_S1570SC) {
        objParts[0].selectedIndex = camKind_H265_S1570;
    } else if (model == camKind_H265_S3130SC) {
        objParts[0].selectedIndex = camKind_H265_S3130;
    } else if (model == camKind_H265_S3110SC) {
        objParts[0].selectedIndex = camKind_H265_S3110;
    } else if (model == camKind_H265_X8571SC) {
        objParts[0].selectedIndex = camKind_H265_X8571;
    } else if (model == camKind_H265_S8531SC) {
        objParts[0].selectedIndex = camKind_H265_S8531;
    } else if (model == camKind_H265_X8570SC) {
        objParts[0].selectedIndex = camKind_H265_X8570;
    } else if (model == camKind_H265_S8530SC) {
        objParts[0].selectedIndex = camKind_H265_S8530;
    } else if (model == camKind_H265_S6530SC) {
        objParts[0].selectedIndex = camKind_H265_S6530;
    } else if (model == camKind_H265_S6510SC) {
        objParts[0].selectedIndex = camKind_H265_S6510;
    } else if (model == camKind_H265_S4176SC) {
        objParts[0].selectedIndex = camKind_H265_S4176;
    } else if (model == camKind_H265_S4156SC) {
        objParts[0].selectedIndex = camKind_H265_S4156;
    } else if (model == camKind_H265_X4170SC) {
        objParts[0].selectedIndex = camKind_H265_X4170;
    } else if (model == camKind_H265_S4150SC) {
        objParts[0].selectedIndex = camKind_H265_S4150;
    } else if (model == camKind_H265_U1130SC) {
        objParts[0].selectedIndex = camKind_H265_U1130;
} else if (model == camKind_H265_U11300SC) {
    objParts[0].selectedIndex = camKind_H265_U11300;
    } else if (model == camKind_H265_U1140SC) {
        objParts[0].selectedIndex = camKind_H265_U1140;
    } else if (model == camKind_H265_X1534SC) {
        objParts[0].selectedIndex = camKind_H265_X1534;
    } else if (model == camKind_H265_X1571SC) {
        objParts[0].selectedIndex = camKind_H265_X1571;
    } else if (model == camKind_H265_S25700SC) {
        objParts[0].selectedIndex = camKind_H265_S25700;
    } else if (model == camKind_H265_S25600SC) {
        objParts[0].selectedIndex = camKind_H265_S25600;
    } else if (model == camKind_H265_S25500SC) {
        objParts[0].selectedIndex = camKind_H265_S25500;
    } else if (model == camKind_H265_S71300SC) {
        objParts[0].selectedIndex = camKind_H265_S71300;
    } else if (model == camKind_H265_S8570SC) {
        objParts[0].selectedIndex = camKind_H265_S8570;
    } else if (model == camKind_H265_S8560SC) {
        objParts[0].selectedIndex = camKind_H265_S8560;
    } else if (model == camKind_H265_S8540SC) {
        objParts[0].selectedIndex = camKind_H265_S8540;
    } else {
        objParts[0].selectedIndex = model;
    }

}


function uiChangeH265(no, item) {
    var objParts = new Array();

    uiGetH265Object(no, objParts);

    var model = Number(objParts[0].options[objParts[0].selectedIndex].value);
    var sscan = objParts[2].options[objParts[2].selectedIndex].text;
    var sreso = objParts[1].options[objParts[1].selectedIndex].text;
    var sprio = objParts[3].options[objParts[3].selectedIndex].text;
    var squal = objParts[4].options[objParts[4].selectedIndex].text;
    var bitrate = objParts[5].options[objParts[5].selectedIndex].value;

    if (objParts[0].selectedIndex == camKind_H265_B51300 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_B51300SC;
    } else if (objParts[0].selectedIndex == camKind_H265_S61301 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_S61301SC;
    } else if (objParts[0].selectedIndex == camKind_H265_S61501 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_S61501SC;
    } else if (objParts[0].selectedIndex == camKind_H265_S85402 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_S85402SC;
    } else if (objParts[0].selectedIndex == camKind_H265_S85702 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_S85702SC;
    } else if (objParts[0].selectedIndex == camKind_H265_X86530 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_X86530SC;
    } else if (objParts[0].selectedIndex == camKind_H265_X86530PTZ && objParts[3].selectedIndex == 1) {
        model = camKind_H265_X86530PTZSC;
    } else if (objParts[0].selectedIndex == camKind_H265_S2116 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_S2116SC;
    } else if (objParts[0].selectedIndex == camKind_H265_S2236 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_S2236SC;
    } else if (objParts[0].selectedIndex == camKind_H265_S1130 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_S1130SC;
    } else if (objParts[0].selectedIndex == camKind_H265_S1110 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_S1110SC;
    } else if (objParts[0].selectedIndex == camKind_H265_S1552 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_S1552SC;
    } else if (objParts[0].selectedIndex == camKind_H265_S1550 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_S1550SC;
    } else if (objParts[0].selectedIndex == camKind_H265_S1572 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_S1572SC;
    } else if (objParts[0].selectedIndex == camKind_H265_S1570 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_S1570SC;
    } else if (objParts[0].selectedIndex == camKind_H265_S3130 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_S3130SC;
    } else if (objParts[0].selectedIndex == camKind_H265_S3110 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_S3110SC;
    } else if (objParts[0].selectedIndex == camKind_H265_X8571 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_X8571SC;
    } else if (objParts[0].selectedIndex == camKind_H265_S8531 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_S8531SC;
    } else if (objParts[0].selectedIndex == camKind_H265_X8570 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_X8570SC;
    } else if (objParts[0].selectedIndex == camKind_H265_S8530 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_S8530SC;
    } else if (objParts[0].selectedIndex == camKind_H265_S6530 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_S6530SC;
    } else if (objParts[0].selectedIndex == camKind_H265_S6510 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_S6510SC;
    } else if (objParts[0].selectedIndex == camKind_H265_S4176 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_S4176SC;
    } else if (objParts[0].selectedIndex == camKind_H265_S4156 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_S4156SC;
    } else if (objParts[0].selectedIndex == camKind_H265_X4170 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_X4170SC;
    } else if (objParts[0].selectedIndex == camKind_H265_S4150 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_S4150SC;
    } else if (objParts[0].selectedIndex == camKind_H265_U1130 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_U1130SC;
    } else if (objParts[0].selectedIndex == camKind_H265_U11300 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_U11300SC;
    } else if (objParts[0].selectedIndex == camKind_H265_U1140 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_U1140SC;
    } else if (objParts[0].selectedIndex == camKind_H265_X1534 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_X1534SC;
    } else if (objParts[0].selectedIndex == camKind_H265_X1571 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_X1571SC;
    } else if (objParts[0].selectedIndex == camKind_H265_S25700 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_S25700SC;
    } else if (objParts[0].selectedIndex == camKind_H265_S25600 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_S25600SC;
    } else if (objParts[0].selectedIndex == camKind_H265_S25500 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_S25500SC;
    } else if (objParts[0].selectedIndex == camKind_H265_S71300 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_S71300SC;
    } else if (objParts[0].selectedIndex == camKind_H265_S8570 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_S8570SC;
    } else if (objParts[0].selectedIndex == camKind_H265_S8560 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_S8560SC;
    } else if (objParts[0].selectedIndex == camKind_H265_S8540 && objParts[3].selectedIndex == 1) {
        model = camKind_H265_S8540SC;
    }
    uiInitH265(no, model, null);

    var scan = uiSelectH265ScanText(no, sscan);

    uiSetH265ResoIndex(no, model, scan, null);
    var reso = uiSelectH265ResoText(no, sreso);

    uiSetH265PrioIndex(no, model, null);
    var prio = uiSelectH265PrioText(no, sprio);

    if (objParts[3].selectedIndex == 1) {
        var prio = 0;
    }

    uiSetH265QualIndex(no, model, prio, null);
    var qual = uiSetH265QualText(no, squal);

    uiSetH265bpsIndex(no, model, scan, reso, prio, qual, null);
    uiSetH265bpsValue(no, model, scan, reso, prio, qual, bitrate);

    calcdata(); 

}


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

    uiGetH265Object(no, objParts);

    objParts[1].length = camInfo_H265[model][1][scan + 1][1].length - 1;
    for (var idx = 0; idx < objParts[1].length; idx++) {
        objParts[1].options[idx].value = idx;
        objParts[1].options[idx].text =
            camInfo_H265[model][1][scan + 1][1][idx + 1];
    }
    if (null == reso) {
        objParts[1].selectedIndex = camInfo_H265[model][1][scan + 1][1][0];
    } else {
        objParts[1].selectedIndex = reso;
    }

    return objParts[1].selectedIndex;
}


function uiSelectH265ResoText(no, sreso) {
    var objParts = new Array();

    uiGetH265Object(no, objParts);

    for (var idx = 0; idx < objParts[1].length; idx++) {
        if (sreso == objParts[1].options[idx].text) {
            objParts[1].selectedIndex = idx;
            break;
        }
    }

    return objParts[1].selectedIndex;
}


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

    uiGetH265Object(no, objParts);

    objParts[2].length = camInfo_H265[model][1].length - 1;
    for (var idx = 0; idx < objParts[2].length; idx++) {
        objParts[2].options[idx].value = idx;
        objParts[2].options[idx].text = camInfo_H265[model][1][idx + 1][0];
    }
    if (null == scan) {
        objParts[2].selectedIndex = camInfo_H265[model][1][0][0];
    } else {
        objParts[2].selectedIndex = scan;
    }

    return objParts[2].selectedIndex;
}


function uiSelectH265ScanText(no, sscan) {
    var objParts = new Array();

    uiGetH265Object(no, objParts);

    for (var idx = 0; idx < objParts[2].length; idx++) {
        if (sscan == objParts[2].options[idx].text) {
            objParts[2].selectedIndex = idx;
            break;
        }
    }

    return objParts[2].selectedIndex;
}


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

    uiGetH265Object(no, objParts);

    if (model == camKind_H265_V23 || model == camKind_H265_V63 ||
        model == camKind_H265_V17) {
        objParts[3].length = 1;
    } else {
        objParts[3].length = camInfo_H265[model][2].length - 1;
    }
    for (var idx = 0; idx < objParts[3].length; idx++) {
        objParts[3].options[idx].value = idx;
        objParts[3].options[idx].text = camInfo_H265[model][2][idx + 1][0];
    }
    if (null == prio) {
        objParts[3].selectedIndex = camInfo_H265[model][2][0][0];
    } else {
        objParts[3].selectedIndex = prio;
    }

    return objParts[3].selectedIndex;
}


function uiSelectH265PrioText(no, sprio) {
    var objParts = new Array();

    uiGetH265Object(no, objParts);

    for (var idx = 0; idx < objParts[3].length; idx++) {
        if (sprio == objParts[3].options[idx].text) {
            objParts[3].selectedIndex = idx;
            break;
        }
    }

    return objParts[3].selectedIndex;
}


function uiSetH265QualIndex(no, model, prio, qual) {
    var objParts = new Array();

    uiGetH265Object(no, objParts);

    objParts[4].length = camInfo_H265[model][2][prio + 1][1].length - 1;
    for (var idx = 0; idx < objParts[4].length; idx++) {
        objParts[4].options[idx].value = idx;
        objParts[4].options[idx].text =
            camInfo_H265[model][2][prio + 1][1][idx + 1];
    }
    if (null == qual) {
        objParts[4].selectedIndex = camInfo_H265[model][2][prio + 1][1][0];
    } else {
        objParts[4].selectedIndex = qual;
    }

    return objParts[4].selectedIndex;
}


function uiSetH265QualText(no, squal) {
    var objParts = new Array();

    uiGetH265Object(no, objParts);

    for (var idx = 0; idx < objParts[4].length; idx++) {
        if (squal == objParts[4].options[idx].text) {
            objParts[4].selectedIndex = idx;
            break;
        }
    }

    return objParts[4].selectedIndex;
}


function uiSetH265bpsIndex(no, model, scan, reso, prio, qual, bitrate) {
    var objParts = new Array();

    uiGetH265Object(no, objParts);

    var tblBitrate = camBitrate_H265[model][scan][prio][reso][qual];

    objParts[5].length = tblBitrate.length - 1;
    for (var idx = 0; idx < objParts[5].length; idx++) {
        var dspbitrate = tblBitrate[idx + 1][0];
        if (0 == tblBitrate[idx + 1][1]) {
            objParts[5].options[idx].value = tblBitrate[idx + 1][0]; 
        } else {
            objParts[5].options[idx].value = tblBitrate[idx + 1][1]; 
            dspbitrate += '(' + tblBitrate[idx + 1][1] + ')';
        }
        var dspfps = '';
        if (model != camKind_H265_V23 && model != camKind_H265_V63 &&
            model != camKind_H265_V17) {
            if (0 == prio) {
                dspfps += s_cam_ips_max;
            }
        }
        if (0 == tblBitrate[idx + 1][2]) {
            dspfps += s_cam_ips_none;
        } else {
            if ((model == camKind_H265_U11300) || (model == camKind_H265_U11300SC)) {
                if ((frmNWDR.chkaudio.checked == true) && (document.getElementById('camRecAudio_AACLC').checked == true)) {
                    if (tblBitrate[idx + 1][2] == 30) {
                        dspfps += 15 + s_cam_ips;
                        CALC_AUDIOAACLDSELECTED = true;
                    } else if (tblBitrate[idx + 1][2] == 25) {
                        dspfps += 12.5 + s_cam_ips;
                        CALC_AUDIOAACLDSELECTED = true;
                    } else {
                        dspfps += tblBitrate[idx + 1][2] + s_cam_ips;
                    }
                } else {
                    dspfps += tblBitrate[idx + 1][2] + s_cam_ips;
                }
            } else {
                dspfps += tblBitrate[idx + 1][2] + s_cam_ips;
            }
}
        if (1 == tblBitrate[idx + 1][3]) {
            objParts[5].options[idx].text =
                dspbitrate +
                s_cam_bitrate_kbps +
                s_space +
                dspfps;
        } else {
            objParts[5].options[idx].text =
                dspbitrate +
                s_cam_bitrate_kbps +
                s_mark_notice +
                s_space +
                dspfps;
        }
    }
    if (null == bitrate) {
        objParts[5].selectedIndex = tblBitrate[0][0];
    } else {
        objParts[5].selectedIndex = bitrate;
    }

    var FpsIdx = objParts[5].selectedIndex;
    Framerate[Number(no)] = tblBitrate[FpsIdx + 1][2];

    return objParts[5].selectedIndex;
}


function uiSetH265bpsValue(no, model, scan, reso, prio, qual, bitrate) {
    var objParts = new Array();

    uiGetH265Object(no, objParts);

    var tblBitrate = camBitrate_H265[model][scan][prio][reso][qual];

    for (var idx = 0; idx < objParts[5].length; idx++) {
        if (bitrate == objParts[5].options[idx].value) {
            objParts[5].selectedIndex = idx;
            Framerate[Number(no)] = tblBitrate[idx + 1][2];
            break;
        }
    }

    return objParts[5].selectedIndex;
}


function uiGetH264Object(no, partsObj) {
    switch (no) {
        case '1' :
            partsObj[0] = frmNWDR.selModelH264_1;
            partsObj[1] = frmNWDR.selResoH264_1;
            partsObj[2] = frmNWDR.selScanH264_1;
            partsObj[3] = frmNWDR.selPrioH264_1;
            partsObj[4] = frmNWDR.selQualH264_1;
            partsObj[5] = frmNWDR.selKbpsH264_1;
            break;

        case '2' :
            partsObj[0] = frmNWDR.selModelH264_2;
            partsObj[1] = frmNWDR.selResoH264_2;
            partsObj[2] = frmNWDR.selScanH264_2;
            partsObj[3] = frmNWDR.selPrioH264_2;
            partsObj[4] = frmNWDR.selQualH264_2;
            partsObj[5] = frmNWDR.selKbpsH264_2;
            break;

        case '3' :
            partsObj[0] = frmNWDR.selModelH264_3;
            partsObj[1] = frmNWDR.selResoH264_3;
            partsObj[2] = frmNWDR.selScanH264_3;
            partsObj[3] = frmNWDR.selPrioH264_3;
            partsObj[4] = frmNWDR.selQualH264_3;
            partsObj[5] = frmNWDR.selKbpsH264_3;
            break;

        case '4' :
            partsObj[0] = frmNWDR.selModelH264_4;
            partsObj[1] = frmNWDR.selResoH264_4;
            partsObj[2] = frmNWDR.selScanH264_4;
            partsObj[3] = frmNWDR.selPrioH264_4;
            partsObj[4] = frmNWDR.selQualH264_4;
            partsObj[5] = frmNWDR.selKbpsH264_4;
            break;
    }
}


function uiInitH264(no, model, reso) {
    uiSetH264Model(no, model);
    var scan = uiSetH264ScanIndex(no, model, null);
    reso = uiSetH264ResoIndex(no, model, scan, reso);
    var prio = uiSetH264PrioIndex(no, model, null);
    var qual = uiSetH264QualIndex(no, model, prio, null);
    uiSetH264bpsIndex(no, model, scan, reso, prio, qual, null);
}


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

    uiGetH264Object(no, objParts);

    if (app_dst == 'ja') {
        objParts[0].length = camInfo_H264.length - VSeriesNum;
    } else {
        objParts[0].length = camInfo_H264.length;
    }

    var idx2 = 0;
    for (var idx = 0; idx < objParts[0].length; idx++) {
        objParts[0].options[idx].value = idx2;
        objParts[0].options[idx].text = camInfo_H264[idx2][0];

        if ((app_dst == 'ja') && (idx == (H265Num_h264 - 1))) {
            idx2 = idx2 + VSeriesNum;
        }
        idx2++;
    }
    if (app_dst == 'ja' && model > (H265Num_h264 - 1) + VSeriesNum) {
        objParts[0].selectedIndex = model - VSeriesNum;
    } else {
        objParts[0].selectedIndex = model;
    }
}


function uiChangeH264(no, item) {
    var objParts = new Array();

    uiGetH264Object(no, objParts);

    var model = Number(objParts[0].options[objParts[0].selectedIndex].value);
    var sscan = objParts[2].options[objParts[2].selectedIndex].text;
    var sreso = objParts[1].options[objParts[1].selectedIndex].text;
    var sprio = objParts[3].options[objParts[3].selectedIndex].text;
    var squal = objParts[4].options[objParts[4].selectedIndex].text;
    var bitrate = objParts[5].options[objParts[5].selectedIndex].value;

    uiInitH264(no, model, null);

    var scan = uiSelectH264ScanText(no, sscan);

    uiSetH264ResoIndex(no, model, scan, null);
    var reso = uiSelectH264ResoText(no, sreso);

    uiSetH264PrioIndex(no, model, null);
    var prio = uiSelectH264PrioText(no, model, sprio);

    uiSetH264QualIndex(no, model, prio, null);
    var qual = uiSetH264QualText(no, squal);

    uiSetH264bpsIndex(no, model, scan, reso, prio, qual, null);
    uiSetH264bpsValue(no, model, scan, reso, prio, qual, bitrate);

    calcdata(); 

}


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

    uiGetH264Object(no, objParts);

    objParts[1].length = camInfo_H264[model][1][scan + 1][1].length - 1;
    for (var idx = 0; idx < objParts[1].length; idx++) {
        objParts[1].options[idx].value = idx;
        objParts[1].options[idx].text =
            camInfo_H264[model][1][scan + 1][1][idx + 1];
    }
    if (null == reso) {
        objParts[1].selectedIndex = camInfo_H264[model][1][scan + 1][1][0];
    } else {
        objParts[1].selectedIndex = reso;
    }

    return objParts[1].selectedIndex;
}


function uiSelectH264ResoText(no, sreso) {
    var objParts = new Array();

    uiGetH264Object(no, objParts);

    for (var idx = 0; idx < objParts[1].length; idx++) {
        if (sreso == objParts[1].options[idx].text) {
            objParts[1].selectedIndex = idx;
            break;
        }
    }

    return objParts[1].selectedIndex;
}


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

    uiGetH264Object(no, objParts);

    objParts[2].length = camInfo_H264[model][1].length - 1;
    for (var idx = 0; idx < objParts[2].length; idx++) {
        objParts[2].options[idx].value = idx;
        objParts[2].options[idx].text = camInfo_H264[model][1][idx + 1][0];
    }
    if (null == scan) {
        objParts[2].selectedIndex = camInfo_H264[model][1][0][0];
    } else {
        objParts[2].selectedIndex = scan;
    }

    return objParts[2].selectedIndex;
}


function uiSelectH264ScanText(no, sscan) {
    var objParts = new Array();

    uiGetH264Object(no, objParts);

    for (var idx = 0; idx < objParts[2].length; idx++) {
        if (sscan == objParts[2].options[idx].text) {
            objParts[2].selectedIndex = idx;
            break;
        }
    }

    return objParts[2].selectedIndex;
}


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

    uiGetH264Object(no, objParts);

    if (model == camKind_H264_V23 || model == camKind_H264_V63 ||
        model == camKind_H264_V17) {
        objParts[3].length = 1;
    } else {
        objParts[3].length = camInfo_H264[model][2].length - 1;
    }
    for (var idx = 0; idx < objParts[3].length; idx++) {
        objParts[3].options[idx].value = idx;
        objParts[3].options[idx].text = camInfo_H264[model][2][idx + 1][0];
    }
    if (null == prio) {
        objParts[3].selectedIndex = camInfo_H264[model][2][0][0];
    } else {
        objParts[3].selectedIndex = prio;
    }

    return objParts[3].selectedIndex;
}


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

    uiGetH264Object(no, objParts);

    for (var idx = 0; idx < objParts[3].length; idx++) {
        if (sprio == objParts[3].options[idx].text) {
            objParts[3].selectedIndex = idx;
            break;
        }
    }

    return objParts[3].selectedIndex;
}


function uiSetH264QualIndex(no, model, prio, qual) {
    var objParts = new Array();

    uiGetH264Object(no, objParts);

    objParts[4].length = camInfo_H264[model][2][prio + 1][1].length - 1;
    for (var idx = 0; idx < objParts[4].length; idx++) {
        objParts[4].options[idx].value = idx;
        objParts[4].options[idx].text =
            camInfo_H264[model][2][prio + 1][1][idx + 1];
    }
    if (null == qual) {
        objParts[4].selectedIndex = camInfo_H264[model][2][prio + 1][1][0];
    } else {
        objParts[4].selectedIndex = qual;
    }

    return objParts[4].selectedIndex;
}


function uiSetH264QualText(no, squal) {
    var objParts = new Array();

    uiGetH264Object(no, objParts);

    for (var idx = 0; idx < objParts[4].length; idx++) {
        if (squal == objParts[4].options[idx].text) {
            objParts[4].selectedIndex = idx;
            break;
        }
    }

    return objParts[4].selectedIndex;
}


function uiSetH264bpsIndex(no, model, scan, reso, prio, qual, bitrate) {
    var objParts = new Array();

    uiGetH264Object(no, objParts);

    var tblBitrate = camBitrate_H264[model][scan][prio][reso][qual];

    objParts[5].length = tblBitrate.length - 1;
    for (var idx = 0; idx < objParts[5].length; idx++) {
        var dspbitrate = tblBitrate[idx + 1][0];
        if (0 == tblBitrate[idx + 1][1]) {
            objParts[5].options[idx].value = tblBitrate[idx + 1][0]; 
        } else {
            objParts[5].options[idx].value = tblBitrate[idx + 1][1]; 
            dspbitrate += '(' + tblBitrate[idx + 1][1] + ')';
        }
        var dspfps = '';
        if (model != camKind_H264_V23 && model != camKind_H264_V63 &&
            model != camKind_H264_V17) {
            if (0 == prio) {
                dspfps += s_cam_ips_max;
            }
        }
        if (0 == tblBitrate[idx + 1][2]) {
            dspfps += s_cam_ips_none;
        } else {
            if (model == camKind_H264_U11300) {
                if ((frmNWDR.chkaudio.checked == true) && (document.getElementById('camRecAudio_AACLC').checked == true)) {
                    if (tblBitrate[idx + 1][2] == 30) {
                        dspfps += 15 + s_cam_ips;
                        CALC_AUDIOAACLDSELECTED = true;
                    } else if (tblBitrate[idx + 1][2] == 25) {
                        dspfps += 12.5 + s_cam_ips;
                        CALC_AUDIOAACLDSELECTED = true;
                    } else {
                        dspfps += tblBitrate[idx + 1][2] + s_cam_ips;
                    }
                } else {
                    dspfps += tblBitrate[idx + 1][2] + s_cam_ips;
                }
            } else {
                dspfps += tblBitrate[idx + 1][2] + s_cam_ips;
            }
        }
        if (1 == tblBitrate[idx + 1][3]) {
            objParts[5].options[idx].text =
                dspbitrate +
                s_cam_bitrate_kbps +
                s_space +
                dspfps;
        } else {
            objParts[5].options[idx].text =
                dspbitrate +
                s_cam_bitrate_kbps +
                s_mark_notice +
                s_space +
                dspfps;
        }
    }
    if (null == bitrate) {
        objParts[5].selectedIndex = tblBitrate[0][0];
    } else {
        objParts[5].selectedIndex = bitrate;
    }

    var FpsIdx = objParts[5].selectedIndex;
    Framerate[Number(no) + 4] = tblBitrate[FpsIdx + 1][2];

    return objParts[5].selectedIndex;
}


function uiSetH264bpsValue(no, model, scan, reso, prio, qual, bitrate) {
    var objParts = new Array();

    uiGetH264Object(no, objParts);

    var tblBitrate = camBitrate_H264[model][scan][prio][reso][qual];

    for (var idx = 0; idx < objParts[5].length; idx++) {
        if (bitrate == objParts[5].options[idx].value) {
            objParts[5].selectedIndex = idx;
            Framerate[Number(no) + 4] = tblBitrate[idx + 1][2];
            break;
        }
    }

    return objParts[5].selectedIndex;
}


function uiGetJpegObject(no, partsObj) {
    switch (no) {
        case '1' :
            partsObj[0] = frmNWDR.selModelJpeg_1;
            partsObj[1] = frmNWDR.selResoJpeg_1;
            partsObj[2] = frmNWDR.selScanJpeg_1;
            partsObj[3] = frmNWDR.selQualJpeg_1;
            partsObj[4] = frmNWDR.selFpsJpeg_1;
            partsObj[5] = frmNWDR.txtMbpsJpeg_1;
            break;

        case '2' :
            partsObj[0] = frmNWDR.selModelJpeg_2;
            partsObj[1] = frmNWDR.selResoJpeg_2;
            partsObj[2] = frmNWDR.selScanJpeg_2;
            partsObj[3] = frmNWDR.selQualJpeg_2;
            partsObj[4] = frmNWDR.selFpsJpeg_2;
            partsObj[5] = frmNWDR.txtMbpsJpeg_2;
            break;

        case '3' :
            partsObj[0] = frmNWDR.selModelJpeg_3;
            partsObj[1] = frmNWDR.selResoJpeg_3;
            partsObj[2] = frmNWDR.selScanJpeg_3;
            partsObj[3] = frmNWDR.selQualJpeg_3;
            partsObj[4] = frmNWDR.selFpsJpeg_3;
            partsObj[5] = frmNWDR.txtMbpsJpeg_3;
            break;

        case '4' :
            partsObj[0] = frmNWDR.selModelJpeg_4;
            partsObj[1] = frmNWDR.selResoJpeg_4;
            partsObj[2] = frmNWDR.selScanJpeg_4;
            partsObj[3] = frmNWDR.selQualJpeg_4;
            partsObj[4] = frmNWDR.selFpsJpeg_4;
            partsObj[5] = frmNWDR.txtMbpsJpeg_4;
            break;
    }
}


function uiInitJpeg(no, model, reso) {

    uiSetJpegModelIndex(no, model);
    var scan = uiSetJpegScanIndex(no, model, null);
    reso = uiSetJpegResoIndex(no, model, scan, reso);
    var qual = uiSetJpegQualIndex(no, model, scan, reso, null, null);
    uiSetJpegRecFps(no, model, scan, reso, null);
    uiSetJpegBpsValue(no, model);
}


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

    uiGetJpegObject(no, objParts);

    if (app_dst == 'ja') {
        objParts[0].length = camInfo_Jpeg.length - VSeriesNum;
    } else {
        objParts[0].length = camInfo_Jpeg.length;
    }

    var idx2 = 0;
    for (var idx = 0; idx < objParts[0].length; idx++) {
        objParts[0].options[idx].value = idx2;
        objParts[0].options[idx].text = camInfo_Jpeg[idx2][0];

        if ((app_dst == 'ja') && (idx == (H265Num_jpeg - 1))) {
            idx2 = idx2 + VSeriesNum;
        }
        idx2++;
    }
    if (app_dst == 'ja' && model > (H265Num_jpeg - 1) + VSeriesNum) {
        objParts[0].selectedIndex = model - VSeriesNum;
    } else {
        objParts[0].selectedIndex = model;
    }
}


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

    uiGetJpegObject(no, objParts);

    var model = Number(objParts[0].options[objParts[0].selectedIndex].value);
    var sscan = objParts[2].options[objParts[2].selectedIndex].text;
    var sreso = objParts[1].options[objParts[1].selectedIndex].text;
    var squal = objParts[3].options[objParts[3].selectedIndex].text;
    var recfps = objParts[4].options[objParts[4].selectedIndex].value;

    uiInitJpeg(no, model, null);

    var scan = uiSelectJpegScanText(no, sscan);
    uiSetJpegResoIndex(no, model, scan, null);
    var reso = uiSelectJpegResoText(no, sreso);

    uiSetJpegQualIndex(no, model, scan, reso, recfps, null);
    var qual = uiSetJpegQualText(no, squal);

    uiSetJpegRecFps(no, model, scan, reso, null);
    uiSetJpegRecFpsValue(no, recfps);

    uiSetJpegBpsValue(no, model);

    if (no == 1) {
        frmNWDR.txtMbpsJpeg_1.value = Number(frmNWDR.txtMbpsJpeg_1.value).toLocaleString();
    } else if (no == 2) {
        frmNWDR.txtMbpsJpeg_2.value = Number(frmNWDR.txtMbpsJpeg_2.value).toLocaleString();
    } else if (no == 3) {
        frmNWDR.txtMbpsJpeg_3.value = Number(frmNWDR.txtMbpsJpeg_3.value).toLocaleString();
    } else if (no == 4) {
        frmNWDR.txtMbpsJpeg_4.value = Number(frmNWDR.txtMbpsJpeg_4.value).toLocaleString();
    }

    calcdata(); 
}


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

    uiGetJpegObject(no, objParts);

    if (model == camKind_Jpeg_V23 || model == camKind_Jpeg_V63 ||
        model == camKind_Jpeg_V17) {
        objParts[1].length = 2;
    } else {
        objParts[1].length = camInfo_Jpeg[model][1][scan + 1][1].length - 1;
    }
    for (var idx = 0; idx < objParts[1].length; idx++) {
        objParts[1].options[idx].value = idx;
        if (model == camKind_Jpeg_V23 || model == camKind_Jpeg_V63 ||
            model == camKind_Jpeg_V17) {
            objParts[1].options[idx].text =
                camInfo_Jpeg[model][1][scan + 1][1][(idx * 7) + 1];
        } else {
            objParts[1].options[idx].text =
                camInfo_Jpeg[model][1][scan + 1][1][idx + 1];
        }
    }
    if (null == reso) {
        objParts[1].selectedIndex = camInfo_Jpeg[model][1][scan + 1][1][0];
    } else {
        objParts[1].selectedIndex = reso;
    }

    return objParts[1].selectedIndex;
}


function uiSelectJpegResoText(no, sreso) {
    var objParts = new Array();

    uiGetJpegObject(no, objParts);

    for (var idx = 0; idx < objParts[1].length; idx++) {
        if (sreso == objParts[1].options[idx].text) {
            objParts[1].selectedIndex = idx;
            break;
        }
    }

    return objParts[1].selectedIndex;
}


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

    uiGetJpegObject(no, objParts);

    objParts[2].length = camInfo_Jpeg[model][1].length - 1;
    for (var idx = 0; idx < objParts[2].length; idx++) {
        objParts[2].options[idx].value = idx;
        objParts[2].options[idx].text = camInfo_Jpeg[model][1][idx + 1][0];
    }
    if (null == scan) {
        objParts[2].selectedIndex = camInfo_Jpeg[model][1][0][0];
    } else {
        objParts[2].selectedIndex = scan;
    }

    return objParts[2].selectedIndex;
}


function uiSelectJpegScanText(no, sscan) {
    var objParts = new Array();

    uiGetJpegObject(no, objParts);

    for (var idx = 0; idx < objParts[2].length; idx++) {
        if (sscan == objParts[2].options[idx].text) {
            objParts[2].selectedIndex = idx;
            break;
        }
    }

    return objParts[2].selectedIndex;
}


function uiSetJpegQualIndex(no, model, scan, reso, recfps, qual) {
    var objParts = new Array();

    uiGetJpegObject(no, objParts);

    var reso_w = reso;

    if (model == camKind_Jpeg_V23 || model == camKind_Jpeg_V63 ||
        model == camKind_Jpeg_V17) {
        reso_w = reso_w * 7;
        switch (Number(recfps)) {
            case 2:
                reso_w = reso_w + 1;
                break;
            case 3:
                reso_w = reso_w + 2;
                break;
            case 5:
                reso_w = reso_w + 3;
                break;
            case 10:
                reso_w = reso_w + 4;
                break;
            case 15:
                reso_w = reso_w + 5;
                break;
            case 30:
                reso_w = reso_w + 6;
                break;
            default:
                break;
        }
    }

    objParts[3].length = camQuality_Jpeg[model][scan][reso_w].length - 1;
    for (var idx = 0; idx < objParts[3].length; idx++) {
        objParts[3].options[idx].value =
            camQuality_Jpeg[model][scan][reso_w][idx + 1][2] +
            s_space +
            camQuality_Jpeg[model][scan][reso_w][idx + 1][1];

        var listtext =
            camQuality_Jpeg[model][scan][reso_w][idx + 1][0];
        switch (camQuality_Jpeg[model][scan][reso_w][idx + 1][3]) {
            case 1:
                listtext += s_mark_support_sf;
                break;

            case 2:
                listtext += s_mark_support_fq;
                break;

            case 3:
                listtext += s_mark_support_nq;
                break;

            default:
                break;
        }

        if (model == camKind_Jpeg_V23 || model == camKind_Jpeg_V63 ||
            model == camKind_Jpeg_V17) {
            objParts[3].options[idx].text =
                listtext;
        } else {
            listtext += s_separator;
            objParts[3].options[idx].text =
                listtext +
                s_space +
                camQuality_Jpeg[model][scan][reso_w][idx + 1][2] +
                s_cam_ips +
                s_space +
                camQuality_Jpeg[model][scan][reso_w][idx + 1][1] +
                s_cam_kb;
        }
    }
    if (null == qual) {
        objParts[3].selectedIndex = camQuality_Jpeg[model][scan][reso_w][0][0];
    } else {
        objParts[3].selectedIndex = qual;
    }

    return objParts[3].selectedIndex;
}


function uiSetJpegQualText(no, squal) {
    var objParts = new Array();

    uiGetJpegObject(no, objParts);


    var chkqual = squal.slice(0, 1);
    chkqual = Number(chkqual);
    if ((chkqual == 1) || (chkqual == 2) || (chkqual == 3) ||
        (chkqual == 4) || (chkqual == 5) || (chkqual == 6) ||
        (chkqual == 7) || (chkqual == 8) || (chkqual == 9)) {
        chkqual = 1;
    } else {
        chkqual = 0;
    }

    if (chkqual == 1) {
        var orgqual = squal.slice(0, 1);
    } else {
        var orgqual = squal.slice(0, 4);
    }

    for (var idx = 0; idx < objParts[3].length; idx++) {

        if (chkqual == 1) {
            var listqual = objParts[3].options[idx].text.slice(0, 1);
        } else {
            var listqual = objParts[3].options[idx].text.slice(0, 4);
        }

        if (orgqual == listqual) {
            objParts[3].selectedIndex = idx;
            break;
        }
    }

    return objParts[3].selectedIndex;
}


function uiSetJpegRecFps(no, model, scan, reso, recfps) {
    var objParts = new Array();

    uiGetJpegObject(no, objParts);

    var qual = objParts[3].value;
    var qualfps = Number(qual.slice(0, 3));
    if (model == camKind_Jpeg_V23 || model == camKind_Jpeg_V63 ||
        model == camKind_Jpeg_V17) {
        qualfps = 5;
    }

    objParts[4].length = 0;

    var useMaxFpsFlag = 0;
    var fps_idx = 0;
    var fps_num = camRecFps_Jpeg.length - 1;

    for (var idx = 0; idx < fps_num; idx++) {
        if (camRecFps_Jpeg[idx + 1][0] <= qualfps) {
            if ((camRecFps_Jpeg[idx + 1][0] != qualfps) &&
                (0 == useMaxFpsFlag)) {

                objParts[4].length++;

                objParts[4].options[fps_idx].value = qualfps;
                objParts[4].options[fps_idx].text =
                    qualfps + s_cam_ips + s_space + s_mark_notice;

                useMaxFpsFlag = 1;
                fps_idx++;
            }

            objParts[4].length++;

            objParts[4].options[fps_idx].value = camRecFps_Jpeg[idx + 1][0];
            var listtext =
                    camRecFps_Jpeg[idx + 1][0] +
                    s_cam_ips;
            if (0 == camRecFps_Jpeg[idx + 1][1]) {
                listtext +=
                    s_space +
                    s_mark_notice;
            }
            if (model == camKind_Jpeg_V23 || model == camKind_Jpeg_V63 ||
                model == camKind_Jpeg_V17) {
                listtext +=
                    s_separator +
                    Number(camQuality_Jpeg[model][scan][(reso * 7) + (6 - idx)][objParts[3].selectedIndex + 1][1]) +
                    s_cam_bitrate_kbps;
            }
            objParts[4].options[fps_idx].text = listtext;

            useMaxFpsFlag = 1;
            fps_idx++;
        }
    }
    var fps;
    if (null == recfps) {
        fps = camRecFps_Jpeg[0][0];
    } else {
        fps = recfps;
    }

    return uiSetJpegRecFpsValue(no, fps);
}


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

    uiGetJpegObject(no, objParts);

    for (var idx = 0; idx < objParts[4].length; idx++) {
        if (fps == objParts[4].options[idx].value) {
            objParts[4].selectedIndex = idx;
            break;
        }
    }

    return objParts[4].selectedIndex;
}


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

    uiGetJpegObject(no, objParts);

    var uiJpegSizeKB = Number(objParts[3].value.slice(4));

    var uiJpegFps = Number(objParts[4].value);

    if (model == camKind_Jpeg_V23 || model == camKind_Jpeg_V63 ||
        model == camKind_Jpeg_V17) {
        var base_bitrateKbps = Number(objParts[3].value.slice(4));
    } else {
        var uiJpegSizeKB = Number(objParts[3].value.slice(4));

        var base_bitrateKbps = uiJpegSizeKB * uiJpegFps * 8;
    }

    var calcRecMbps = base_bitrateKbps / 1000;
    var calcBandMbps = calcRecMbps * defGetaJpeg;

    var dispRecMbps = base_bitrateKbps / 1024;
    var dispBandMbps = dispRecMbps * defGetaJpeg;

    objParts[5].value = NumberToFixed(dispBandMbps, 3);

    var diffGetaMbps = calcBandMbps - (calcBandMbps / defGetaJpeg);
    gCalcRecJpegMbps[Number(no) - 1] = calcBandMbps;
    gCalcRecJpegMbps[Number(no) - 1] -= diffGetaMbps;
    gCalcBandJpegMbps[Number(no) - 1] = calcBandMbps;

    diffGetaMbps = dispBandMbps - (dispBandMbps / defGetaJpeg);
    gDispJpegRecMbps[Number(no) - 1] = dispBandMbps;
    if (8 != objParts[0].selectedIndex) {
        gDispJpegRecMbps[Number(no) - 1] -= diffGetaMbps;
    }
    gDispBandJpegMbps[Number(no) - 1] = dispBandMbps;
}


function uiGetMpeg4Object(no, partsObj) {
    switch (no) {
        case '1' :
            partsObj[0] = frmNWDR.selModelMpg4_1;
            partsObj[1] = frmNWDR.selResoMpg4_1;
            partsObj[2] = frmNWDR.selScanMpg4_1;
            partsObj[3] = frmNWDR.selPrioMpg4_1;
            partsObj[4] = frmNWDR.selQualMpg4_1;
            partsObj[5] = frmNWDR.selKbpsMpg4_1;
            break;
    }
}


function uiInitMpeg4(no, model) {
    uiSetMpeg4Model(no, model);
    var scan = uiSetMpeg4ScanIndex(no, model, null);
    var reso = uiSetMpeg4ResoIndex(no, model, scan, null);
    var prio = uiSetMpeg4PrioIndex(no, model, null);
    var qual = uiSetMpeg4QualIndex(no, model, prio, null);
    uiSetMpeg4Bitrate(no, model, scan, reso, prio, qual, null);
}


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

    uiGetMpeg4Object(no, objParts);

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


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

    uiGetMpeg4Object(no, objParts);

    var model = Number(objParts[0].options[objParts[0].selectedIndex].value);
    var sscan = objParts[2].options[objParts[2].selectedIndex].text;
    var sreso = objParts[1].options[objParts[1].selectedIndex].text;
    var sprio = objParts[3].options[objParts[3].selectedIndex].text;
    var squal = objParts[4].options[objParts[4].selectedIndex].text;
    var bitrate = objParts[5].options[objParts[5].selectedIndex].value;

    uiInitMpeg4(no, model);

    var scan = uiSelectMpeg4ScanText(no, sscan);

    uiSetMpeg4ResoIndex(no, model, scan, null);
    var reso = uiSelectMpeg4ResoText(no, sreso);

    uiSetMpeg4PrioIndex(no, model, null);
    var prio = uiSelectMpeg4PrioText(no, sprio);

    uiSetMpeg4QualIndex(no, model, prio, null);
    var qual = uiSetMpeg4QualText(no, squal);

    uiSetMpeg4Bitrate(no, model, scan, reso, prio, qual, null);
    uiSetMpeg4bpsValue(no, bitrate);

    calcdata(); 
}


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

    uiGetMpeg4Object(no, objParts);

    objParts[1].length = camInfo_Mpeg4[model][1][scan + 1][1].length - 1;
    for (var idx = 0; idx < objParts[1].length; idx++) {
        objParts[1].options[idx].value = idx;
        objParts[1].options[idx].text =
            camInfo_Mpeg4[model][1][scan + 1][1][idx + 1];
    }
    if (null == reso) {
        objParts[1].selectedIndex = camInfo_Mpeg4[model][1][scan + 1][1][0];
    } else {
        objParts[1].selectedIndex = reso;
    }

    return objParts[1].selectedIndex;
}


function uiSelectMpeg4ResoText(no, sreso) {
    var objParts = new Array();

    uiGetMpeg4Object(no, objParts);

    for (var idx = 0; idx < objParts[1].length; idx++) {
        if (sreso == objParts[1].options[idx].text) {
            objParts[1].selectedIndex = idx;
            break;
        }
    }

    return objParts[1].selectedIndex;
}


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

    uiGetMpeg4Object(no, objParts);

    objParts[2].length = camInfo_Mpeg4[model][1].length - 1;
    for (var idx = 0; idx < objParts[2].length; idx++) {
        objParts[2].options[idx].value = idx;
        objParts[2].options[idx].text = camInfo_Mpeg4[model][1][idx + 1][0];
    }
    if (null == scan) {
        objParts[2].selectedIndex = camInfo_Mpeg4[model][1][0][0];
    } else {
        objParts[2].selectedIndex = scan;
    }

    return objParts[2].selectedIndex;
}


function uiSelectMpeg4ScanText(no, sscan) {
    var objParts = new Array();

    uiGetMpeg4Object(no, objParts);

    for (var idx = 0; idx < objParts[2].length; idx++) {
        if (sscan == objParts[2].options[idx].text) {
            objParts[2].selectedIndex = idx;
            break;
        }
    }

    return objParts[2].selectedIndex;
}


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

    uiGetMpeg4Object(no, objParts);

    objParts[3].length = camInfo_Mpeg4[model][2].length - 1;
    for (var idx = 0; idx < objParts[3].length; idx++) {
        objParts[3].options[idx].value = idx;
        objParts[3].options[idx].text = camInfo_Mpeg4[model][2][idx + 1][0];
    }
    if (null == prio) {
        objParts[3].selectedIndex = camInfo_Mpeg4[model][2][0][0];
    } else {
        objParts[3].selectedIndex = prio;
    }

    return objParts[3].selectedIndex;
}


function uiSelectMpeg4PrioText(no, sprio) {
    var objParts = new Array();

    uiGetMpeg4Object(no, objParts);

    for (var idx = 0; idx < objParts[3].length; idx++) {
        if (sprio == objParts[3].options[idx].text) {
            objParts[3].selectedIndex = idx;
            break;
        }
    }

    return objParts[3].selectedIndex;
}


function uiSetMpeg4QualIndex(no, model, prio, qual) {
    var objParts = new Array();

    uiGetMpeg4Object(no, objParts);

    objParts[4].length = camInfo_Mpeg4[model][2][prio + 1][1].length - 1;
    for (var idx = 0; idx < objParts[4].length; idx++) {
        objParts[4].options[idx].value = idx;
        objParts[4].options[idx].text =
            camInfo_Mpeg4[model][2][prio + 1][1][idx + 1];
    }
    if (null == qual) {
        objParts[4].selectedIndex = camInfo_Mpeg4[model][2][prio + 1][1][0];
    } else {
        objParts[4].selectedIndex = qual;
    }

    return objParts[4].selectedIndex;
}


function uiSetMpeg4QualText(no, squal) {
    var objParts = new Array();

    uiGetMpeg4Object(no, objParts);

    for (var idx = 0; idx < objParts[4].length; idx++) {
        if (squal == objParts[4].options[idx].text) {
            objParts[4].selectedIndex = idx;
            break;
        }
    }

    return objParts[4].selectedIndex;
}


function uiSetMpeg4Bitrate(no, model, scan, reso, prio, qual, bitrate) {
    var objParts = new Array();

    uiGetMpeg4Object(no, objParts);

    var tblBitrate = camBitrate_Mpeg4[model][scan][prio][reso][qual];

    objParts[5].length = tblBitrate.length - 1;
    for (var idx = 0; idx < objParts[5].length; idx++) {
        var dspbitrate = tblBitrate[idx + 1][0];
        if (0 == tblBitrate[idx + 1][1]) {
            objParts[5].options[idx].value = tblBitrate[idx + 1][0]; 
        } else {
            objParts[5].options[idx].value = tblBitrate[idx + 1][1]; 
            dspbitrate += '(' + tblBitrate[idx + 1][1] + ')';
        }
        var dspfps = '';
        if (0 == tblBitrate[idx + 1][2]) {
            dspfps = s_cam_ips_none;
        } else {
            var vmdfps = 15;
            if (3 <= model && model <= 5) {
                if (vmdfps > tblBitrate[idx + 1][2]) {
                    vmdfps = tblBitrate[idx + 1][2];
                }
            } else {
                    vmdfps = tblBitrate[idx + 1][2];
            }
            if (0 == prio) {
                dspfps += s_cam_ips_max;
            }
            dspfps += vmdfps + s_cam_ips;
        }
        objParts[5].options[idx].text =
            dspbitrate +
            s_cam_bitrate_kbps +
            s_mark_notice +
            s_space +
            dspfps;
    }
    if (null == bitrate) {
        objParts[5].selectedIndex = tblBitrate[0][0];
    } else {
        objParts[5].selectedIndex = bitrate;
    }

    return objParts[5].selectedIndex;
}


function uiSetMpeg4bpsValue(no, bitrate) {
    var objParts = new Array();

    uiGetMpeg4Object(no, objParts);

    for (var idx = 0; idx < objParts[5].length; idx++) {
        if (bitrate == objParts[5].options[idx].value) {
            objParts[5].selectedIndex = idx;
            break;
        }
    }

    return objParts[5].selectedIndex;
}


function uiGetFaceObject(no, partsObj) {
    switch (no) {
        case '1' :
            partsObj[0] = frmNWDR.selResoFace_1;
            partsObj[1] = frmNWDR.selQualFace_1;
            partsObj[2] = frmNWDR.selFpsFace_1;
            partsObj[3] = frmNWDR.selKbpsFace_1;
            break;
    }
}


function uiInitFace(no, model) {
    uiSetFaceReso(no, null);
    uiSetFaceQual(no, null);
    uiSetFaceRecFps(no, null);
    uiSetFaceBps(no, null);
}


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

    uiGetFaceObject(no, objParts);

    objParts[0].length = camInfo_Face[0][0].length - 1;
    for (var idx = 0; idx < objParts[0].length; idx++) {
        objParts[0].options[idx].value = idx;
        objParts[0].options[idx].text = camInfo_Face[0][0][idx + 1];
    }
    if (null == reso) {
        objParts[0].selectedIndex = camInfo_Face[0][0][0];
    } else {
        objParts[0].selectedIndex = reso;
    }

    return objParts[0].selectedIndex;
}


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

    uiGetFaceObject(no, objParts);

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

    return objParts[1].selectedIndex;
}


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

    uiGetFaceObject(no, objParts);

    objParts[2].length = camInfo_Face[0][2].length - 1;
    for (var idx = 0; idx < objParts[2].length; idx++) {
        objParts[2].options[idx].value = camInfo_Face[0][2][idx + 1];
        objParts[2].options[idx].text =
            camInfo_Face[0][2][idx + 1] + s_cam_ips;
    }
    if (null == fps) {
        objParts[2].selectedIndex = camInfo_Face[0][2][0];
    } else {
        objParts[2].selectedIndex = fps;
    }

    return objParts[2].selectedIndex;
}


function uiSetFaceBps(no, bitrate) {
    var objParts = new Array();

    uiGetFaceObject(no, objParts);

    objParts[3].length = camInfo_Face[0][3].length - 1;
    for (var idx = 0; idx < objParts[3].length; idx++) {
        objParts[3].options[idx].value = camInfo_Face[0][3][idx + 1];
        objParts[3].options[idx].text =
            camInfo_Face[0][3][idx + 1] + s_cam_bitrate_kbps;
    }
    if (null == bitrate) {
        objParts[3].selectedIndex = camInfo_Face[0][3][0];
    } else {
        objParts[3].selectedIndex = bitrate;
    }

    return objParts[3].selectedIndex;
}

function uiRecHourChange() {

    uiChangeH264VbrTimeAllocation('1');
    uiChangeH264VbrTimeAllocation('2');
    uiChangeH264VbrTimeAllocation('3');

    calcdata();
}

function uiHDDchange(obj) {
    var capa = obj.value;
    var raid =
        frmNWDR.sel_RAID.options[
            frmNWDR.sel_RAID.selectedIndex
        ].value;
    if (app_dst != 'ja') {
        frmNWDR.chksubstream.disabled = 0;
    }
    if (app_dst != 'zh') {
      frmNWDR.chkhttps.disabled = 0;
      frmNWDR.chkencdata.disabled = 0;
    }

    switch (Number(capa)) {
        case 500:
        case 1500:
        case 1000:
        case 2000:
        case 3000:
        case 4000:
        case 5000:
        case 6000:
        case 8000:
            frmNWDR.sel_RAID.length = 4;
            frmNWDR.sel_RAID.options[0].text = sel_raid_str[0]; 
            frmNWDR.sel_RAID.options[0].value = 0;
            frmNWDR.sel_RAID.options[1].text = sel_raid_str[1]; 
            frmNWDR.sel_RAID.options[1].value = 1;
            frmNWDR.sel_RAID.options[2].text = sel_raid_str[2]; 
            frmNWDR.sel_RAID.options[2].value = 5;
            frmNWDR.sel_RAID.options[3].text = sel_raid_str[3]; 
            frmNWDR.sel_RAID.options[3].value = 6;

            if (raid == 1)
                frmNWDR.sel_RAID.selectedIndex = 1;
            else if (raid == 5)
                frmNWDR.sel_RAID.selectedIndex = 2;
            else if (raid == 6)
                frmNWDR.sel_RAID.selectedIndex = 3;
            else
                frmNWDR.sel_RAID.selectedIndex = 0;
            break;

        default:
            frmNWDR.chkvmd.disabled = 'disabled';
            frmNWDR.sel_RAID.length = 2;
            frmNWDR.sel_RAID.options[0].text = sel_raid_str[0]; 
            frmNWDR.sel_RAID.options[0].value = 0;
            frmNWDR.sel_RAID.options[1].text = sel_raid_str[1]; 
            frmNWDR.sel_RAID.options[1].value = 1;

            if (raid == 1)
                frmNWDR.sel_RAID.selectedIndex = 1;
            else
                frmNWDR.sel_RAID.selectedIndex = 0;
            break;
    } 

    calcdata(); 
}

function uiRaidChange(obj) {
    calcdata(); 
}

function uiCboxSubStreamClick() {

    calcdata(); 
}

function uiCboxAudioClick() {

    calcdata(); 
}

function uiCboxHttpsClick() {

    calcdata(); 
}

function uiCboxEncdataClick() {

    calcdata(); 
}

function uiCboxDetailClick() {
    calcdata(); 
}

function uiAllResultGrayOut() {
    frmNWDR.txttotalbit.value = '-';
    frmNWDR.txttotalbit.style.background = '#C8C8C8';
    frmNWDR.txttotalcap.value = '-';
    frmNWDR.txttotalcap.style.background = '#C8C8C8';

    resultDetailNX400.innerHTML = '<br />';

    dataNX400out();
}

function uiAllResultInit() {
    frmNWDR.txttotalbit.value = '';
    frmNWDR.txttotalbit.style.background = '#FFFF80';

    frmNWDR.txttotalcap.value = '';
    frmNWDR.txttotalcap.style.background = '#FFFF80';
}

function uiMsgDialogPopup(msg, level) {
    if (getBrowserVersion() == 6) {
        alert(msg);
    } else {
        if (level == 1) {
            jInfomsg(msg, INFOMSGTIPS);
        }
        else if (level == 2) {
            jAlert(msg, INFOMSGTIPS);
        }
        else {
            jConfirm(msg, INFOMSGTIPS, function(ret) {
                if (ret == true) bBrPrioMsg = false;
            });
        }
    }
}
