var currentUpdateNo = -1;

function update(result){
    if (result.updateNo > currentUpdateNo) {
        currentUpdateNo = result.updateNo;

        if ((BankComboAll.comboID[WeldCombinationNumbers.weld_combo_number[CurrentStatus.bankandprogram] - 1] == 151)
           || (BankComboAll.comboID[WeldCombinationNumbers.weld_combo_number[CurrentStatus.bankandprogram] - 1] == 130)) {
            $('#wire_type_alloy').text(result.outws);
        }
        else {
            $('#wire_type_alloy').text(result.outws + ' ' + result.outwt + ' ' + result.outwa);
        }
    }
};

function runUpdates() {
    var request = new HttpRequest("outwt&outws&outwa", update);
};

function setSpoolInfo() {
    var torchLength = ipmToMPM(BankConfig.gunLdLen);
    
    if (MetricEnableCheck.MetricEnable == 1) {
        var kgLeft = poundsToKilograms(SpoolData.poundsLeft[0] / 10);
        var kgSpool = poundsToKilograms(SpoolData.spoolWeight[0] / 10);
        var negLengthMetric = ipmToMPM(WeldCableConfig.negativeLength * 12);
        var posLengthMetric = ipmToMPM(WeldCableConfig.positiveLength * 12);

        $('#db_pounds_remaining').text(kgLeft + " kg");
        $('#db_spool_size').text(kgSpool + " kg");

        if (WeldCableConfig.positiveSize == 0) {
            $('#db_pos').text(posLengthMetric + ' ' + 'Meters' + ' ' + '2/0');
        }
        else {
            $('#db_pos').text(posLengthMetric + ' ' + 'Meters' + ' ' + '4/0');
        }
        if (WeldCableConfig.negativeSize == 0) {
            $('#db_neg').text(negLengthMetric + ' ' + 'Meters' + ' ' + '2/0');
        }
        else {
            $('#db_neg').text(negLengthMetric + ' ' + 'Meters' + ' ' + '4/0');
        }
        $('#db_metric_english_values').text("Metric");
        $('#torch_length_command').text(torchLength + " Meters");
    }
    else {
        $('#db_pounds_remaining').text((SpoolData.poundsLeft[0] / 10) + " Pounds");
        $('#db_spool_size').text((SpoolData.spoolWeight[0] / 10) + " Pounds");

        if (WeldCableConfig.positiveSize == 0) {
            $('#db_pos').text(WeldCableConfig.positiveLength + ' ' + 'Feet' + ' ' + '2/0');
        }
        else {
            $('#db_pos').text(WeldCableConfig.positiveLength + ' ' + 'Feet' + ' ' + '4/0');
        }
        if (WeldCableConfig.negativeSize == 0) {
            $('#db_neg').text(WeldCableConfig.negativeLength + ' ' + 'Feet' + ' ' + '2/0');
        }
        else {
            $('#db_neg').text(WeldCableConfig.negativeLength + ' ' + 'Feet' + ' ' + '4/0');
        }
        $('#db_metric_english_values').text("English");
        $('#torch_length_command').text(BankConfig.gunLdLen + " Inches");
    }
    if (DualFeederCheck.Dual) {
        $('#left_spool_title').text("Wire Spool (Left)");
        $('#left_autothread_title').text("Auto Thread (Left)");

        if (MetricEnableCheck.MetricEnable == 1) {
            var kgLeftRight = poundsToKilograms(SpoolData.poundsLeft[1] / 10);
            var kgSpoolRight = poundsToKilograms(SpoolData.poundsLeft[0] / 10);
            var loadRateRight = ipmToMPM(BankConfigBankTwo.gunLdWFS);
            var torchLengthRight = ipmToMPM(BankConfigBankTwo.gunLdLen);

            $('#db_pounds_remaining_right').text(kgLeftRight + " kg");
            $('#db_spool_size_right').text(kgSpoolRight + " kg");
            $('#load_rate_command_right').text(loadRate + " MPM");
            $('#torch_length_command_right').text(torchLength + " Meters");
        }
        else {
            $('#db_pounds_remaining_right').text((SpoolData.poundsLeft[1] / 10) + " Pounds");
            $('#db_spool_size_right').text((SpoolData.spoolWeight[1] / 10) + " Pounds");
            $('#load_rate_command_right').text(BankConfigBankTwo.gunLdWFS + " IPM");
            $('#torch_length_command_right').text(BankConfigBankTwo.gunLdLen + " Inches");
        }
    }
    else {
        $('#left_spool_title').text("Wire Spool");
        $('#left_autothread_title').text("Auto Thread");
    }
};

