$bs = new box("100%", $th_strip_frame_color, $th_strip_frame_width, $th_strip_title_bgcolor, $th_strip_title_font_color, $th_strip_title_align, $th_strip_body_bgcolor, $th_strip_body_font_color, $th_strip_body_align);
?>

<!-- content -->
<?php 
if (isset($id)) {
    $columns = "*";
    $tables = "profile,enterprise";
    $where = "enterprise.entid = profile.entid_prf AND profile.prfid = '{$id}'";
    if (!$db->query("SELECT {$columns} FROM {$tables} WHERE {$where}")) {
        mysql_die($db);
    } else {
        $db->next_record();
        if ($db->f("user") == $auth->auth["uname"] || $perm->have_perm("admin")) {
            if (!isset($action)) {
                prfmod($db);
            } else {
                $profile_prf = trim($profile_prf);
                $status_prf = trim($status_prf);
                if (!empty($profile_prf)) {
                    $tables = "profile";
                    $set = "profile_prf='{$profile_prf}'";
                    $where = "prfid='{$id}'";
                    switch ($action) {
                        case "change":
                            $set = $set . ",status_prf='{$status_prf}'";
                            break;
                        case "delete":
                            $set = $set . ",status_prf='D'";
                            break;
                        case "undelete":
     mysql_die($db);
 } else {
     // If enterprise in table
     if ($db->next_record()) {
         // If enterprise owner is logged in user
         if ($db->f("user") == $auth->auth["uname"] || $perm->have_perm("admin")) {
             // Look if profile is already in table
             $dbprf = new DB_SourceBiz();
             $columns = "*";
             $tables = "profile,enterprise";
             $where = "entid_prf='{$id}' AND enterprise.entid = profile.entid_prf";
             if ($dbprf->query("SELECT {$columns} FROM {$tables} WHERE {$where}")) {
                 // If profile in table
                 if ($dbprf->next_record()) {
                     // Modify existing profile
                     prfmod($dbprf);
                 } else {
                     // Insert new profile
                     prfform($db);
                 }
             } else {
                 mysql_die($db);
             }
         } else {
             $be->box_full($t->translate("Error"), $t->translate("Access denied") . ".");
         }
         // If enterprise not in table
     } else {
         $be->box_full($t->translate("Error"), $t->translate("Enterprise") . " (ID: {$id}) " . $t->translate("does not exist") . ".");
     }
 }