echo "\t\$('#value_" . $group_id . "_' + condition_id + '_stop option[value=\"" . $cond_val_stop . "\"]').prop('selected', true);\n";
                }
                echo "</script>";
            }
            //used to determine largest custom group id in use
            $largest_group_id = $group_id > $largest_group_id ? $group_id : $largest_group_id;
        }
    }
}
//add first/new set of custom condition fields
if ($action != 'update' || $action == 'update' && $largest_group_id == 0) {
    $group_id = 500;
} else {
    $group_id = $largest_group_id += 5;
}
add_custom_condition($group_id);
echo "<script>";
echo "\tadd_condition(" . $group_id . ",'custom');";
if ($action == 'add' || $action == 'update' && $largest_group_id == 0) {
    echo "\tadd_condition(" . $group_id . ",'custom');";
}
echo "</script>";
//if presets exist, show the preset section
if (isset($available_presets) && sizeof($available_presets) > 0) {
    echo "<tr>\n";
    echo "<td class='vncell' valign='top' align='left' nowrap>\n";
    echo "\t" . $text['label-presets'] . "\n";
    echo "</td>\n";
    echo "<td class='vtable' align='left'>\n";
    foreach ($available_presets as $preset_number => $preset) {
        foreach ($preset as $preset_name => $preset_variables) {
                    echo "\t\$('#value_" . $group_id . "_' + condition_id + '_stop option[value=\"" . $cond_val_stop . "\"]').prop('selected', true);\n";
                }
                echo "</script>";
            }
            //used to determine largest custom group id in use
            $largest_group_id = $group_id > $largest_group_id ? $group_id : $largest_group_id;
        }
    }
}
//add first/new set of custom condition fields
if ($action != 'update' || $action == 'update' && $largest_group_id == 0) {
    $group_id = 500;
} else {
    $group_id = $largest_group_id += 5;
}
add_custom_condition($destination, $group_id);
echo "<script>";
echo "\tadd_condition(" . $group_id . ",'custom');";
if ($action == 'add' || $action == 'update' && $largest_group_id == 0) {
    echo "\tadd_condition(" . $group_id . ",'custom');";
}
echo "</script>";
//if presets exist, show the preset section
if (isset($available_presets) && sizeof($available_presets) > 0) {
    echo "<tr>\n";
    echo "<td class='vncell' valign='top' align='left' nowrap>\n";
    echo "\t" . $text['label-presets'] . "\n";
    echo "</td>\n";
    echo "<td class='vtable' align='left'>\n";
    foreach ($available_presets as $preset_number => $preset) {
        foreach ($preset as $preset_name => $preset_variables) {