function autoCalUpdate() {
    var target;
    var targetTime;
    var i = 0;

    //Check to make sure log is not empty
    if (AutoCalDoneLog != 'AUTO CAL DONE LOG UNAVAILABLE') {
        target = AutoCalDoneLog.times[(AutoCalDoneLog.types.length) - 1].split(" ")[0];
        targetTime = AutoCalDoneLog.times[(AutoCalDoneLog.types.length) - 1].split(" ")[1];
        $('#autocal_datetime_badge').text(target + '/' + targetTime);
    }
    else//empty log
    {
        for (var i = 0; i < RegionAll.regionSelected.length; i++) {
            if (RegionAll.regionSelected[i] == 1) {
                switch (i + 1) {
                    case 1:
                    case 12:
                        target = 'Calibração automática não concluída.';
                        break;

                    case 2:
                        target = 'Auto Calibration Not Completed.';
                        break;

                    case 3:
                        target = 'Automatische kalibratie niet voltooid.';
                        break;

                    case 4:
                        target = 'Auto-calibrage non effectué.';
                        break;

                    case 5:
                        target = 'Automatische Kalibrierung nicht ausgeführt.';
                        break;

                    case 6:
                        target = 'Autocalibrazione non completata.';
                        break;

                    case 7:
                        target = 'Calibración automática incompleta.';
                        break;

                    case 8:
                        target = 'Calibración automática incompleta.';
                        break;

                    case 9:
                        target = 'Auto Calibration Not Completed.';
                        break;

                    case 10:
                        target = 'Auto Calibration Not Completed.';
                        break;

                    case 11:
                        target = 'Auto-calibrage non effectué.';
                        break;

                    case 13:
                        target = '未完成的自动校准。';
                        break;
                }
            }
        }
        targetTime = ' ';
        $('#autocal_datetime_badge').text(target + targetTime);
    }
};

