foreach ($variables as $val) {
    array_push($values_act, $_GET[$val]);
    ${$val} = $_GET[$val];
}
// $status: '1' means 'active insurances'
if (isset($toggle)) {
    $status = !$status;
}
$show = true;
if (isset($treeLink)) {
    $status = !$status;
    $show = false;
}
// DELETE active insurance
if (isset($_GET['deletebutton'])) {
    $sql_add = ", deleted_hist=" . $insurance_tz->ConcatFieldString("deleted_hist", "deleted on " . date('Y-m-d H:i:s') . " by " . $_SESSION['sess_user_name'] . " \n");
    $coreObj->sql = "UPDATE care_tz_insurances_admin SET deleted=1" . $sql_add . " WHERE insurance_ID={$delete}";
    $db->execute($coreObj->sql);
    $show = true;
    $insurance_ID = '';
}
// REACTIVATE deleted insurance
if (isset($_GET['reactivatebutton'])) {
    $sql_add = ", deleted_hist=" . $insurance_tz->ConcatFieldString("deleted_hist", "reactivated on " . date('Y-m-d H:i:s') . " by " . $_SESSION['sess_user_name'] . " \n");
    $coreObj->sql = "UPDATE care_tz_insurances_admin SET deleted=0" . $sql_add . " WHERE insurance_ID={$reactivate}";
    $db->execute($coreObj->sql);
    $show = true;
    $insurance_ID = '';
}
//create three different arrays for insurances depending on their status
$coreObj->sql = "SELECT DISTINCT insurance_ID FROM care_tz_insurances_admin order by deleted, name asc";