diff --git a/include/class.topic.php b/include/class.topic.php
index 9379e8ec95ec94a2e72f20bfe8a587da946f5398..8b02e5eeab5fe04344a3c81ea987f7577c51235a 100644
--- a/include/class.topic.php
+++ b/include/class.topic.php
@@ -16,10 +16,12 @@
 
 class Topic {
     var $id;
- 
+
     var $ht;
+
     var $parent;
-    
+    var $page;
+
     function Topic($id) {
         $this->id=0;
         $this->load($id);
@@ -40,11 +42,14 @@ class Topic {
             return false;
 
         $this->ht = db_fetch_array($res);
-        $this->id=$this->ht['topic_id'];
-    
+        $this->id = $this->ht['topic_id'];
+
+        $this->page = null;
+
+
         return true;
     }
-  
+
     function reload() {
         return $this->load();
     }
@@ -52,7 +57,7 @@ class Topic {
     function asVar() {
         return $this->getName();
     }
-    
+
     function getId() {
         return $this->id;
     }
@@ -71,7 +76,7 @@ class Topic {
     function getName() {
         return $this->ht['name'];
     }
-    
+
     function getDeptId() {
         return $this->ht['dept_id'];
     }
@@ -91,7 +96,18 @@ class Topic {
     function getTeamId() {
         return $this->ht['team_id'];
     }
-    
+
+    function getPageId() {
+        return $this->ht['page_id'];
+    }
+
+    function getPage() {
+        if(!$this->page && $this->getPageId())
+            $this->page = Page::lookup($this->getPageId());
+
+        return $this->page;
+    }
+
     function autoRespond() {
         return (!$this->ht['noautoresp']);
     }
@@ -137,7 +153,7 @@ class Topic {
         return $num;
     }
     /*** Static functions ***/
-    function create($vars,&$errors) { 
+    function create($vars, &$errors) {
         return self::save(0, $vars, $errors);
     }
 
@@ -195,10 +211,10 @@ class Topic {
 
         if(!$vars['dept_id'])
             $errors['dept_id']='You must select a department';
-            
+
         if(!$vars['priority_id'])
             $errors['priority_id']='You must select a priority';
-        
+
         if($errors) return false;
 
         $sql=' updated=NOW() '
@@ -207,6 +223,7 @@ class Topic {
             .',dept_id='.db_input($vars['dept_id'])
             .',priority_id='.db_input($vars['priority_id'])
             .',sla_id='.db_input($vars['sla_id'])
+            .',page_id='.db_input($vars['page_id'])
             .',isactive='.db_input($vars['isactive'])
             .',ispublic='.db_input($vars['ispublic'])
             .',noautoresp='.db_input(isset($vars['noautoresp'])?1:0)
@@ -219,7 +236,7 @@ class Topic {
             $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!
-            
+
         if($id) {
             $sql='UPDATE '.TOPIC_TABLE.' SET '.$sql.' WHERE topic_id='.db_input($id);
             if(db_query($sql))
@@ -230,10 +247,10 @@ class Topic {
             $sql='INSERT INTO '.TOPIC_TABLE.' SET '.$sql.',created=NOW()';
             if(db_query($sql) && ($id=db_insert_id()))
                 return $id;
-            
+
             $errors['err']='Unable to create the topic. Internal error';
         }
-        
+
         return false;
     }
 }
diff --git a/include/staff/helptopic.inc.php b/include/staff/helptopic.inc.php
index e5dac76027006cdbbd6631a66c3df119c758d292..e54323ac491f61eb8ea4044440523369446ed5e0 100644
--- a/include/staff/helptopic.inc.php
+++ b/include/staff/helptopic.inc.php
@@ -149,6 +149,26 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
                 <em>(Overwrites department's SLA)</em>
             </td>
         </tr>
+        <tr>
+            <td width="180">Thank-you Page:</td>
+            <td>
+                <select name="page_id">
+                    <option value="">&mdash; System Default &mdash;</option>
+                    <?php
+                    if(($pages = Page::getActiveThankYouPages())) {
+                        foreach($pages as $page) {
+                            if(strcasecmp($page->getType(), 'thank-you')) continue;
+                            echo sprintf('<option value="%d" %s>%s</option>',
+                                    $page->getId(),
+                                    ($info['page_id']==$page->getId())?'selected="selected"':'',
+                                    $page->getName());
+                        }
+                    }
+                    ?>
+                </select>&nbsp;<font class="error"><?php echo $errors['page_id']; ?></font>
+                <em>(Overwrites global setting. Applies to web tickets only.)</em>
+            </td>
+        </tr>
         <tr>
             <td width="180">
                 Auto-assign To:
@@ -156,14 +176,9 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
             <td>
                 <select name="assign">
                     <option value="0">&mdash; Unassigned &mdash;</option>
-                                
-
                     <?php
-                    
-                                
                     $sql=' SELECT staff_id,CONCAT_WS(", ",lastname,firstname) as name '.
                          ' FROM '.STAFF_TABLE.' WHERE isactive=1 ORDER BY name';
-                                
                     if(($res=db_query($sql)) && db_num_rows($res)){
                         echo '<OPTGROUP label="Staff Members">';
                         while (list($id,$name) = db_fetch_row($res)){
@@ -171,10 +186,9 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
                             $selected = ($info['assign']==$k || $info['staff_id']==$id)?'selected="selected"':'';
                             ?>
                             <option value="<?php echo $k; ?>"<?php echo $selected; ?>><?php echo $name; ?></option>
-                            
+
                         <?php }
                         echo '</OPTGROUP>';
-                        
                     }
                     $sql='SELECT team_id, name FROM '.TEAM_TABLE.' WHERE isenabled=1';
                     if(($res=db_query($sql)) && db_num_rows($res)){