function setLanguage() {
    var headID = document.getElementsByTagName("head")[0];
    var newScript2 = document.createElement('script');
    newScript2.type = 'text/javascript';
    newScript2.async = false;

    for (var q = 0; q < RegionAll.regionSelected.length; q++) {
        if (RegionAll.regionSelected[q] == 1) {
            //For English speaking regions only
            if ((q === 1) || (q === 8) || (q === 9)) {
                if (BankConfig.errorEnables & 8) {
                    $("<li>Arc Start</li>").appendTo('#enabled_error_list');
                }

                if (BankConfig.errorEnables & 16) {
                    $("<li>Arc Error</li>").appendTo('#enabled_error_list');
                }
                if (BankConfig.errorEnables & 512) {
                    $("<li>Wire Stuck</li>").appendTo('#enabled_error_list');
                }
                if (BankConfig.errorEnables & 4) {
                    $("<li>Wire Speed</li>").appendTo('#enabled_error_list');
                }

                if (BankConfig.errorEnables & 2) {
                    $("<li>Motor Over Current</li>").appendTo('#enabled_error_list');
                }

                if (BankConfig.errorEnables & 64) {
                    $("<li>Coolant Flow</li>").appendTo('#enabled_error_list');
                }

                if (BankConfig.errorEnables & 32) {
                    $("<li>Gas Flow</li>").appendTo('#enabled_error_list');
                }

                if (BankConfig.errorEnables & 4096) {
                    $("<li>Wire Warning</li>").appendTo('#enabled_error_list');
                }

                if (BankConfig.errorEnables & 8192) {
                    $("<li>Missed Weld</li>").appendTo('#enabled_error_list');
                }
                $('#error-enables').tooltipster({
                    iconDesktop: true,
                    iconTouch: true
                });
                $('#purge-time').tooltipster({
                    iconDesktop: true,
                    iconTouch: true
                });
                $('#weld-cable').tooltipster({
                    iconDesktop: true,
                    iconTouch: true
                });
                $('#wire-spool').tooltipster({
                    iconDesktop: true,
                    iconTouch: true
                });
                $('#wire-spool-right').tooltipster({
                    iconDesktop: true,
                    iconTouch: true
                });
                $('#auto-thread').tooltipster({
                    iconDesktop: true,
                    iconTouch: true
                });
                $('#auto-thread-right').tooltipster({
                    iconDesktop: true,
                    iconTouch: true
                });
                $('#jog-speed').tooltipster({
                    iconDesktop: true,
                    iconTouch: true
                });
                $('#status-items').tooltipster({
                    iconDesktop: true,
                    iconTouch: true
                });
                $('#machine-info').tooltipster({
                    iconDesktop: true,
                    iconTouch: true
                });
                $('#ethernet-setup').tooltipster({
                    iconDesktop: true,
                    iconTouch: true
                });
                $('#data-connections-setup').tooltipster({
                    iconDesktop: true,
                    iconTouch: true
                });
                $('#wifi-settings').tooltipster({
                    iconDesktop: true,
                    iconTouch: true
                });
                $(document).ready(function() {
                    $('.tooltip').tooltipster();
                });
            }
            //End error list for English regions
            switch (q + 1) {
                case 1:
                    $('#db_country').text(RegionAll.regionRegion[0] + " (Português)");

                    newScript2.addEventListener('load', function(evt) {
                        convert_for_portuguese();
                    }, false)
                    newScript2.src = "/includes/js/setup_portuguese.min.js";
                    headID.appendChild(newScript2);
                    break;

                case 2:
                    $('#db_country').text(RegionAll.regionRegion[1] + " (English)");
                    break;

                case 3:
                    $('#db_country').text(RegionAll.regionRegion[2] + " (Nederland)");

                    newScript2.addEventListener('load', function(evt) {
                        convert_for_dutch();
                    }, false)
                    newScript2.src = "/includes/js/setup_dutch.min.js";
                    headID.appendChild(newScript2);
                    break;

                case 4:
                    $('#db_country').text(RegionAll.regionRegion[3] + " (Française)");

                    newScript2.addEventListener('load', function(evt) {
                        convert_for_french();
                    }, false)
                    newScript2.src = "/includes/js/setup_french.min.js";
                    headID.appendChild(newScript2);
                    break;

                case 5:
                    $('#db_country').text(RegionAll.regionRegion[4] + " (Deutsch)");

                    newScript2.addEventListener('load', function(evt) {
                        convert_for_german();
                    }, false)
                    newScript2.src = "/includes/js/setup_german.min.js";
                    headID.appendChild(newScript2);
                    break;

                case 6:
                    $('#db_country').text(RegionAll.regionRegion[5] + " (Italiano)");

                    newScript2.addEventListener('load', function(evt) {
                        convert_for_italian();
                    }, false)
                    newScript2.src = "/includes/js/setup_italian.min.js";
                    headID.appendChild(newScript2);
                    break;

                case 7:
                    $('#db_country').text(RegionAll.regionRegion[6] + " (Español)");

                    newScript2.addEventListener('load', function(evt) {
                        convert_for_spanish();
                    }, false)
                    newScript2.src = "/includes/js/setup_spanish.min.js";
                    headID.appendChild(newScript2);
                    break;

                case 8:
                    $('#db_country').text(RegionAll.regionRegion[7] + " (Español)");

                    newScript2.addEventListener('load', function(evt) {
                        convert_for_spanish();
                    }, false)
                    newScript2.src = "/includes/js/setup_spanish.min.js";
                    headID.appendChild(newScript2);
                    break;

                case 9:
                    $('#db_country').text(RegionAll.regionRegion[8] + " (English)");
                    break;

                case 10:
                    $('#db_country').text(RegionAll.regionRegion[9] + " (English)");
                    break;

                case 11:
                    $('#db_country').text(RegionAll.regionRegion[10] + " (Française)");

                    newScript2.addEventListener('load', function(evt) {
                        convert_for_french();
                    }, false)
                    newScript2.src = "/includes/js/setup_french.min.js";
                    headID.appendChild(newScript2);
                    break;

                case 12:
                    $('#db_country').text(RegionAll.regionRegion[11] + " (Português)");

                    newScript2.addEventListener('load', function(evt) {
                        convert_for_portuguese();
                    }, false)
                    newScript2.src = "/includes/js/setup_portuguese.min.js";
                    headID.appendChild(newScript2);
                    break;

                case 13:
                    $('#db_country').text(RegionAll.regionRegion[12] + " (中国)");

                    newScript2.addEventListener('load', function(evt) {
                        convert_for_chinese();
                    }, false)
                    newScript2.src = "/includes/js/setup_chinese.min.js";
                    headID.appendChild(newScript2);
                    break;

                default:
                    break;
            }
        }
    }
};

