diff --git a/include/class.ticket.php b/include/class.ticket.php
index da45d51935322d606f6e6b60b102c6c63ea363b8..b556759cf129fc490b4341d2f7c82e8f9d129ae2 100644
--- a/include/class.ticket.php
+++ b/include/class.ticket.php
@@ -74,7 +74,7 @@ class Ticket{
 
         //TODO: delete helptopic field in ticket table.
        
-        $sql='SELECT  ticket.*, topic.topic as helptopic, lock_id, dept_name, priority_desc '
+        $sql='SELECT  ticket.*, lock_id, dept_name, priority_desc '
             .' ,count(attach.attach_id) as attachments '
             .' ,count(DISTINCT message.id) as messages '
             .' ,count(DISTINCT response.id) as responses '
@@ -83,8 +83,6 @@ class Ticket{
             .' LEFT JOIN '.DEPT_TABLE.' dept ON (ticket.dept_id=dept.dept_id) '
             .' LEFT JOIN '.TICKET_PRIORITY_TABLE.' pri ON ('
                 .'ticket.priority_id=pri.priority_id) '
-            .' LEFT JOIN '.TOPIC_TABLE.' topic ON ('
-                .'ticket.topic_id=topic.topic_id) '
             .' LEFT JOIN '.TICKET_LOCK_TABLE.' tlock ON ('
                 .'ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW()) '
             .' LEFT JOIN '.TICKET_ATTACHMENT_TABLE.' attach ON ('
@@ -128,7 +126,6 @@ class Ticket{
         $this->dept_name = $this->ht['dept_name'];
         $this->sla_id = $this->ht['sla_id'];
         $this->topic_id = $this->ht['topic_id'];
-        $this->helptopic = $this->ht['helptopic'];
         $this->subject = $this->ht['subject'];
         $this->overdue = $this->ht['isoverdue'];
         
@@ -227,7 +224,7 @@ class Ticket{
         if(!$this->helpTopic && ($topic=$this->getTopic()))
             $this->helpTopic = $topic->getName();
             
-        return $this->helptopic;
+        return $this->helpTopic;
     }
    
     function getCreateDate(){
@@ -417,14 +414,14 @@ class Ticket{
         return $assignees;
     }
 
-    function getTopicId(){
+    function getTopicId() {
         return $this->topic_id;
     }
 
     function getTopic() { 
 
         if(!$this->topic && $this->getTopicId())
-            $this->topic = Topic::lookup($this->getTopicId);
+            $this->topic = Topic::lookup($this->getTopicId());
 
         return $this->topic;
     }
diff --git a/include/class.topic.php b/include/class.topic.php
index 40ab8096bc1831b821ea37754b18e3d1a1a22e3e..c8e6a9e72b9a8d26da82e97f48cfc9f25e97d51c 100644
--- a/include/class.topic.php
+++ b/include/class.topic.php
@@ -16,11 +16,11 @@
 
 class Topic {
     var $id;
-    var $topic;
  
     var $ht;
+    var $parent;
     
-    function Topic($id){
+    function Topic($id) {
         $this->id=0;
         $this->load($id);
     }
@@ -30,12 +30,16 @@ class Topic {
         if(!$id && !($id=$this->getId()))
             return false;
 
-        $sql='SELECT * FROM '.TOPIC_TABLE
-            .' WHERE topic_id='.db_input($id);
+        $sql='SELECT ht.* '
+            .', IF(ht.topic_pid IS NULL, ht.topic, CONCAT_WS(" / ", ht2.topic, ht.topic)) as name '
+            .' FROM '.TOPIC_TABLE.' ht '
+            .' LEFT JOIN '.TOPIC_TABLE.' ht2 ON(ht2.topic_id=ht.topic_pid) '
+            .' WHERE ht.topic_id='.db_input($id);
+
         if(!($res=db_query($sql)) || !db_num_rows($res))
             return false;
 
-        $this->ht=db_fetch_array($res);
+        $this->ht = db_fetch_array($res);
         $this->id=$this->ht['topic_id'];
     
         return true;
@@ -45,31 +49,42 @@ class Topic {
         return $this->load();
     }
     
-    function getId(){
+    function getId() {
         return $this->id;
     }
-    
-    function getName(){
-        return $this->ht['topic'];
+
+    function getPid() {
+        return $this->ht['topic_pid'];
+    }
+
+    function getParent() {
+        if(!$this->parent && $this->getPid())
+            $this->parent = self::lookup($this->getPid());
+
+        return $this->parent;
+    }
+
+    function getName() {
+        return $this->ht['name'];
     }
     
-    function getDeptId(){
+    function getDeptId() {
         return $this->ht['dept_id'];
     }
 
-    function getSLAId(){
+    function getSLAId() {
         return $this->ht['sla_id'];
     }
 
-    function getPriorityId(){
+    function getPriorityId() {
         return $this->ht['priority_id'];
     }
 
-    function getStaffId(){
+    function getStaffId() {
         return $this->ht['staff_id'];
     }
 
-    function getTeamId(){
+    function getTeamId() {
         return $this->ht['team_id'];
     }
     
@@ -81,11 +96,11 @@ class Topic {
          return ($this->ht['isactive']);
     }
 
-    function isActive(){
+    function isActive() {
         return $this->isEnabled();
     }
 
-    function isPublic(){
+    function isPublic() {
         return ($this->ht['ispublic']);
     }
 
@@ -97,18 +112,20 @@ class Topic {
         return $this->getHashtable();
     }
 
-    function update($vars,&$errors) {
+    function update($vars, &$errors) {
 
-        if($this->save($this->getId(),$vars,$errors)){
-            $this->reload();
-            return true;
-        }
-        return false;
+        if(!$this->save($this->getId(), $vars, $errors))
+            return false;
+
+        $this->reload();
+        return true;
     }
 
-    function delete(){
+    function delete() {
+
         $sql='DELETE FROM '.TOPIC_TABLE.' WHERE topic_id='.db_input($this->getId()).' LIMIT 1';
-        if(db_query($sql) && ($num=db_affected_rows())){
+        if(db_query($sql) && ($num=db_affected_rows())) {
+            db_query('UPDATE '.TOPIC_TABLE.' SET topic_pid=0 WHERE topic_pid='.db_input($this->getId()));
             db_query('UPDATE '.TICKET_TABLE.' SET topic_id=0 WHERE topic_id='.db_input($this->getId()));
             db_query('DELETE FROM '.FAQ_TOPIC_TABLE.' WHERE topic_id='.db_input($this->getId()));
         }
@@ -117,19 +134,24 @@ class Topic {
     }
     /*** Static functions ***/
     function create($vars,&$errors) { 
-        return self::save(0,$vars,$errors);
+        return self::save(0, $vars, $errors);
     }
 
     function getHelpTopics($publicOnly=false) {
 
         $topics=array();
-        $sql='SELECT topic_id, topic FROM '.TOPIC_TABLE
-            .' WHERE isactive=1';
+        $sql='SELECT ht.topic_id'
+            .', IF(ht2.topic_pid IS NULL, ht.topic, CONCAT_WS(" / ", ht2.topic, ht.topic)) as name '
+            .' FROM '.TOPIC_TABLE. ' ht '
+            .' LEFT JOIN '.TOPIC_TABLE.' ht2 ON(ht2.topic_id=ht.topic_pid) '
+            .' WHERE ht.isactive=1';
+
         if($publicOnly)
-            $sql.=' AND ispublic=1';
-        $sql.=' ORDER BY topic';
+            $sql.=' AND ht.ispublic=1';
+
+        $sql.=' ORDER BY name';
         if(($res=db_query($sql)) && db_num_rows($res))
-            while(list($id,$name)=db_fetch_row($res))
+            while(list($id, $name)=db_fetch_row($res))
                 $topics[$id]=$name;
 
         return $topics;
@@ -139,8 +161,7 @@ class Topic {
         return self::getHelpTopics(true);
     }
 
-
-    function getIdByName($topic){
+    function getIdByName($topic) {
         $sql='SELECT topic_id FROM '.TOPIC_TABLE.' WHERE topic='.db_input($topic);
         if(($res=db_query($sql)) && db_num_rows($res))
             list($id)=db_fetch_row($res);
@@ -148,11 +169,11 @@ class Topic {
         return $id;
     }
 
-    function lookup($id){
+    function lookup($id) {
         return ($id && is_numeric($id) && ($t= new Topic($id)) && $t->getId()==$id)?$t:null;
     }
 
-    function save($id,$vars,&$errors) {
+    function save($id, $vars, &$errors) {
 
         $vars['topic']=Format::striptags(trim($vars['topic']));
 
@@ -174,22 +195,24 @@ class Topic {
         
         if($errors) return false;
 
-        $sql=' updated=NOW(),topic='.db_input($vars['topic']).
-             ',dept_id='.db_input($vars['dept_id']).
-             ',priority_id='.db_input($vars['priority_id']).
-             ',sla_id='.db_input($vars['sla_id']).
-             ',isactive='.db_input($vars['isactive']).
-             ',ispublic='.db_input($vars['ispublic']).
-             ',noautoresp='.db_input(isset($vars['noautoresp'])?1:0).
-             ',notes='.db_input($vars['notes']);
+        $sql=' updated=NOW() '
+            .',topic='.db_input($vars['topic'])
+            .',topic_pid='.db_input($vars['pid'])
+            .',dept_id='.db_input($vars['dept_id'])
+            .',priority_id='.db_input($vars['priority_id'])
+            .',sla_id='.db_input($vars['sla_id'])
+            .',isactive='.db_input($vars['isactive'])
+            .',ispublic='.db_input($vars['ispublic'])
+            .',noautoresp='.db_input(isset($vars['noautoresp'])?1:0)
+            .',notes='.db_input($vars['notes']);
 
         //Auto assign ID is overloaded...
         if($vars['assign'] && $vars['assign'][0]=='s')
-             $sql.=',team_id=0,staff_id='.db_input(preg_replace("/[^0-9]/", "",$vars['assign']));
+             $sql.=',team_id=0, staff_id='.db_input(preg_replace("/[^0-9]/", "", $vars['assign']));
         elseif($vars['assign'] && $vars['assign'][0]=='t')
-            $sql.=',staff_id=0,team_id='.db_input(preg_replace("/[^0-9]/", "",$vars['assign']));
+            $sql.=',staff_id=0, team_id='.db_input(preg_replace("/[^0-9]/", "", $vars['assign']));
         else
-            $sql.=',staff_id=0,team_id=0 '; //no auto-assignment!
+            $sql.=',staff_id=0, team_id=0 '; //no auto-assignment!
             
         if($id) {
             $sql='UPDATE '.TOPIC_TABLE.' SET '.$sql.' WHERE topic_id='.db_input($id);
@@ -197,7 +220,7 @@ class Topic {
                 return true;
 
             $errors['err']='Unable to update topic. Internal error occurred';
-        }else{
+        } else {
             $sql='INSERT INTO '.TOPIC_TABLE.' SET '.$sql.',created=NOW()';
             if(db_query($sql) && ($id=db_insert_id()))
                 return $id;
diff --git a/include/staff/helptopic.inc.php b/include/staff/helptopic.inc.php
index 6c7c94211ec855b5b7c4111c7382b15f93883239..c222f745c9419eca924b1a975781791b7142e418 100644
--- a/include/staff/helptopic.inc.php
+++ b/include/staff/helptopic.inc.php
@@ -2,14 +2,15 @@
 if(!defined('OSTADMININC') || !$thisstaff || !$thisstaff->isAdmin()) die('Access Denied');
 $info=array();
 $qstr='';
-if($topic && $_REQUEST['a']!='add'){
+if($topic && $_REQUEST['a']!='add') {
     $title='Update Help Topic';
     $action='update';
     $submit_text='Save Changes';
     $info=$topic->getInfo();
     $info['id']=$topic->getId();
+    $info['pid']=$topic->getPid();
     $qstr.='&id='.$topic->getId();
-}else {
+} else {
     $title='Add New Help Topic';
     $action='create';
     $submit_text='Add Topic';
@@ -60,10 +61,34 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
             </td>
             <td>
                 <input type="radio" name="ispublic" value="1" <?php echo $info['ispublic']?'checked="checked"':''; ?>>Public
-                <input type="radio" name="ispublic" value="0" <?php echo !$info['ispublic']?'checked="checked"':''; ?>>Private <em>(Internal)</em>
+                <input type="radio" name="ispublic" value="0" <?php echo !$info['ispublic']?'checked="checked"':''; ?>>Private/Internal
                 &nbsp;<span class="error">*&nbsp;</span>
             </td>
         </tr>
+        <tr>
+            <td width="180">
+                Parent Topic:
+            </td>
+            <td>
+                <select name="pid">
+                    <option value="">&mdash; Select Parent Topic &mdash;</option>
+                    <?php
+                    $sql='SELECT topic_id, topic FROM '.TOPIC_TABLE
+                        .' WHERE topic_pid=0 '
+                        .' ORDER by topic';
+                    if(($res=db_query($sql)) && db_num_rows($res)) {
+                        while(list($id, $name)=db_fetch_row($res)) {
+                            echo sprintf('<option value="%d" %s>%s</option>',
+                                    $id, (($info['pid'] && $id==$info['pid'])?'selected="selected"':'') ,$name);
+                        }
+                    }
+                    ?>
+                </select> (<em>optional</em>)
+                &nbsp;<span class="error">&nbsp;<?php echo $errors['pid']; ?></span>
+            </td>
+        </tr>
+
+        <tr><th colspan="2"><em>New ticket options</em></th></tr>
         <tr>
             <td width="180" class="required">
                 Priority:
diff --git a/include/staff/helptopics.inc.php b/include/staff/helptopics.inc.php
index 9e5482ff9b1197a14aa732ee161f3ff5e392724c..da26fbc850f642004426c075e1986efe625c2e0f 100644
--- a/include/staff/helptopics.inc.php
+++ b/include/staff/helptopics.inc.php
@@ -2,12 +2,16 @@
 if(!defined('OSTADMININC') || !$thisstaff->isAdmin()) die('Access Denied');
 
 $qstr='';
-$sql='SELECT topic.*,dept.dept_name as department,priority_desc as priority '.
-     ' FROM '.TOPIC_TABLE.' topic '.
-     ' LEFT JOIN '.DEPT_TABLE.' dept ON (dept.dept_id=topic.dept_id) '.
-     ' LEFT JOIN '.TICKET_PRIORITY_TABLE.' pri ON (pri.priority_id=topic.priority_id) ';
+$sql='SELECT topic.* '
+    .', IF(ptopic.topic_pid IS NULL, topic.topic, CONCAT_WS(" / ", ptopic.topic, topic.topic)) as name '
+    .', dept.dept_name as department '
+    .', priority_desc as priority '
+    .' FROM '.TOPIC_TABLE.' topic '
+    .' LEFT JOIN '.TOPIC_TABLE.' ptopic ON (ptopic.topic_id=topic.topic_pid) '
+    .' LEFT JOIN '.DEPT_TABLE.' dept ON (dept.dept_id=topic.dept_id) '
+    .' LEFT JOIN '.TICKET_PRIORITY_TABLE.' pri ON (pri.priority_id=topic.priority_id) ';
 $sql.=' WHERE 1';
-$sortOptions=array('name'=>'topic.topic','status'=>'topic.isactive','type'=>'topic.ispublic',
+$sortOptions=array('name'=>'name','status'=>'topic.isactive','type'=>'topic.ispublic',
                    'dept'=>'department','priority'=>'priority','updated'=>'topic.updated');
 $orderWays=array('DESC'=>'DESC','ASC'=>'ASC');
 $sort=($_REQUEST['sort'] && $sortOptions[strtolower($_REQUEST['sort'])])?strtolower($_REQUEST['sort']):'name';
@@ -83,7 +87,7 @@ else
                   <input type="checkbox" name="ids[]" value="<?php echo $row['topic_id']; ?>" 
                             <?php echo $sel?'checked="checked"':''; ?>  <?php echo $default?'disabled="disabled"':''; ?>
                                 onClick="highLight(this.value,this.checked);"> </td>
-                <td><a href="helptopics.php?id=<?php echo $row['topic_id']; ?>"><?php echo $row['topic']; ?></a>&nbsp;</td>
+                <td><a href="helptopics.php?id=<?php echo $row['topic_id']; ?>"><?php echo $row['name']; ?></a>&nbsp;</td>
                 <td><?php echo $row['isactive']?'Active':'<b>Disabled</b>'; ?></td>
                 <td><?php echo $row['ispublic']?'Public':'<b>Private</b>'; ?></td>
                 <td><?php echo $row['priority']; ?></td>