diff --git a/include/class.config.php b/include/class.config.php
index 5d297e8c528e94cd1bdd1b4fb57c879fd7a02801..bfaa0a5fe7664b3fc41a6e587421f62da7d781f9 100644
--- a/include/class.config.php
+++ b/include/class.config.php
@@ -363,7 +363,7 @@ class OsticketConfig extends Config {
     function getDefaultTemplate() {
 
         if(!$this->defaultTemplate && $this->getDefaultTemplateId())
-            $this->defaultTemplate = Template::lookup($this->getDefaultTemplateId());
+            $this->defaultTemplate = EmailTemplateGroup::lookup($this->getDefaultTemplateId());
 
         return $this->defaultTemplate;
     }
diff --git a/include/class.dept.php b/include/class.dept.php
index cd89c2cbb86770c2c0aff2c41c42fda8828c560a..edcf2d6988f7960cb6e5eea2340ab486eeeeadc2 100644
--- a/include/class.dept.php
+++ b/include/class.dept.php
@@ -1,7 +1,7 @@
 <?php
 /*********************************************************************
     class.dept.php
-    
+
     Department class
 
     Peter Rotich <peter@osticket.com>
@@ -18,23 +18,23 @@ class Dept {
 
     var $email;
     var $sla;
-    var $manager; 
+    var $manager;
     var $members;
     var $groups;
 
     var $ht;
-  
+
     function Dept($id) {
         $this->id=0;
         $this->load($id);
     }
-    
+
     function load($id=0) {
         global $cfg;
 
         if(!$id && !($id=$this->getId()))
             return false;
-   
+
         $sql='SELECT dept.*,dept.dept_id as id,dept.dept_name as name, dept.dept_signature as signature, count(staff.staff_id) as users '
             .' FROM '.DEPT_TABLE.' dept '
             .' LEFT JOIN '.STAFF_TABLE.' staff ON (dept.dept_id=staff.dept_id) '
@@ -66,21 +66,21 @@ class Dept {
     function getId() {
         return $this->id;
     }
-    
+
     function getName() {
         return $this->ht['name'];
     }
 
-        
+
     function getEmailId() {
         return $this->ht['email_id'];
     }
 
     function getEmail() {
-        
+
         if(!$this->email && $this->getEmailId())
             $this->email=Email::lookup($this->getEmailId());
-            
+
         return $this->email;
     }
 
@@ -88,7 +88,7 @@ class Dept {
         return $this->ht['users'];
     }
 
-     
+
     function getNumUsers() {
         return $this->getNumStaff();
     }
@@ -103,14 +103,14 @@ class Dept {
             $this->members = array();
             $sql='SELECT DISTINCT s.staff_id FROM '.STAFF_TABLE.' s '
                 .' LEFT JOIN '.GROUP_DEPT_TABLE.' g ON(s.group_id=g.group_id) '
-                .' INNER JOIN '.DEPT_TABLE.' d 
-                       ON(d.dept_id=s.dept_id 
-                            OR d.manager_id=s.staff_id 
+                .' INNER JOIN '.DEPT_TABLE.' d
+                       ON(d.dept_id=s.dept_id
+                            OR d.manager_id=s.staff_id
                             OR (d.dept_id=g.dept_id AND d.group_membership=1)
                         ) '
                 .' WHERE d.dept_id='.db_input($this->getId())
                 .' ORDER BY s.lastname, s.firstname';
-           
+
             if(($res=db_query($sql)) && db_num_rows($res)) {
                 while(list($id)=db_fetch_row($res))
                     $this->members[] = Staff::lookup($id);
@@ -140,11 +140,11 @@ class Dept {
     function getTemplate() {
 
         if(!$this->template && $this->getTemplateId())
-            $this->template = Template::lookup($this->getTemplateId());
+            $this->template = EmailTemplateGroup::lookup($this->getTemplateId());
 
         return $this->template;
     }
-   
+
     function getAutoRespEmail() {
 
         if(!$this->autorespEmail && $this->ht['autoresp_email_id'] && ($email=Email::lookup($this->ht['autoresp_email_id'])))
@@ -154,12 +154,12 @@ class Dept {
 
         return $this->autorespEmail;
     }
- 
+
     function getEmailAddress() {
         if(($email=$this->getEmail()))
             return $email->getAddress();
     }
-    
+
     function getSignature() {
         return $this->ht['signature'];
     }
@@ -167,13 +167,13 @@ class Dept {
     function canAppendSignature() {
         return ($this->getSignature() && $this->isPublic());
     }
-    
+
     function getManagerId() {
         return $this->ht['manager_id'];
     }
 
     function getManager() {
-     
+
         if(!$this->manager && $this->getManagerId())
             $this->manager=Staff::lookup($this->getManagerId());
 
@@ -191,11 +191,11 @@ class Dept {
     function isPublic() {
          return ($this->ht['ispublic']);
     }
-    
+
     function autoRespONNewTicket() {
         return ($this->ht['ticket_auto_response']);
     }
-        
+
     function autoRespONNewMessage() {
         return ($this->ht['message_auto_response']);
     }
@@ -208,7 +208,7 @@ class Dept {
     function isGroupMembershipEnabled() {
         return ($this->ht['group_membership']);
     }
-   
+
     function getHashtable() {
         return $this->ht;
     }
@@ -218,7 +218,7 @@ class Dept {
     }
 
 
-      
+
     function getAllowedGroups() {
 
         if($this->groups) return $this->groups;
@@ -244,9 +244,9 @@ class Dept {
             }
         }
 
-            
+
         $sql='DELETE FROM '.GROUP_DEPT_TABLE.' WHERE dept_id='.db_input($this->getId());
-        if($groups && is_array($groups))  
+        if($groups && is_array($groups))
             $sql.=' AND group_id NOT IN('.implode(',', db_input($groups)).')';
 
         db_query($sql);
@@ -262,13 +262,13 @@ class Dept {
 
         $this->updateAllowedGroups($vars['groups']);
         $this->reload();
-        
+
         return true;
     }
 
     function delete() {
         global $cfg;
-        
+
         if(!$cfg || $this->getId()==$cfg->getDefaultDeptId() || $this->getNumUsers())
             return 0;
 
@@ -317,7 +317,7 @@ class Dept {
     }
 
     function getDepartments( $criteria=null) {
-        
+
         $depts=array();
         $sql='SELECT dept_id, dept_name FROM '.DEPT_TABLE.' WHERE 1';
         if($criteria['publiconly'])
@@ -347,13 +347,13 @@ class Dept {
 
     function save($id, $vars, &$errors) {
         global $cfg;
-                
+
         if($id && $id!=$vars['id'])
             $errors['err']='Missing or invalid Dept ID (internal error).';
-            
+
         if(!$vars['email_id'] || !is_numeric($vars['email_id']))
             $errors['email_id']='Email selection required';
-            
+
         if(!is_numeric($vars['tpl_id']))
             $errors['tpl_id']='Template selection required';
 
@@ -364,13 +364,13 @@ class Dept {
         } elseif(($did=Dept::getIdByName($vars['name'])) && $did!=$id) {
             $errors['name']='Department already exist';
         }
-        
+
         if(!$vars['ispublic'] && ($vars['id']==$cfg->getDefaultDeptId()))
             $errors['ispublic']='System default department can not be private';
 
         if($errors) return false;
 
-            
+
         $sql='SET updated=NOW() '
             .' ,ispublic='.db_input($vars['ispublic'])
             .' ,email_id='.db_input($vars['email_id'])
@@ -384,25 +384,25 @@ class Dept {
             .' ,ticket_auto_response='.db_input(isset($vars['ticket_auto_response'])?$vars['ticket_auto_response']:1)
             .' ,message_auto_response='.db_input(isset($vars['message_auto_response'])?$vars['message_auto_response']:1);
 
-            
+
         if($id) {
             $sql='UPDATE '.DEPT_TABLE.' '.$sql.' WHERE dept_id='.db_input($id);
             if(db_query($sql) && db_affected_rows())
                 return true;
-            
+
             $errors['err']='Unable to update '.Format::htmlchars($vars['name']).' Dept. Error occurred';
-           
+
         } else {
             $sql='INSERT INTO '.DEPT_TABLE.' '.$sql.',created=NOW()';
             if(db_query($sql) && ($id=db_insert_id()))
                 return $id;
 
-            
+
             $errors['err']='Unable to create department. Internal error';
-            
+
         }
 
-        
+
         return false;
     }
 
diff --git a/include/client/thankyou.inc.php b/include/client/thankyou.inc.php
deleted file mode 100644
index 6e2fe3b4b7218ec1468d09ec71fd1b70624cd70f..0000000000000000000000000000000000000000
--- a/include/client/thankyou.inc.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-if(!defined('OSTCLIENTINC') || !is_object($ticket)) die('Kwaheri rafiki!');
-//Please customize the message below to fit your organization speak!
-?>
-<div style="margin:5px 100px 100px 0;">
-    <?php echo Format::htmlchars($ticket->getName()); ?>,<br>
-    <p>
-     Thank you for contacting us.<br>
-     A support ticket request has been created and a representative will be getting back to you shortly if necessary.</p>
-          
-    <?php if($cfg->autoRespONNewTicket()){ ?>
-    <p>An email with the ticket number has been sent to <b><?php echo $ticket->getEmail(); ?></b>.
-        You'll need the ticket number along with your email to view status and progress online. 
-    </p>
-    <p>
-     If you wish to send additional comments or information regarding same issue, please follow the instructions on the email.
-    </p>
-    <?php } ?>
-    <p>Support Team </p>
-</div>
diff --git a/index.php b/index.php
index 0680a520d48df86ac572d36eead4f5b3dd6ec443..9a2ae35d32e47aee05ba40084ec256f840659c8e 100644
--- a/index.php
+++ b/index.php
@@ -17,13 +17,13 @@ require('client.inc.php');
 $section = 'home';
 require(CLIENTINC_DIR.'header.inc.php');
 ?>
-
 <div id="landing_page">
-    <h1>Welcome to the Support Center</h1>
-    <p>
-        In order to streamline support requests and better serve you, we utilize a support ticket system. Every support request is assigned a unique ticket number which you can use to track the progress and responses online. For your reference we provide complete archives and history of all your support requests. A valid email address is required to submit a ticket.
-    </p>
-
+    <?php
+    if($cfg && ($page = $cfg->getLandingPage()))
+        echo $page->getBody();
+    else
+        echo  '<h1>Welcome to the Support Center</h1>';
+    ?>
     <div id="new_ticket">
         <h3>Open A New Ticket</h3>
         <br>
diff --git a/offline.php b/offline.php
index 4e73aff2a856c3529f423c9465d85c2fee804147..04323f9e0a86d6831b6e6149ed65f3933fa88ed1 100644
--- a/offline.php
+++ b/offline.php
@@ -1,30 +1,34 @@
-<?php
-/*********************************************************************
-    offline.php
-
-    Offline page...modify to fit your needs.
-
-    Peter Rotich <peter@osticket.com>
-    Copyright (c)  2006-2013 osTicket
-    http://www.osticket.com
-
-    Released under the GNU General Public License WITHOUT ANY WARRANTY.
-    See LICENSE.TXT for details.
-
-    vim: expandtab sw=4 ts=4 sts=4:
-**********************************************************************/
-require_once('client.inc.php');
-if(is_object($ost) && $ost->isSystemOnline()) {
-    @header('Location: index.php'); //Redirect if the system is online.
-    include('index.php');
-    exit;
-}
-$nav=null;
-require(CLIENTINC_DIR.'header.inc.php');
-?>
-<div id="landing_page">
-    <h1>Support Ticket System Offline</h1>
-    <p>Thank you for your interest in contacting us.</p>
-    <p>Our helpdesk is offline at the moment, please check back at a later time.</p>
-</div>
-<?php require(CLIENTINC_DIR.'footer.inc.php'); ?>
+<?php
+/*********************************************************************
+    offline.php
+
+    Offline page...modify to fit your needs.
+
+    Peter Rotich <peter@osticket.com>
+    Copyright (c)  2006-2013 osTicket
+    http://www.osticket.com
+
+    Released under the GNU General Public License WITHOUT ANY WARRANTY.
+    See LICENSE.TXT for details.
+
+    vim: expandtab sw=4 ts=4 sts=4:
+**********************************************************************/
+require_once('client.inc.php');
+if(is_object($ost) && $ost->isSystemOnline()) {
+    @header('Location: index.php'); //Redirect if the system is online.
+    include('index.php');
+    exit;
+}
+$nav=null;
+require(CLIENTINC_DIR.'header.inc.php');
+?>
+<div id="landing_page">
+<?php
+if(($page=$cfg->getOfflinePage())) {
+    echo $page->getBody();
+} else {
+    echo '<h1>Support Ticket System Offline</h1>';
+}
+?>
+</div>
+<?php require(CLIENTINC_DIR.'footer.inc.php'); ?>
diff --git a/open.php b/open.php
index 0ce680707f6930cc324d3c4952a7bdf550ff60e6..3292e8564900e9676784ca54dd0599e9e6f59d2c 100644
--- a/open.php
+++ b/open.php
@@ -15,7 +15,7 @@
 **********************************************************************/
 require('client.inc.php');
 define('SOURCE','Web'); //Ticket source.
-$inc='open.inc.php';    //default include.
+$ticket = null;
 $errors=array();
 if($_POST):
     $vars = $_POST;
@@ -44,8 +44,6 @@ if($_POST):
             session_regenerate_id();
             @header('Location: tickets.php?id='.$ticket->getExtId());
         }
-        //Thank the user and promise speedy resolution!
-        $inc='thankyou.inc.php';
     }else{
         $errors['err']=$errors['err']?$errors['err']:'Unable to create a ticket. Please correct errors below and try again!';
     }
@@ -54,6 +52,19 @@ endif;
 //page
 $nav->setActiveNav('new');
 require(CLIENTINC_DIR.'header.inc.php');
-require(CLIENTINC_DIR.$inc);
+if($ticket
+        && (
+            (($topic = $ticket->getTopic()) && ($page = $topic->getPage()))
+            || ($page = $cfg->getThankYouPage())
+            )) { //Thank the user and promise speedy resolution!
+    //Hide ticket number -  it should only be delivered via email for security reasons.
+    echo Format::safe_html($ticket->replaceVars(str_replace(
+                    array('%{ticket.number}', '%{ticket.extId}', '%{ticket}'), //ticket number vars.
+                    array_fill(0, 3, 'XXXXXX'),
+                    $page->getBody()
+                    )));
+} else {
+    require(CLIENTINC_DIR.'open.inc.php');
+}
 require(CLIENTINC_DIR.'footer.inc.php');
 ?>