function setRobotIP() {
    var hexString;
    var ipAddr;

    ipAddr = AIMBoardSettings.robotIPAddr;
    hexString = ipAddr.toString(16);
    if (ipAddr > 268435455) {
        $('#ip_badge').text(parseInt(hexString.slice(0, 2), 16) + "." + parseInt(hexString.slice(2, 4), 16) + "." + parseInt(hexString.slice(4, 6), 16) + "." + parseInt(hexString.slice(6, 8), 16));
    }
    else {
        $('#ip_badge').text(parseInt(hexString.slice(0, 1), 16) + "." + parseInt(hexString.slice(1, 3), 16) + "." + parseInt(hexString.slice(3, 5), 16) + "." + parseInt(hexString.slice(5, 7), 16));
    }
};

function setTime() {
    var minutes_value;
    
    minutes_value = (CurrentTime.Minutes < 10) ? '0' + CurrentTime.Minutes : CurrentTime.Minutes;

    var currentdate = (CurrentTime.Month + '/' + CurrentTime.Date + '/' + CurrentTime.Year + ' ' + CurrentTime.Hours + ':' + minutes_value).toString() + " UTC";
    var date = new Date(currentdate);
    var n = date.toLocaleDateString() + ' ' + date.toLocaleTimeString();
    var hours_colon = n.indexOf(":", 0);
    var minutes_colon = n.indexOf(":", hours_colon + 1);
    var display_string = n.slice(0, minutes_colon) + ' ' + n.slice(-2);

    $('#db_time').text(display_string);
};

function updateDashBoard() {
    var purgeTime = PurgeTime.Time / 1000;
    
    $('#purge_time').text(purgeTime);

    if (MetricEnableCheck.MetricEnable == 1) {
        var jogMin = ipmToMPM(JogSpeedMin.MinSpeed);
        var jogMax = ipmToMPM(JogSpeedMax.MaxSpeed);
        var loadRate = ipmToMPM(BankConfig.gunLdWFS);
        var torchLength = ipmToMPM(BankConfig.gunLdLen);

        $('#jog_min_command').text(jogMin + " MPM");
        $('#jog_max_command').text(jogMax + " MPM");
        $('#load_rate_command').text(loadRate + " MPM");
    }
    else {
        $('#jog_min_command').text(JogSpeedMin.MinSpeed + " IPM");
        $('#jog_max_command').text(JogSpeedMax.MaxSpeed + " IPM");
        $('#load_rate_command').text(BankConfig.gunLdWFS + " IPM");
    }

    if (WeldCableConfig.studOrSense == 0) {
        $('#db_vfb').text("Studs");
    }
    else {
        $('#db_vfb').text("Sense Lead");
    }

    if (SlopeDisplayStatus.Status == 0) {
        $('#slope_display').removeClass("list-group-item-success").addClass("list-group-item-danger");
        $('#db_slope_display').text("Disabled");
    }
    else {
        $('#slope_display').removeClass("list-group-item-danger").addClass("list-group-item-success");
        $('#db_slope_display').text("Enabled");
    }

    if (GlobalRetractStartStatus.Status == 0) {
        $('#retract_start_status').removeClass("list-group-item-success").addClass("list-group-item-danger");
        $('#retract_start_enable').text("Disabled");
    }
    else {
        $('#retract_start_status').removeClass("list-group-item-danger").addClass("list-group-item-success");
        $('#retract_start_enable').text("Enabled");
    }

    if (CoolerStatus.Status) {
        $('#cooler_status').show();
        if (CoolerEnable.Status == 0) {
            $('#cooler_status').removeClass("list-group-item-success").addClass("list-group-item-danger");
            $('#cooler_enable').text("Disabled");
        }
        else {
            $('#cooler_status').removeClass("list-group-item-danger").addClass("list-group-item-success");
            $('#cooler_enable').text("Enabled");
        }
    }
    else {
        $('#cooler_status').hide();
    }

    if (SecondaryResistance.ResistanceEnable == 0) {
        $('#res_db').removeClass("list-group-item-success").addClass("list-group-item-danger");
        $('#db_res').text("Disabled");
    }
    else {
        $('#res_db').removeClass("list-group-item-danger").addClass("list-group-item-success");
        $('#db_res').text("Enabled");
    }

    if (SecondaryInductance.InductanceEnable == 0) {
        $('#ind_db').removeClass("list-group-item-success").addClass("list-group-item-danger");
        $('#db_ind').text("Disabled");
    }
    else {
        $('#ind_db').removeClass("list-group-item-danger").addClass("list-group-item-success");
        $('#db_ind').text("Enabled");
    }

    if (SecondaryTale.TaleEnable == 0) {
        $('#tale_db').removeClass("list-group-item-success").addClass("list-group-item-danger");
        $('#db_tale').text("Disabled");
    }
    else {
        $('#tale_db').removeClass("list-group-item-danger").addClass("list-group-item-success");
        $('#db_tale').text("Enabled");
    }

    if (SynergicMigCheck.Synergic == 0) {
        $('#synergic_display').removeClass("list-group-item-success").addClass("list-group-item-danger");
        $('#db_synergic_display').text("Disabled");
    }
    else {
        $('#synergic_display').removeClass("list-group-item-danger").addClass("list-group-item-success");
        $('#db_synergic_display').text("Enabled");
    }

    if (ArcAdjustScalingCheck.AAScaling == 0) {
        $('#db_scaling').text("0 to 99");
    }
    else {
        $('#db_scaling').text("-10 to +10");
    }

    if (GlobalWFSAmpsCommand.WFSAmps == 0) {
        $('#db_wfsampscommand').text("Amps");
    }
    else {
        $('#db_wfsampscommand').text("WFS");
    }
    
    if (I2CInformation.powerSourceType < 3) {
        switch (I2CInformation.powerSourceType) {
            case 0:
                break;
            case 1:
                $('#control_badge').text("Robot");
                break;
            case 2:
                $('#control_badge').text("Power Source");
                break;
            case 3:
            case 4:
            case 5:
            default:
                break;
        }
        switch (RobotCommMethod.CommMethod) {
            case 0:
                $('#communication_badge').text("Analog & Digital");
                $('#ip_db').hide();
                break;
            case 1:
                $('#communication_badge').text("Devicenet Master");
                $('#ip_db').hide();
                break;
            case 3:
                $('#communication_badge').text("Ethernet IP");
                $('#ip_db').show();
                break;
            default:
                break;
        }
        if (RobotProgramSelect.RPS == 0) {
            $('#remote_program_select').removeClass("list-group-item-success").addClass("list-group-item-danger");
            $('#rps_badge').text("Disabled");
        }
        else {
            $('#remote_program_select').removeClass("list-group-item-danger").addClass("list-group-item-success");
            $('#rps_badge').text("Enabled");
        }
    }
    if (DryRunStatus.DryRun == 1) {
        $('#dry_run_status').removeClass("list-group-item-success").addClass("list-group-item-danger");
        $('#dry_run_badge').text("Disabled");
    }
    else {
        $('#dry_run_status').removeClass("list-group-item-danger").addClass("list-group-item-success");
        $('#dry_run_badge').text("Enabled");
    }

    if (InsightEnableCheck.InsightEnable == 0) {
        $('#db_insight').text("Disabled");
        $('#db_insight_centerpoint').text("Disabled");
    }
    else {
        $('#db_insight').text("Enabled");
        $('#db_insight_centerpoint').text("Enabled");
    }

    if (InsightCoreEnableCheck.InsightCoreEnable == 0) {
        $('#db_insight_core').text("Disabled");
        $('#db_core').text("Disabled");
    }
    else {
        $('#db_insight_core').text("Enabled");
        $('#db_core').text("Enabled");
    }

    if (RobotCommMethod.CommMethod != 3) {
        $('#db_IP').text("Disabled");
    }
    else {
        $('#db_IP').text("Enabled");
    }

    if ((WIN_FTP_info[0] == 1) && (WIN_FTP_info[1] == 0) && (WIN_FTP_info[2] == 1) && (WIN_FTP_info[3] == 1)) {
        $('#db_fm').text("Enabled");
        $('#fileManagerListItem').removeClass("list-group-item-default").addClass("list-group-item-success");
    }
    else {
        $('#db_fm').text("Disabled");
        $('#fileManagerListItem').removeClass("list-group-item-default").addClass("list-group-item-danger");
    }
    
    $('#db_asset').text(WelderInformation.assetNumber);
    $('#db_location').text(WelderInformation.physicalLocation);
    $('#db_torch').text(WeldCableConfig.torchName);

    if (ArcAdjustScalingCheck.AAScaling == 0) {
        $('#db_scaling').text("0 to 99");
    }
    else {
        $('#db_scaling').text("-10 to 10");
    }

    if (InsightEnableCheck.InsightEnable == 0) {
        $('#insight_list_item').removeClass("list-group-item-default").addClass("list-group-item-danger");
        $('#insightCenterPointListItem').removeClass("list-group-item-default").addClass("list-group-item-danger");
    }
    else {
        $('#insight_list_item').removeClass("list-group-item-default").addClass("list-group-item-success");
        $('#insightCenterPointListItem').removeClass("list-group-item-default").addClass("list-group-item-success");
    }

    if (InsightCoreEnableCheck.InsightCoreEnable == 0) {
        $('#insight_core_list_item').removeClass("list-group-item-default").addClass("list-group-item-danger");
        $('#insightCoreListItem').removeClass("list-group-item-default").addClass("list-group-item-danger");
    }
    else {
        $('#insight_core_list_item').removeClass("list-group-item-default").addClass("list-group-item-success");
        $('#insightCoreListItem').removeClass("list-group-item-default").addClass("list-group-item-success");
    }

    if (RobotCommMethod.CommMethod != 3) {
        $('#ethernetIPListItem').removeClass("list-group-item-default").addClass("list-group-item-danger");
    }
    else {
        $('#ethernetIPListItem').removeClass("list-group-item-default").addClass("list-group-item-success");
    }

    if (WIN_IP_info[15] == 'B') {
        $('#db_IP_port').text("Port 2");
    }
    else {
        $('#db_IP_port').text("Port 1");
    }

    if (WIN_IP_info[14] == 'B') {
        $('#db_insight_centerpoint_port').text("Port 2");
    }
    else {
        $('#db_insight_centerpoint_port').text("Port 1");
    }

    if (CEProgramsEnableCheck.CEPrograms == 0) {
        $('#db_program_library').text("English");
    }
    else {
        $('#db_program_library').text("CE");
    }

    if (WeldFileEnableCheck.WeldFileEnable == 1) {
        $('#db_weld_files').removeClass("list-group-item-danger").addClass("list-group-item-success");
        $('#weld_file_status').text("Enabled");
    }
};

function dualFeederCheck() {
    if (DualFeederCheck.Dual) {
        $('#right_side_spool').show();
        $('#right_side_autothread').show();
        $('#left_side_wire').hide();
    }
    else {
        $('#right_side_spool').hide();
        $('#left_side_wire').show();
        $('#right_side_autothread').hide();
    }
};

function autoCheck() {
    if (I2CInformation.powerSourceType < 3) {
        $('#robot_options').show();
        $('#dry_run').show();

        for (var x = 0; x < RobotMfgAll.robotID.length; x++) {
            //Check robot mfg. table against PCode to make sure they are synced
            //If not, set robot mfg. table to the PCode value.
            if (x == RobotManufacturer.Manufacturer) {
                $('#robot_mfg_badge').text(RobotMfgAll.robotName[x]);
            }
        }
        switch (I2CInformation.powerSourceType) {
            case 0:
                break;
            case 1:
                $('#control_badge').text("Robot");
                break;
            case 2:
                $('#control_badge').text("Power Source");
                break;
            case 3:
            case 4:
            case 5:
            default:
                break;
        }
        switch (RobotCommMethod.CommMethod) {
            case 0:
                $('#communication_badge').text("Analog & Digital");
                $('#autocal').show();
                break;
            case 1:
                $('#communication_badge').text("Devicenet Master");
                $('#autocal').hide();
                break;
            case 3:
                $('#communication_badge').text("Ethernet IP");
                $('#autocal').hide();
                break;
            default:
                break;
        }
        if (RobotProgramSelect.RPS == 0) {
            $('#remote_program_select').removeClass("list-group-item-success").addClass("list-group-item-danger");
            $('#rps_badge').text("Disabled");
        }
        else {
            $('#remote_program_select').removeClass("list-group-item-danger").addClass("list-group-item-success");
            $('#rps_badge').text("Enabled");
        }
    }
    else {
        $('#robot_options').hide();
        $('#dry_run').hide();
        $('#autocal').hide();
    }
    if (DryRunStatus.DryRun == 1) {
        $('#dry_run_status').removeClass("list-group-item-success").addClass("list-group-item-danger");
        $('#dry_run_badge').text("Disabled");
    }
    else {
        $('#dry_run_status').removeClass("list-group-item-danger").addClass("list-group-item-success");
        $('#dry_run_badge').text("Enabled");
    }
};
