diff --git a/include/class.ticket.php b/include/class.ticket.php
index 14e49a9e3bd1bcd17e5ec3a3e82d575c8696ce15..50e8173611715153187190c253ea98aec2a77759 100644
--- a/include/class.ticket.php
+++ b/include/class.ticket.php
@@ -1628,7 +1628,7 @@ class Ticket {
     }
 
     //Insert Internal Notes
-    function logNote($title, $note, $poster, $alert=true) {
+    function logNote($title, $note, $poster='SYSTEM', $alert=true) {
 
         return $this->postNote(
                 array('title' => $title, 'note' => $note),
diff --git a/include/class.upgrader.php b/include/class.upgrader.php
index 2c898f646d7dd392790a55007774be1ae54c92a3..012f88d1160bea1fb09d2104129d19e8fccebd3e 100644
--- a/include/class.upgrader.php
+++ b/include/class.upgrader.php
@@ -67,9 +67,9 @@ class Upgrader extends SetupWizard {
 
         $subject = 'Upgrader Error';
         if($email) {
-            $email->send($thistaff->getEmail(), $subject, $error);
+            $email->send($thisstaff->getEmail(), $subject, $error);
         } else {//no luck - try the system mail.
-            Mailer::sendmail($thistaff->getEmail(), $subject, $error, sprintf('"osTicket Alerts"<%s>', $thistaff->getEmail()));
+            Mailer::sendmail($thisstaff->getEmail(), $subject, $error, sprintf('"osTicket Alerts"<%s>', $thisstaff->getEmail()));
         }
 
     }
diff --git a/include/staff/apikeys.inc.php b/include/staff/apikeys.inc.php
index fc0d418e76606ee7dc64f78fde73db932133ac79..b085329343d101fe69de9b4628ed13ace6d6586b 100644
--- a/include/staff/apikeys.inc.php
+++ b/include/staff/apikeys.inc.php
@@ -45,9 +45,10 @@ else
 <div style="float:right;text-align:right;padding-top:5px;padding-right:5px;">
  <b><a href="apikeys.php?a=add" class="Icon newapi">Add New API Key</a></b></div>
 <div class="clear"></div>
-<form action="apikeys.php" method="POST" name="keys" onSubmit="return checkbox_checker(this,1,0);">
+<form action="apikeys.php" method="POST" name="keys">
  <?php csrf_token(); ?>
  <input type="hidden" name="do" value="mass_process" >
+<input type="hidden" id="action" name="a" value="" >
  <table class="list" border="0" cellspacing="1" cellpadding="0" width="940">
     <caption><?php echo $showing; ?></caption>
     <thead>
@@ -67,15 +68,13 @@ else
         if($res && db_num_rows($res)):
             while ($row = db_fetch_array($res)) {
                 $sel=false;
-                if($ids && in_array($row['id'],$ids)){
-                    $class="$class highlight";
+                if($ids && in_array($row['id'],$ids))
                     $sel=true;
-                }
                 ?>
             <tr id="<?php echo $row['id']; ?>">
                 <td width=7px>
-                  <input type="checkbox" name="ids[]" value="<?php echo $row['id']; ?>" 
-                            <?php echo $sel?'checked="checked"':''; ?> onClick="highLight(this.value,this.checked);"> </td>
+                  <input type="checkbox" class="ckb" name="ids[]" value="<?php echo $row['id']; ?>" 
+                            <?php echo $sel?'checked="checked"':''; ?>> </td>
                 <td>&nbsp;<?php echo Format::db_date($row['created']); ?></td>
                 <td>&nbsp;<a href="apikeys.php?id=<?php echo $row['id']; ?>"><?php echo Format::htmlchars($row['apikey']); ?></a></td>
                 <td><?php echo $row['isactive']?'Active':'<b>Disabled</b>'; ?></td>
@@ -90,9 +89,9 @@ else
         <td colspan="7">
             <?php if($res && $num){ ?>
             Select:&nbsp;
-            <a href="#" onclick="return select_all(document.forms['keys'],true)">All</a>&nbsp;&nbsp;
-            <a href="#" onclick="return reset_all(document.forms['keys'])">None</a>&nbsp;&nbsp;
-            <a href="#" onclick="return toogle_all(document.forms['keys'],true)">Toggle</a>&nbsp;&nbsp;
+            <a id="selectAll" href="#ckb">All</a>&nbsp;&nbsp;
+            <a id="selectNone" href="#ckb">None</a>&nbsp;&nbsp;
+            <a id="selectToggle" href="#ckb">Toggle</a>&nbsp;&nbsp;
             <?php }else{
                 echo 'No API keys found';
             } ?>
@@ -104,16 +103,38 @@ else
 if($res && $num): //Show options..
     echo '<div>&nbsp;Page:'.$pageNav->getPageLinks().'&nbsp;</div>';
 ?>
-<p class="centered">
-    <input class="button" type="submit" name="enable" value="Enable"
-                onClick=' return confirm("Are you sure you want to ENABLE selected API keys?");'>
-    <input class="button" type="submit" name="disable" value="Disable"
-                onClick=' return confirm("Are you sure you want to DISABLE selected API keys?");'>
-    <input class="button" type="submit" name="delete" value="Delete"
-                onClick=' return confirm("Are you sure you want to DELETE selected API keys?");'>
+<p class="centered" id="actions">
+    <input class="button" type="submit" name="enable" value="Enable" >
+    <input class="button" type="submit" name="disable" value="Disable">
+    <input class="button" type="submit" name="delete" value="Delete">
 </p>
 <?php
 endif;
 ?>
 </form>
-
+<div style="display:none;" class="dialog" id="confirm-action">
+    <h3>Please Confirm</h3>
+    <a class="close" href="">&times;</a>
+    <hr/>
+    <p class="confirm-action" style="display:none;" id="enable-confirm">
+        Are you sure want to <b>enable</b> selected API keys?
+    </p>
+    <p class="confirm-action" style="display:none;" id="disable-confirm">
+        Are you sure want to <b>disable</b>  selected API keys?
+    </p>
+    <p class="confirm-action" style="display:none;" id="delete-confirm">
+        <font color="red"><strong>Are you sure you want to DELETE selected API keys?</strong></font>
+        <br><br>Deleted keys CANNOT be recovered.
+    </p>
+    <div>Please confirm to continue.</div>
+    <hr style="margin-top:1em"/>
+    <p class="full-width">
+        <span class="buttons" style="float:left">
+            <input type="button" value="No, Cancel" class="close">
+        </span>
+        <span class="buttons" style="float:right">
+            <input type="button" value="Yes, Do it!" class="confirm">
+        </span>
+     </p>
+    <div class="clear"></div>
+</div>
diff --git a/include/staff/banlist.inc.php b/include/staff/banlist.inc.php
index b2b37b284b0ae4de0750650b2feb9fae2135cf5d..aaaaaf0b361d9d6aa86e7289ea46a1e9dd5088f2 100644
--- a/include/staff/banlist.inc.php
+++ b/include/staff/banlist.inc.php
@@ -17,8 +17,6 @@ if($_REQUEST['q'] && strlen($_REQUEST['q'])>3) {
     $errors['q']='Term too short!';
 }
 
-//TODO: Add search here..
-
 $sortOptions=array('email'=>'rule.val','status'=>'isactive','created'=>'rule.created','created'=>'rule.updated');
 $orderWays=array('DESC'=>'DESC','ASC'=>'ASC');
 $sort=($_REQUEST['sort'] && $sortOptions[strtolower($_REQUEST['sort'])])?strtolower($_REQUEST['sort']):'email';
@@ -71,9 +69,10 @@ if($search)
     $showing='Search Results: '.$showing;
     
 ?>
-<form action="banlist.php" method="POST" name="banlist" onSubmit="return checkbox_checker(this,1,0);">
+<form action="banlist.php" method="POST" name="banlist">
  <?php csrf_token(); ?>
  <input type="hidden" name="do" value="mass_process" >
+<input type="hidden" id="action" name="a" value="" >
  <table class="list" border="0" cellspacing="1" cellpadding="0" width="940">
     <caption><?php echo $showing; ?></caption>
     <thead>
@@ -91,15 +90,13 @@ if($search)
             $ids=($errors && is_array($_POST['ids']))?$_POST['ids']:null;
             while ($row = db_fetch_array($res)) {
                 $sel=false;
-                if($ids && in_array($row['id'],$ids)){
-                    $class="$class highlight";
+                if($ids && in_array($row['id'],$ids))
                     $sel=true;
-                }
                 ?>
                <tr id="<?php echo $row['id']; ?>">
                 <td width=7px>
-                  <input type="checkbox" name="ids[]" value="<?php echo $row['id']; ?>" <?php echo $sel?'checked="checked"':''; ?>  
-                        onClick="highLight(this.value,this.checked);">
+                  <input type="checkbox" class="ckb" name="ids[]" value="<?php echo $row['id']; ?>" <?php echo $sel?'checked="checked"':''; ?>>
+                </td>
                 <td>&nbsp;<a href="banlist.php?id=<?php echo $row['id']; ?>"><?php echo Format::htmlchars($row['val']); ?></a></td>
                 <td>&nbsp;&nbsp;<?php echo $row['isactive']?'Active':'<b>Disabled</b>'; ?></td>
                 <td><?php echo Format::db_date($row['created']); ?></td>
@@ -113,9 +110,9 @@ if($search)
         <td colspan="5">
             <?php if($res && $num){ ?>
             Select:&nbsp;
-            <a href="#" onclick="return select_all(document.forms['banlist'],true)">All</a>&nbsp;&nbsp;
-            <a href="#" onclick="return reset_all(document.forms['banlist'])">None</a>&nbsp;&nbsp;
-            <a href="#" onclick="return toogle_all(document.forms['banlist'],true)">Toggle</a>&nbsp;&nbsp;
+            <a id="selectAll" href="#ckb">All</a>&nbsp;&nbsp;
+            <a id="selectNone" href="#ckb">None</a>&nbsp;&nbsp;
+            <a id="selectToggle" href="#ckb">Toggle</a>&nbsp;&nbsp;
             <?php }else{
                 echo 'No banned emails found!';
             } ?>
@@ -127,18 +124,41 @@ if($search)
 if($res && $num): //Show options..
     echo '<div>&nbsp;Page:'.$pageNav->getPageLinks().'&nbsp;</div>';
 ?>
-<p class="centered">
-    <input class="button" type="submit" name="enable" value="Enable"
-        onClick=' return confirm("Are you sure you want to ENABLE selected email ban?");'>
+<p class="centered" id="actions">
+    <input class="button" type="submit" name="enable" value="Enable" >
     &nbsp;&nbsp;
-    <input class="button" type="submit" name="disable" value="Disable"
-        onClick=' return confirm("Are you sure you want to DISABLE selected emails ban?");'>
+    <input class="button" type="submit" name="disable" value="Disable" >
     &nbsp;&nbsp;
-    <input class="button" type="submit" name="delete" value="Delete"
-        onClick=' return confirm("Are you sure you want to DELETE selected emails?");'>
+    <input class="button" type="submit" name="delete" value="Delete">
 </p>
 <?php
 endif;
 ?>
 </form>
 
+<div style="display:none;" class="dialog" id="confirm-action">
+    <h3>Please Confirm</h3>
+    <a class="close" href="">&times;</a>
+    <hr/>
+    <p class="confirm-action" style="display:none;" id="enable-confirm">
+        Are you sure want to <b>enable</b> selected ban rules?
+    </p>
+    <p class="confirm-action" style="display:none;" id="disable-confirm">
+        Are you sure want to <b>disable</b>  selected ban rules?
+    </p>
+    <p class="confirm-action" style="display:none;" id="delete-confirm">
+        <font color="red"><strong>Are you sure you want to DELETE selected ban rules?</strong></font>
+    </p>
+    <div>Please confirm to continue.</div>
+    <hr style="margin-top:1em"/>
+    <p class="full-width">
+        <span class="buttons" style="float:left">
+            <input type="button" value="No, Cancel" class="close">
+        </span>
+        <span class="buttons" style="float:right">
+            <input type="button" value="Yes, Do it!" class="confirm">
+        </span>
+     </p>
+    <div class="clear"></div>
+</div>
+
diff --git a/include/staff/cannedresponses.inc.php b/include/staff/cannedresponses.inc.php
index a2fe2b02531ce16d735cabee7612e35e10ebc568..c1052be2aa5f6ea2499314dcf033125755cf619f 100644
--- a/include/staff/cannedresponses.inc.php
+++ b/include/staff/cannedresponses.inc.php
@@ -52,9 +52,10 @@ else
 <div style="float:right;text-align:right;padding-top:5px;padding-right:5px;">
     <b><a href="canned.php?a=add" class="Icon newReply">Add New Response</a></b></div>
 <div class="clear"></div>
-<form action="canned.php" method="POST" name="canned" onSubmit="return checkbox_checker(this,1,0);">
+<form action="canned.php" method="POST" name="canned">
  <?php csrf_token(); ?>
  <input type="hidden" name="do" value="mass_process" >
+ <input type="hidden" id="action" name="a" value="" >
  <table class="list" border="0" cellspacing="1" cellpadding="0" width="940">
     <caption><?php echo $showing; ?></caption>
     <thead>
@@ -71,20 +72,16 @@ else
         $total=0;
         $ids=($errors && is_array($_POST['ids']))?$_POST['ids']:null;
         if($res && db_num_rows($res)):
-            $defaultId=$cfg->getDefaultDeptId();
             while ($row = db_fetch_array($res)) {
                 $sel=false;
-                if($ids && in_array($row['canned_id'],$ids)){
-                    $class="$class highlight";
+                if($ids && in_array($row['canned_id'],$ids))
                     $sel=true;
-                }
                 $files=$row['files']?'<span class="Icon file">&nbsp;</span>':'';
                 ?>
             <tr id="<?php echo $row['canned_id']; ?>">
                 <td width=7px>
-                  <input type="checkbox" name="ids[]" value="<?php echo $row['canned_id']; ?>"
-                            <?php echo $sel?'checked="checked"':''; ?>  <?php echo $default?'disabled="disabled"':''; ?>
-                                onClick="highLight(this.value,this.checked);"/>
+                  <input type="checkbox" name="ids[]" value="<?php echo $row['canned_id']; ?>" class="ckb"
+                            <?php echo $sel?'checked="checked"':''; ?> />
                 </td>
                 <td>
                     <a href="canned.php?id=<?php echo $row['canned_id']; ?>"><?php echo Format::truncate($row['title'],200); echo "&nbsp;$files"; ?></a>&nbsp;
@@ -101,9 +98,9 @@ else
         <td colspan="5">
             <?php if($res && $num){ ?>
             Select:&nbsp;
-            <a href="#" onclick="return select_all(document.forms['canned'],true)">All</a>&nbsp;&nbsp;
-            <a href="#" onclick="return reset_all(document.forms['canned'])">None</a>&nbsp;&nbsp;
-            <a href="#" onclick="return toogle_all(document.forms['canned'],true)">Toggle</a>&nbsp;&nbsp;
+            <a id="selectAll" href="#ckb">All</a>&nbsp;&nbsp;
+            <a id="selectNone" href="#ckb">None</a>&nbsp;&nbsp;
+            <a id="selectToggle" href="#ckb">Toggle</a>&nbsp;&nbsp;
             <?php }else{
                 echo 'No canned responses';
             } ?>
@@ -115,15 +112,41 @@ else
 if($res && $num): //Show options..
     echo '<div>&nbsp;Page:'.$pageNav->getPageLinks().'&nbsp;</div>';
 ?>
-<p class="centered">
-    <input class="button" type="submit" name="enable" value="Enable"
-                onClick=' return confirm("Are you sure you want to ENABLE selected responses?");'>
-    <input class="button" type="submit" name="disable" value="Disable"
-                onClick=' return confirm("Are you sure you want to DISABLE selected responses?");'>
-    <input class="button" type="submit" name="delete" value="Delete"
-                onClick=' return confirm("Are you sure you want to DELETE selected responses?");'>
+<p class="centered" id="actions">
+    <input class="button" type="submit" name="enable" value="Enable" >
+    <input class="button" type="submit" name="disable" value="Disable" >
+    <input class="button" type="submit" name="delete" value="Delete" >
 </p>
 <?php
 endif;
 ?>
 </form>
+<div style="display:none;" class="dialog" id="confirm-action">
+    <h3>Please Confirm</h3>
+    <a class="close" href="">&times;</a>
+    <hr/>
+    <p class="confirm-action" style="display:none;" id="enable-confirm">
+        Are you sure want to <b>enable</b> selected canned responses?
+    </p>
+    <p class="confirm-action" style="display:none;" id="disable-confirm">
+        Are you sure want to <b>disable</b> selected canned responses?
+    </p>
+    <p class="confirm-action" style="display:none;" id="mark_overdue-confirm">
+        Are you sure want to flag the selected tickets as <font color="red"><b>overdue</b></font>?
+    </p>
+    <p class="confirm-action" style="display:none;" id="delete-confirm">
+        <font color="red"><strong>Are you sure you want to DELETE selected canned responses?</strong></font>
+        <br><br>Deleted items CANNOT be recovered, including any associated attachments.
+    </p>
+    <div>Please confirm to continue.</div>
+    <hr style="margin-top:1em"/>
+    <p class="full-width">
+        <span class="buttons" style="float:left">
+            <input type="button" value="No, Cancel" class="close">
+        </span>
+        <span class="buttons" style="float:right">
+            <input type="button" value="Yes, Do it!" class="confirm">
+        </span>
+     </p>
+    <div class="clear"></div>
+</div>
diff --git a/include/staff/categories.inc.php b/include/staff/categories.inc.php
index 8d966d9c2b648645146ed8dff536ad472d20c29c..293388d19485a03f63e71a167e466ac6015ce0a2 100644
--- a/include/staff/categories.inc.php
+++ b/include/staff/categories.inc.php
@@ -46,9 +46,10 @@ else
 <div style="float:right;text-align:right;padding-top:5px;padding-right:5px;">
     <b><a href="categories.php?a=add" class="Icon newCategory">Add New Category</a></b></div>
 <div class="clear"></div>
-<form action="categories.php" method="POST" name="cat" onSubmit="return checkbox_checker(this,1,0);">
+<form action="categories.php" method="POST" name="cat">
  <?php csrf_token(); ?>
  <input type="hidden" name="do" value="mass_process" >
+ <input type="hidden" id="action" name="a" value="" >
  <table class="list" border="0" cellspacing="1" cellpadding="0" width="940">
     <caption><?php echo $showing; ?></caption>
     <thead>
@@ -65,23 +66,20 @@ else
         $total=0;
         $ids=($errors && is_array($_POST['ids']))?$_POST['ids']:null;
         if($res && db_num_rows($res)):
-            $defaultId=$cfg->getDefaultDeptId();
             while ($row = db_fetch_array($res)) {
                 $sel=false;
-                if($ids && in_array($row['category_id'],$ids)){
-                    $class="$class highlight";
+                if($ids && in_array($row['category_id'],$ids))
                     $sel=true;
-                }
+                
                 $faqs=0;
                 if($row['faqs'])
                     $faqs=sprintf('<a href="faq.php?cid=%d">%d</a>',$row['category_id'],$row['faqs']);
-
                 ?>
             <tr id="<?php echo $row['category_id']; ?>">
                 <td width=7px>
-                  <input type="checkbox" name="ids[]" value="<?php echo $row['category_id']; ?>"
-                            <?php echo $sel?'checked="checked"':''; ?>  <?php echo $default?'disabled="disabled"':''; ?>
-                                onClick="highLight(this.value,this.checked);"> </td>
+                  <input type="checkbox" name="ids[]" value="<?php echo $row['category_id']; ?>" class="ckb"
+                            <?php echo $sel?'checked="checked"':''; ?>>
+                </td>
                 <td><a href="categories.php?id=<?php echo $row['category_id']; ?>"><?php echo Format::truncate($row['name'],200); ?></a>&nbsp;</td>
                 <td><?php echo $row['ispublic']?'<b>Public</b>':'Internal'; ?></td>
                 <td style="text-align:right;padding-right:25px;"><?php echo $faqs; ?></td>
@@ -95,9 +93,9 @@ else
         <td colspan="5">
             <?php if($res && $num){ ?>
             Select:&nbsp;
-            <a href="#" onclick="return select_all(document.forms['cat'],true)">All</a>&nbsp;&nbsp;
-            <a href="#" onclick="return reset_all(document.forms['cat'])">None</a>&nbsp;&nbsp;
-            <a href="#" onclick="return toogle_all(document.forms['cat'],true)">Toggle</a>&nbsp;&nbsp;
+            <a id="selectAll" href="#ckb">All</a>&nbsp;&nbsp;
+            <a id="selectNone" href="#ckb">None</a>&nbsp;&nbsp;
+            <a id="selectToggle" href="#ckb">Toggle</a>&nbsp;&nbsp;
             <?php }else{
                 echo 'No FAQ categories found.';
             } ?>
@@ -109,15 +107,38 @@ else
 if($res && $num): //Show options..
     echo '<div>&nbsp;Page:'.$pageNav->getPageLinks().'&nbsp;</div>';
 ?>
-<p class="centered">
-    <input class="button" type="submit" name="public" value="Make Public"
-                onClick=' return confirm("Are you sure you want to make selected categories PUBLIC?");'>
-    <input class="button" type="submit" name="private" value="Make Internal"
-                onClick=' return confirm("Are you sure you want to make selected categories INTERNAL?");'>
-    <input class="button" type="submit" name="delete" value="Delete"
-                onClick=' return confirm("Are you sure you want to DELETE selected categories - including associated FAQs?");'>
+<p class="centered" id="actions">
+    <input class="button" type="submit" name="make_public" value="Make Public">
+    <input class="button" type="submit" name="make_private" value="Make Internal">
+    <input class="button" type="submit" name="delete" value="Delete" >
 </p>
 <?php
 endif;
 ?>
 </form>
+<div style="display:none;" class="dialog" id="confirm-action">
+    <h3>Please Confirm</h3>
+    <a class="close" href="">&times;</a>
+    <hr/>
+    <p class="confirm-action" style="display:none;" id="make_public-confirm">
+        Are you sure want to make selected categories <b>public</b>?
+    </p>
+    <p class="confirm-action" style="display:none;" id="make_private-confirm">
+        Are you sure want to make selected categories <b>private</b> (internal)?
+    </p>
+    <p class="confirm-action" style="display:none;" id="delete-confirm">
+        <font color="red"><strong>Are you sure you want to DELETE selected categories?</strong></font>
+        <br><br>Deleted entries CANNOT be recovered, including any associated FAQs.
+    </p>
+    <div>Please confirm to continue.</div>
+    <hr style="margin-top:1em"/>
+    <p class="full-width">
+        <span class="buttons" style="float:left">
+            <input type="button" value="No, Cancel" class="close">
+        </span>
+        <span class="buttons" style="float:right">
+            <input type="button" value="Yes, Do it!" class="confirm">
+        </span>
+     </p>
+    <div class="clear"></div>
+</div>
diff --git a/include/staff/departments.inc.php b/include/staff/departments.inc.php
index a46115f422b87abc4446cd4f301e171aa92e539d..64b668463e38ca51b39ba9146b8242493687c175 100644
--- a/include/staff/departments.inc.php
+++ b/include/staff/departments.inc.php
@@ -46,9 +46,10 @@ else
 <div style="float:right;text-align:right;padding-top:5px;padding-right:5px;">
     <b><a href="departments.php?a=add" class="Icon newDepartment">Add New Department</a></b></div>
 <div class="clear"></div>
-<form action="departments.php" method="POST" name="depts" onSubmit="return checkbox_checker(this,1,0);">
+<form action="departments.php" method="POST" name="depts">
  <?php csrf_token(); ?>
  <input type="hidden" name="do" value="mass_process" >
+ <input type="hidden" id="action" name="a" value="" >
  <table class="list" border="0" cellspacing="1" cellpadding="0" width="940">
     <caption><?php echo $showing; ?></caption>
     <thead>
@@ -69,18 +70,17 @@ else
             $defaultId=$cfg->getDefaultDeptId();
             while ($row = db_fetch_array($res)) {
                 $sel=false;
-                if($ids && in_array($row['dept_id'],$ids)){
-                    $class="$class highlight";
+                if($ids && in_array($row['dept_id'],$ids))
                     $sel=true;
-                }
+                
                 $row['email']=$row['email_name']?($row['email_name'].' &lt;'.$row['email'].'&gt;'):$row['email'];
                 $default=($defaultId==$row['dept_id'])?' <small>(Default)</small>':'';
                 ?>
             <tr id="<?php echo $row['dept_id']; ?>">
                 <td width=7px>
-                  <input type="checkbox" name="ids[]" value="<?php echo $row['dept_id']; ?>" 
-                            <?php echo $sel?'checked="checked"':''; ?>  <?php echo $default?'disabled="disabled"':''; ?>
-                                onClick="highLight(this.value,this.checked);"> </td>
+                  <input type="checkbox" class="ckb" name="ids[]" value="<?php echo $row['dept_id']; ?>" 
+                            <?php echo $sel?'checked="checked"':''; ?>  <?php echo $default?'disabled="disabled"':''; ?> >
+                </td>
                 <td><a href="departments.php?id=<?php echo $row['dept_id']; ?>"><?php echo $row['dept_name']; ?></a>&nbsp;<?php echo $default; ?></td>
                 <td><?php echo $row['ispublic']?'Public':'<b>Private</b>'; ?></td>
                 <td>&nbsp;&nbsp;
@@ -102,9 +102,9 @@ else
         <td colspan="6">
             <?php if($res && $num){ ?>
             Select:&nbsp;
-            <a href="#" onclick="return select_all(document.forms['depts'],true)">All</a>&nbsp;&nbsp;
-            <a href="#" onclick="return reset_all(document.forms['depts'])">None</a>&nbsp;&nbsp;
-            <a href="#" onclick="return toogle_all(document.forms['depts'],true)">Toggle</a>&nbsp;&nbsp;
+            <a id="selectAll" href="#ckb">All</a>&nbsp;&nbsp;
+            <a id="selectNone" href="#ckb">None</a>&nbsp;&nbsp;
+            <a id="selectToggle" href="#ckb">Toggle</a>&nbsp;&nbsp;
             <?php }else{
                 echo 'No department found';
             } ?>
@@ -115,17 +115,40 @@ else
 <?php
 if($res && $num): //Show options..
 ?>
-<p class="centered">
-    <input class="button" type="submit" name="public" value="Make Public"
-                onClick=' return confirm("Are you sure you want to make selected departments public?");'>
-    <input class="button" type="submit" name="private" value="Make Private"
-                onClick=' return confirm("Are you sure you want to make selected departments private?");'>
-    <input class="button" type="submit" name="delete" value="Delete Dept(s)"
-                onClick=' return confirm("Are you sure you want to DELETE selected departments?");'>
+<p class="centered" id="actions">
+    <input class="button" type="submit" name="make_public" value="Make Public" >
+    <input class="button" type="submit" name="make_private" value="Make Private" >
+    <input class="button" type="submit" name="delete" value="Delete Dept(s)" >
 </p>
 <?php
 endif;
 ?>
-
 </form>
 
+<div style="display:none;" class="dialog" id="confirm-action">
+    <h3>Please Confirm</h3>
+    <a class="close" href="">&times;</a>
+    <hr/>
+    <p class="confirm-action" style="display:none;" id="make_public-confirm">
+        Are you sure want to make selected departments <b>public</b>?
+    </p>
+    <p class="confirm-action" style="display:none;" id="make_private-confirm">
+        Are you sure want to make selected departments <b>private</b>?
+    </p>
+    <p class="confirm-action" style="display:none;" id="delete-confirm">
+        <font color="red"><strong>Are you sure you want to DELETE selected departments?</strong></font>
+        <br><br>Deleted departments CANNOT be recovered.
+    </p>
+    <div>Please confirm to continue.</div>
+    <hr style="margin-top:1em"/>
+    <p class="full-width">
+        <span class="buttons" style="float:left">
+            <input type="button" value="No, Cancel" class="close">
+        </span>
+        <span class="buttons" style="float:right">
+            <input type="button" value="Yes, Do it!" class="confirm">
+        </span>
+     </p>
+    <div class="clear"></div>
+</div>
+
diff --git a/include/staff/emails.inc.php b/include/staff/emails.inc.php
index 4ab93d22105e3d42ba11efe6321a13d912548ee2..e5f035d1c254656d112879bd4753aaba7ba0908e 100644
--- a/include/staff/emails.inc.php
+++ b/include/staff/emails.inc.php
@@ -48,9 +48,10 @@ else
 <div style="float:right;text-align:right;padding-top:5px;padding-right:5px;">
     <b><a href="emails.php?a=add" class="Icon newEmail">Add New Email</a></b></div>
 <div class="clear"></div>
-<form action="emails.php" method="POST" name="emails" onSubmit="return checkbox_checker(this,1,0);">
+<form action="emails.php" method="POST" name="emails">
  <?php csrf_token(); ?>
  <input type="hidden" name="do" value="mass_process" >
+ <input type="hidden" id="action" name="a" value="" >
  <table class="list" border="0" cellspacing="1" cellpadding="0" width="940">
     <caption><?php echo $showing; ?></caption>
     <thead>
@@ -71,10 +72,8 @@ else
             $defaultId=$cfg->getDefaultEmailId();
             while ($row = db_fetch_array($res)) {
                 $sel=false;
-                if($ids && in_array($row['email_id'],$ids)){
-                    $class="$class highlight";
+                if($ids && in_array($row['email_id'],$ids))
                     $sel=true;
-                }
                 $default=($row['email_id']==$defaultId);
                 $email=$row['email'];
                 if($row['name'])
@@ -82,13 +81,8 @@ else
                 ?>
             <tr id="<?php echo $row['email_id']; ?>">
                 <td width=7px>
-                 <?php if($row['email_id']==$defaultId){ ?>
-                    &nbsp;
-                 <?php }else{ ?>
-                  <input type="checkbox" name="ids[]" value="<?php echo $row['email_id']; ?>" 
-                            <?php echo $sel?'checked="checked"':''; ?>  <?php echo $default?'disabled="disabled"':''; ?>
-                                onClick="highLight(this.value,this.checked);"> 
-                  <?php } ?>
+                  <input type="checkbox" class="ckb" name="ids[]" value="<?php echo $row['email_id']; ?>" 
+                            <?php echo $sel?'checked="checked"':''; ?>  <?php echo $default?'disabled="disabled"':''; ?>>
                 </td>
                 <td><a href="emails.php?id=<?php echo $row['email_id']; ?>"><?php echo Format::htmlchars($email); ?></a>&nbsp;</td>
                 <td><?php echo $row['priority']; ?></td>
@@ -104,9 +98,9 @@ else
         <td colspan="6">
             <?php if($res && $num){ ?>
             Select:&nbsp;
-            <a href="#" onclick="return select_all(document.forms['emails'],true)">All</a>&nbsp;&nbsp;
-            <a href="#" onclick="return reset_all(document.forms['emails'])">None</a>&nbsp;&nbsp;
-            <a href="#" onclick="return toogle_all(document.forms['emails'],true)">Toggle</a>&nbsp;&nbsp;
+            <a id="selectAll" href="#ckb">All</a>&nbsp;&nbsp;
+            <a id="selectNone" href="#ckb">None</a>&nbsp;&nbsp;
+            <a id="selectToggle" href="#ckb">Toggle</a>&nbsp;&nbsp;
             <?php }else{
                 echo 'No help emails found';
             } ?>
@@ -118,12 +112,31 @@ else
 if($res && $num): //Show options..
     echo '<div>&nbsp;Page:'.$pageNav->getPageLinks().'&nbsp;</div>';
 ?>
-<p class="centered">
-    <input class="button" type="submit" name="delete" value="Delete Email(s)"
-                onClick=' return confirm("Are you sure you want to DELETE selected emails?");'>
+<p class="centered" id="actions">
+    <input class="button" type="submit" name="delete" value="Delete Email(s)" >
 </p>
 <?php
 endif;
 ?>
 </form>
 
+<div style="display:none;" class="dialog" id="confirm-action">
+    <h3>Please Confirm</h3>
+    <a class="close" href="">&times;</a>
+    <hr/>
+    <p class="confirm-action" style="display:none;" id="delete-confirm">
+        <font color="red"><strong>Are you sure you want to DELETE selected emails?</strong></font>
+        <br><br>Deleted emails CANNOT be recovered.
+    </p>
+    <div>Please confirm to continue.</div>
+    <hr style="margin-top:1em"/>
+    <p class="full-width">
+        <span class="buttons" style="float:left">
+            <input type="button" value="No, Cancel" class="close">
+        </span>
+        <span class="buttons" style="float:right">
+            <input type="button" value="Yes, Do it!" class="confirm">
+        </span>
+     </p>
+    <div class="clear"></div>
+</div>
diff --git a/include/staff/filters.inc.php b/include/staff/filters.inc.php
index 7573eceec7d3a82950a52e9e04ce2fce213754e8..106f80586a0fe783546c281da38b88b6ba5327d4 100644
--- a/include/staff/filters.inc.php
+++ b/include/staff/filters.inc.php
@@ -49,9 +49,10 @@ else
 <div style="float:right;text-align:right;padding-top:5px;padding-right:5px;">
  <b><a href="filters.php?a=add" class="Icon newEmailFilter">Add New Filter</a></b></div>
 <div class="clear"></div>
-<form action="filters.php" method="POST" name="filters" onSubmit="return checkbox_checker(this,1,0);">
+<form action="filters.php" method="POST" name="filters">
  <?php csrf_token(); ?>
  <input type="hidden" name="do" value="mass_process" >
+<input type="hidden" id="action" name="a" value="" >
  <table class="list" border="0" cellspacing="1" cellpadding="0" width="940">
     <caption><?php echo $showing; ?></caption>
     <thead>
@@ -73,15 +74,14 @@ else
         if($res && db_num_rows($res)):
             while ($row = db_fetch_array($res)) {
                 $sel=false;
-                if($ids && in_array($row['id'],$ids)){
-                    $class="$class highlight";
+                if($ids && in_array($row['id'],$ids))
                     $sel=true;
-                }
                 ?>
             <tr id="<?php echo $row['id']; ?>">
                 <td width=7px>
-                  <input type="checkbox" name="ids[]" value="<?php echo $row['id']; ?>" 
-                            <?php echo $sel?'checked="checked"':''; ?> onClick="highLight(this.value,this.checked);"> </td>
+                  <input type="checkbox" class="ckb" name="ids[]" value="<?php echo $row['id']; ?>" 
+                            <?php echo $sel?'checked="checked"':''; ?>>
+                </td>
                 <td>&nbsp;<a href="filters.php?id=<?php echo $row['id']; ?>"><?php echo Format::htmlchars($row['name']); ?></a></td>
                 <td><?php echo $row['isactive']?'Active':'<b>Disabled</b>'; ?></td>
                 <td style="text-align:right;padding-right:25px;"><?php echo $row['execorder']; ?>&nbsp;</td>
@@ -98,9 +98,9 @@ else
         <td colspan="8">
             <?php if($res && $num){ ?>
             Select:&nbsp;
-            <a href="#" onclick="return select_all(document.forms['filters'],true)">All</a>&nbsp;&nbsp;
-            <a href="#" onclick="return reset_all(document.forms['filters'])">None</a>&nbsp;&nbsp;
-            <a href="#" onclick="return toogle_all(document.forms['filters'],true)">Toggle</a>&nbsp;&nbsp;
+            <a id="selectAll" href="#ckb">All</a>&nbsp;&nbsp;
+            <a id="selectNone" href="#ckb">None</a>&nbsp;&nbsp;
+            <a id="selectToggle" href="#ckb">Toggle</a>&nbsp;&nbsp;
             <?php }else{
                 echo 'No filters found';
             } ?>
@@ -112,16 +112,40 @@ else
 if($res && $num): //Show options..
     echo '<div>&nbsp;Page:'.$pageNav->getPageLinks().'&nbsp;</div>';
 ?>
-<p class="centered">
-    <input class="button" type="submit" name="enable" value="Enable"
-                onClick=' return confirm("Are you sure you want to ENABLE selected filters?");'>
-    <input class="button" type="submit" name="disable" value="Disable"
-                onClick=' return confirm("Are you sure you want to DISABLE selected filters?");'>
-    <input class="button" type="submit" name="delete" value="Delete"
-                onClick=' return confirm("Are you sure you want to DELETE selected filters?");'>
+<p class="centered" id="actions">
+    <input class="button" type="submit" name="enable" value="Enable">
+    <input class="button" type="submit" name="disable" value="Disable">
+    <input class="button" type="submit" name="delete" value="Delete">
 </p>
 <?php
 endif;
 ?>
 </form>
 
+<div style="display:none;" class="dialog" id="confirm-action">
+    <h3>Please Confirm</h3>
+    <a class="close" href="">&times;</a>
+    <hr/>
+    <p class="confirm-action" style="display:none;" id="enable-confirm">
+        Are you sure want to <b>enable</b> selected filters?
+    </p>
+    <p class="confirm-action" style="display:none;" id="disable-confirm">
+        Are you sure want to <b>disable</b>  selected filters?
+    </p>
+    <p class="confirm-action" style="display:none;" id="delete-confirm">
+        <font color="red"><strong>Are you sure you want to DELETE selected filters?</strong></font>
+        <br><br>Deleted filters CANNOT be recovered, including any associated rules.
+    </p>
+    <div>Please confirm to continue.</div>
+    <hr style="margin-top:1em"/>
+    <p class="full-width">
+        <span class="buttons" style="float:left">
+            <input type="button" value="No, Cancel" class="close">
+        </span>
+        <span class="buttons" style="float:right">
+            <input type="button" value="Yes, Do it!" class="confirm">
+        </span>
+     </p>
+    <div class="clear"></div>
+</div>
+
diff --git a/include/staff/group.inc.php b/include/staff/group.inc.php
index a442c3ce02e91c249636d4c762cd9a9ed54b6c89..f2935d72e56237ce35dbc701f563fdeaf475a829 100644
--- a/include/staff/group.inc.php
+++ b/include/staff/group.inc.php
@@ -134,7 +134,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
         </tr>
         <tr>
             <th colspan="2">
-                <em><strong>Department Access</strong>: Check all departments the group members are allowed to access.&nbsp;&nbsp;&nbsp;<a href="#" onclick="return select_all(document.forms['group'])">Select All</a>&nbsp;&nbsp;<a href="#" onclick="return reset_all(document.forms['group'])">Select None</a></em>
+                <em><strong>Department Access</strong>: Check all departments the group members are allowed to access.&nbsp;&nbsp;&nbsp;<a id="selectAll" href="#deptckb">Select All</a>&nbsp;&nbsp;<a id="selectNone" href="#deptckb">Select None</a>&nbsp;&nbsp;</em>
             </th>
         </tr>
         <?php
@@ -142,7 +142,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
          if(($res=db_query($sql)) && db_num_rows($res)){
             while(list($id,$name) = db_fetch_row($res)){
                 $ck=($info['depts'] && in_array($id,$info['depts']))?'checked="checked"':'';
-                echo sprintf('<tr><td colspan=2>&nbsp;&nbsp;<input type="checkbox" name="depts[]" value="%d" %s>%s</td></tr>',$id,$ck,$name);
+                echo sprintf('<tr><td colspan=2>&nbsp;&nbsp;<input type="checkbox" class="deptckb" name="depts[]" value="%d" %s>%s</td></tr>',$id,$ck,$name);
             }
          }
         ?>
diff --git a/include/staff/groups.inc.php b/include/staff/groups.inc.php
index 2e994710b806bee813dc7daa4d8f89d911efbb3d..64ea1a5b92ef8fff29238587182675a15c83b191 100644
--- a/include/staff/groups.inc.php
+++ b/include/staff/groups.inc.php
@@ -45,9 +45,10 @@ else
 <div style="float:right;text-align:right;padding-top:5px;padding-right:5px;">
     <b><a href="groups.php?a=add" class="Icon newgroup">Add New Group</a></b></div>
 <div class="clear"></div>
-<form action="groups.php" method="POST" name="groups" onSubmit="return checkbox_checker(this,1,0);">
+<form action="groups.php" method="POST" name="groups">
  <?php csrf_token(); ?>
  <input type="hidden" name="do" value="mass_process" >
+ <input type="hidden" id="action" name="a" value="" >
  <table class="list" border="0" cellspacing="1" cellpadding="0" width="940">
     <caption><?php echo $showing; ?></caption>
     <thead>
@@ -68,15 +69,13 @@ else
         if($res && db_num_rows($res)) {
             while ($row = db_fetch_array($res)) {
                 $sel=false;
-                if($ids && in_array($row['group_id'],$ids)){
-                    $class="$class highlight";
+                if($ids && in_array($row['group_id'],$ids))
                     $sel=true;
-                }
                 ?>
             <tr id="<?php echo $row['group_id']; ?>">
                 <td width=7px>
-                  <input type="checkbox" name="ids[]" value="<?php echo $row['group_id']; ?>" 
-                            <?php echo $sel?'checked="checked"':''; ?> onClick="highLight(this.value,this.checked);"> </td>
+                  <input type="checkbox" class="ckb" name="ids[]" value="<?php echo $row['group_id']; ?>" 
+                            <?php echo $sel?'checked="checked"':''; ?>> </td>
                 <td><a href="groups.php?id=<?php echo $row['group_id']; ?>"><?php echo $row['group_name']; ?></a> &nbsp;</td>
                 <td>&nbsp;<?php echo $row['group_enabled']?'Active':'<b>Disabled</b>'; ?></td>
                 <td style="text-align:right;padding-right:30px">&nbsp;&nbsp;
@@ -100,9 +99,9 @@ else
         <td colspan="7">
             <?php if($res && $num){ ?>
             Select:&nbsp;
-            <a href="#" onclick="return select_all(document.forms['groups'],true)">All</a>&nbsp;&nbsp;
-            <a href="#" onclick="return reset_all(document.forms['groups'])">None</a>&nbsp;&nbsp;
-            <a href="#" onclick="return toogle_all(document.forms['groups'],true)">Toggle</a>&nbsp;&nbsp;
+            <a id="selectAll" href="#ckb">All</a>&nbsp;&nbsp;
+            <a id="selectNone" href="#ckb">None</a>&nbsp;&nbsp;
+            <a id="selectToggle" href="#ckb">Toggle</a>&nbsp;&nbsp;
             <?php }else{
                 echo 'No groups found!';
             } ?>
@@ -113,17 +112,40 @@ else
 <?php
 if($res && $num): //Show options..
 ?>
-<p class="centered">
-    <input class="button" type="submit" name="enable" value="Enable"
-                onClick=' return confirm("Are you sure you want to ENABLE selected groups?");'>
-    <input class="button" type="submit" name="disable" value="Disable"
-                onClick=' return confirm("Are you sure you want to DISABLE selected groups?");'>
-    <input class="button" type="submit" name="delete" value="Delete"
-                onClick=' return confirm("Are you sure you want to DELETE selected groups?");'>
+<p class="centered" id="actions">
+    <input class="button" type="submit" name="enable" value="Enable" >
+    <input class="button" type="submit" name="disable" value="Disable" >
+    <input class="button" type="submit" name="delete" value="Delete">
 </p>
 <?php
 endif;
 ?>
-
 </form>
 
+<div style="display:none;" class="dialog" id="confirm-action">
+    <h3>Please Confirm</h3>
+    <a class="close" href="">&times;</a>
+    <hr/>
+    <p class="confirm-action" style="display:none;" id="enable-confirm">
+        Are you sure want to <b>enable</b> selected groups?
+    </p>
+    <p class="confirm-action" style="display:none;" id="disable-confirm">
+        Are you sure want to <b>disable</b> selected groups?
+    </p>
+    <p class="confirm-action" style="display:none;" id="delete-confirm">
+        <font color="red"><strong>Are you sure you want to DELETE selected groups?</strong></font>
+        <br><br>Deleted groups CANNOT be recovered and might affect staff's access.
+    </p>
+    <div>Please confirm to continue.</div>
+    <hr style="margin-top:1em"/>
+    <p class="full-width">
+        <span class="buttons" style="float:left">
+            <input type="button" value="No, Cancel" class="close">
+        </span>
+        <span class="buttons" style="float:right">
+            <input type="button" value="Yes, Do it!" class="confirm">
+        </span>
+     </p>
+    <div class="clear"></div>
+</div>
+
diff --git a/include/staff/helptopics.inc.php b/include/staff/helptopics.inc.php
index da26fbc850f642004426c075e1986efe625c2e0f..1e15a023c5c964311042d0286b1d34d477944f30 100644
--- a/include/staff/helptopics.inc.php
+++ b/include/staff/helptopics.inc.php
@@ -53,9 +53,10 @@ else
 <div style="float:right;text-align:right;padding-top:5px;padding-right:5px;">
     <b><a href="helptopics.php?a=add" class="Icon newHelpTopic">Add New Help Topic</a></b></div>
 <div class="clear"></div>
-<form action="helptopics.php" method="POST" name="topics" onSubmit="return checkbox_checker(this,1,0);">
+<form action="helptopics.php" method="POST" name="topics">
  <?php csrf_token(); ?>
  <input type="hidden" name="do" value="mass_process" >
+<input type="hidden" id="action" name="a" value="" >
  <table class="list" border="0" cellspacing="1" cellpadding="0" width="940">
     <caption><?php echo $showing; ?></caption>
     <thead>
@@ -74,19 +75,16 @@ else
         $total=0;
         $ids=($errors && is_array($_POST['ids']))?$_POST['ids']:null;
         if($res && db_num_rows($res)):
-            $defaultId=$cfg->getDefaultDeptId();
             while ($row = db_fetch_array($res)) {
                 $sel=false;
-                if($ids && in_array($row['topic_id'],$ids)){
-                    $class="$class highlight";
+                if($ids && in_array($row['topic_id'],$ids))
                     $sel=true;
-                }
                 ?>
             <tr id="<?php echo $row['topic_id']; ?>">
                 <td width=7px>
-                  <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>
+                  <input type="checkbox" class="ckb" name="ids[]" value="<?php echo $row['topic_id']; ?>" 
+                            <?php echo $sel?'checked="checked"':''; ?>>
+                </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>
@@ -102,9 +100,9 @@ else
         <td colspan="7">
             <?php if($res && $num){ ?>
             Select:&nbsp;
-            <a href="#" onclick="return select_all(document.forms['topics'],true)">All</a>&nbsp;&nbsp;
-            <a href="#" onclick="return reset_all(document.forms['topics'])">None</a>&nbsp;&nbsp;
-            <a href="#" onclick="return toogle_all(document.forms['topics'],true)">Toggle</a>&nbsp;&nbsp;
+            <a id="selectAll" href="#ckb">All</a>&nbsp;&nbsp;
+            <a id="selectNone" href="#ckb">None</a>&nbsp;&nbsp;
+            <a id="selectToggle" href="#ckb">Toggle</a>&nbsp;&nbsp;
             <?php }else{
                 echo 'No help topics found';
             } ?>
@@ -116,17 +114,40 @@ else
 if($res && $num): //Show options..
     echo '<div>&nbsp;Page:'.$pageNav->getPageLinks().'&nbsp;</div>';
 ?>
-<p class="centered">
-    <input class="button" type="submit" name="enable" value="Enable"
-                onClick=' return confirm("Are you sure you want to ENABLE selected help topics?");'>
-    <input class="button" type="submit" name="disable" value="Disable"
-                onClick=' return confirm("Are you sure you want to DISABLE selected help topics?");'>
-    <input class="button" type="submit" name="delete" value="Delete"
-                onClick=' return confirm("Are you sure you want to DELETE selected help topics?");'>
+<p class="centered" id="actions">
+    <input class="button" type="submit" name="enable" value="Enable" >
+    <input class="button" type="submit" name="disable" value="Disable">
+    <input class="button" type="submit" name="delete" value="Delete">
 </p>
 <?php
 endif;
 ?>
-
 </form>
 
+<div style="display:none;" class="dialog" id="confirm-action">
+    <h3>Please Confirm</h3>
+    <a class="close" href="">&times;</a>
+    <hr/>
+    <p class="confirm-action" style="display:none;" id="enable-confirm">
+        Are you sure want to <b>enable</b> selected help topics?
+    </p>
+    <p class="confirm-action" style="display:none;" id="disable-confirm">
+        Are you sure want to <b>disable</b>  selected help topics?
+    </p>
+    <p class="confirm-action" style="display:none;" id="delete-confirm">
+        <font color="red"><strong>Are you sure you want to DELETE selected help topics?</strong></font>
+        <br><br>Deleted topics CANNOT be recovered.
+    </p>
+    <div>Please confirm to continue.</div>
+    <hr style="margin-top:1em"/>
+    <p class="full-width">
+        <span class="buttons" style="float:left">
+            <input type="button" value="No, Cancel" class="close">
+        </span>
+        <span class="buttons" style="float:right">
+            <input type="button" value="Yes, Do it!" class="confirm">
+        </span>
+     </p>
+    <div class="clear"></div>
+</div>
+
diff --git a/include/staff/slaplans.inc.php b/include/staff/slaplans.inc.php
index c30d4459a24e824aa3724e844bdf0deaca14d532..a731b7492faa874a43e6aac9c6243faafdeed410 100644
--- a/include/staff/slaplans.inc.php
+++ b/include/staff/slaplans.inc.php
@@ -45,9 +45,10 @@ else
 <div style="float:right;text-align:right;padding-top:5px;padding-right:5px;">
  <b><a href="slas.php?a=add" class="Icon newsla">Add New SLA Plan</a></b></div>
 <div class="clear"></div>
-<form action="slas.php" method="POST" name="slas" onSubmit="return checkbox_checker(this,1,0);">
+<form action="slas.php" method="POST" name="slas">
  <?php csrf_token(); ?>
  <input type="hidden" name="do" value="mass_process" >
+<input type="hidden" id="action" name="a" value="" >
  <table class="list" border="0" cellspacing="1" cellpadding="0" width="940">
     <caption><?php echo $showing; ?></caption>
     <thead>
@@ -67,15 +68,14 @@ else
         if($res && db_num_rows($res)):
             while ($row = db_fetch_array($res)) {
                 $sel=false;
-                if($ids && in_array($row['id'],$ids)){
-                    $class="$class highlight";
+                if($ids && in_array($row['id'],$ids))
                     $sel=true;
-                }
                 ?>
             <tr id="<?php echo $row['id']; ?>">
                 <td width=7px>
-                  <input type="checkbox" name="ids[]" value="<?php echo $row['id']; ?>" 
-                            <?php echo $sel?'checked="checked"':''; ?> onClick="highLight(this.value,this.checked);"> </td>
+                  <input type="checkbox" class="ckb" name="ids[]" value="<?php echo $row['id']; ?>" 
+                            <?php echo $sel?'checked="checked"':''; ?>>
+                </td>
                 <td>&nbsp;<a href="slas.php?id=<?php echo $row['id']; ?>"><?php echo Format::htmlchars($row['name']); ?></a></td>
                 <td><?php echo $row['isactive']?'Active':'<b>Disabled</b>'; ?></td>
                 <td style="text-align:right;padding-right:35px;"><?php echo $row['grace_period']; ?>&nbsp;</td>
@@ -90,9 +90,9 @@ else
         <td colspan="6">
             <?php if($res && $num){ ?>
             Select:&nbsp;
-            <a href="#" onclick="return select_all(document.forms['slas'],true)">All</a>&nbsp;&nbsp;
-            <a href="#" onclick="return reset_all(document.forms['slas'])">None</a>&nbsp;&nbsp;
-            <a href="#" onclick="return toogle_all(document.forms['slas'],true)">Toggle</a>&nbsp;&nbsp;
+            <a id="selectAll" href="#ckb">All</a>&nbsp;&nbsp;
+            <a id="selectNone" href="#ckb">None</a>&nbsp;&nbsp;
+            <a id="selectToggle" href="#ckb">Toggle</a>&nbsp;&nbsp;
             <?php }else{
                 echo 'No SLA plans found';
             } ?>
@@ -104,16 +104,38 @@ else
 if($res && $num): //Show options..
     echo '<div>&nbsp;Page:'.$pageNav->getPageLinks().'&nbsp;</div>';
 ?>
-<p class="centered">
-    <input class="button" type="submit" name="enable" value="Enable"
-                onClick=' return confirm("Are you sure you want to ENABLE selected plans?");'>
-    <input class="button" type="submit" name="disable" value="Disable"
-                onClick=' return confirm("Are you sure you want to DISABLE selected plans?");'>
-    <input class="button" type="submit" name="delete" value="Delete"
-                onClick=' return confirm("Are you sure you want to DELETE selected plans?");'>
+<p class="centered" id="actions">
+    <input class="button" type="submit" name="enable" value="Enable" >
+    <input class="button" type="submit" name="disable" value="Disable" >
+    <input class="button" type="submit" name="delete" value="Delete" >
 </p>
 <?php
 endif;
 ?>
 </form>
 
+<div style="display:none;" class="dialog" id="confirm-action">
+    <h3>Please Confirm</h3>
+    <a class="close" href="">&times;</a>
+    <hr/>
+    <p class="confirm-action" style="display:none;" id="enable-confirm">
+        Are you sure want to <b>enable</b> selected SLA plans?
+    </p>
+    <p class="confirm-action" style="display:none;" id="disable-confirm">
+        Are you sure want to <b>disable</b> selected SLA plans?
+    </p>
+    <p class="confirm-action" style="display:none;" id="delete-confirm">
+        <font color="red"><strong>Are you sure you want to DELETE selected SLA plans?</strong></font>
+    </p>
+    <div>Please confirm to continue.</div>
+    <hr style="margin-top:1em"/>
+    <p class="full-width">
+        <span class="buttons" style="float:left">
+            <input type="button" value="No, Cancel" class="close">
+        </span>
+        <span class="buttons" style="float:right">
+            <input type="button" value="Yes, Do it!" class="confirm">
+        </span>
+     </p>
+    <div class="clear"></div>
+</div>
diff --git a/include/staff/staffmembers.inc.php b/include/staff/staffmembers.inc.php
index d923815a0c876b8e5a4ff76d9b4ed96a12e90286..08877d02a7ab51b35f974b83183e04fd32566406 100644
--- a/include/staff/staffmembers.inc.php
+++ b/include/staff/staffmembers.inc.php
@@ -115,9 +115,10 @@ if($res && ($num=db_num_rows($res)))
 else
     $showing='No staff found!';
 ?>
-<form action="staff.php" method="POST" name="staff" onSubmit="return checkbox_checker(this,1,0);">
+<form action="staff.php" method="POST" name="staff" >
  <?php csrf_token(); ?>
  <input type="hidden" name="do" value="mass_process" >
+ <input type="hidden" id="action" name="a" value="" >
  <table class="list" border="0" cellspacing="1" cellpadding="0" width="940">
     <caption><?php echo $showing; ?></caption>
     <thead>
@@ -138,15 +139,12 @@ else
             $ids=($errors && is_array($_POST['ids']))?$_POST['ids']:null;
             while ($row = db_fetch_array($res)) {
                 $sel=false;
-                if($ids && in_array($row['staff_id'],$ids)){
-                    $class="$class highlight";
+                if($ids && in_array($row['staff_id'],$ids))
                     $sel=true;
-                }
                 ?>
-               <tr id="<?php echo $row['dept_id']; ?>">
+               <tr id="<?php echo $row['staff_id']; ?>">
                 <td width=7px>
-                  <input type="checkbox" name="ids[]" value="<?php echo $row['staff_id']; ?>" <?php echo $sel?'checked="checked"':''; ?>  
-                        onClick="highLight(this.value,this.checked);">
+                  <input type="checkbox" class="ckb" name="ids[]" value="<?php echo $row['staff_id']; ?>" <?php echo $sel?'checked="checked"':''; ?> >
                 <td><a href="staff.php?id=<?php echo $row['staff_id']; ?>"><?php echo Format::htmlchars($row['name']); ?></a>&nbsp;</td>
                 <td><?php echo $row['username']; ?></td>
                 <td><?php echo $row['isactive']?'Active':'<b>Locked</b>'; ?>&nbsp;<?php echo $row['onvacation']?'<small>(<i>vacation</i>)</small>':''; ?></td>
@@ -163,9 +161,9 @@ else
         <td colspan="8">
             <?php if($res && $num){ ?>
             Select:&nbsp;
-            <a href="#" onclick="return select_all(document.forms['staff'],true)">All</a>&nbsp;&nbsp;
-            <a href="#" onclick="return reset_all(document.forms['staff'])">None</a>&nbsp;&nbsp;
-            <a href="#" onclick="return toogle_all(document.forms['staff'],true)">Toggle</a>&nbsp;&nbsp;
+            <a id="selectAll" href="#ckb">All</a>&nbsp;&nbsp;
+            <a id="selectNone" href="#ckb">None</a>&nbsp;&nbsp;
+            <a id="selectToggle" href="#ckb">Toggle</a>&nbsp;&nbsp;
             <?php }else{
                 echo 'No staff members found!';
             } ?>
@@ -177,18 +175,43 @@ else
 if($res && $num): //Show options..
     echo '<div>&nbsp;Page:'.$pageNav->getPageLinks().'&nbsp;</div>';
 ?>
-<p class="centered">
-    <input class="button" type="submit" name="enable" value="Enable"
-        onClick=' return confirm("Are you sure you want to ENABLE selected users?");'>
+<p class="centered" id="actions">
+    <input class="button" type="submit" name="enable" value="Enable" >
     &nbsp;&nbsp;
-    <input class="button" type="submit" name="disable" value="Lock"
-        onClick=' return confirm("Are you sure you want to LOCK selected users?");'>
+    <input class="button" type="submit" name="disable" value="Lock" >
     &nbsp;&nbsp;
-    <input class="button" type="submit" name="delete" value="Delete"
-        onClick=' return confirm("Are you sure you want to DELETE selected users?");'>
+    <input class="button" type="submit" name="delete" value="Delete">
 </p>
 <?php
 endif;
 ?>
 </form>
 
+<div style="display:none;" class="dialog" id="confirm-action">
+    <h3>Please Confirm</h3>
+    <a class="close" href="">&times;</a>
+    <hr/>
+    <p class="confirm-action" style="display:none;" id="enable-confirm">
+        Are you sure want to <b>enable</b> (unlock) selected staff?
+    </p>
+    <p class="confirm-action" style="display:none;" id="disable-confirm">
+        Are you sure want to <b>disable</b> (lock) selected staff?
+        <br><br>Locked staff won't be able to login to Staff Control Panel.
+    </p>
+    <p class="confirm-action" style="display:none;" id="delete-confirm">
+        <font color="red"><strong>Are you sure you want to DELETE selected staff?</strong></font>
+        <br><br>Deleted staff CANNOT be recovered.
+    </p>
+    <div>Please confirm to continue.</div>
+    <hr style="margin-top:1em"/>
+    <p class="full-width">
+        <span class="buttons" style="float:left">
+            <input type="button" value="No, Cancel" class="close">
+        </span>
+        <span class="buttons" style="float:right">
+            <input type="button" value="Yes, Do it!" class="confirm">
+        </span>
+     </p>
+    <div class="clear"></div>
+</div>
+
diff --git a/include/staff/syslogs.inc.php b/include/staff/syslogs.inc.php
index ead5cf544932569261cecf166bfa0f152d309a76..de80a1dc35c309f9fa2f083b86ad331fcdcee362 100644
--- a/include/staff/syslogs.inc.php
+++ b/include/staff/syslogs.inc.php
@@ -104,9 +104,10 @@ else
     </div>
  </form>
 </div>
-<form action="logs.php" method="POST" name="logs" onSubmit="return checkbox_checker(this,1,0);">
+<form action="logs.php" method="POST" name="logs">
 <?php csrf_token(); ?>
  <input type="hidden" name="do" value="mass_process" >
+ <input type="hidden" id="action" name="a" value="" >
  <table class="list" border="0" cellspacing="1" cellpadding="0" width="940">
     <caption><?php echo $showing; ?></caption>
     <thead>
@@ -125,15 +126,13 @@ else
         if($res && db_num_rows($res)):
             while ($row = db_fetch_array($res)) {
                 $sel=false;
-                if($ids && in_array($row['log_id'],$ids)){
-                    $class="$class highlight";
+                if($ids && in_array($row['log_id'],$ids))
                     $sel=true;
-                }
                 ?>
             <tr id="<?php echo $row['log_id']; ?>">
                 <td width=7px>
-                  <input type="checkbox" name="ids[]" value="<?php echo $row['log_id']; ?>" 
-                            <?php echo $sel?'checked="checked"':''; ?> onClick="highLight(this.value,this.checked);"> </td>
+                  <input type="checkbox" class="ckb" name="ids[]" value="<?php echo $row['log_id']; ?>" 
+                            <?php echo $sel?'checked="checked"':''; ?>> </td>
                 <td>&nbsp;<a class="tip" href="log/<?php echo $row['log_id']; ?>"><?php echo Format::htmlchars($row['title']); ?></a></td>
                 <td><?php echo $row['log_type']; ?></td>
                 <td>&nbsp;<?php echo Format::db_daydatetime($row['created']); ?></td>
@@ -148,9 +147,9 @@ else
         <td colspan="6">
             <?php if($res && $num){ ?>
             Select:&nbsp;
-            <a href="#" onclick="return select_all(document.forms['logs'],true)">All</a>&nbsp;&nbsp;
-            <a href="#" onclick="return reset_all(document.forms['logs'])">None</a>&nbsp;&nbsp;
-            <a href="#" onclick="return toogle_all(document.forms['logs'],true)">Toggle</a>&nbsp;&nbsp;
+            <a id="selectAll" href="#ckb">All</a>&nbsp;&nbsp;
+            <a id="selectNone" href="#ckb">None</a>&nbsp;&nbsp;
+            <a id="selectToggle" href="#ckb">Toggle</a>&nbsp;&nbsp;
             <?php }else{
                 echo 'No logs found';
             } ?>
@@ -162,11 +161,31 @@ else
 if($res && $num): //Show options..
     echo '<div>&nbsp;Page:'.$pageNav->getPageLinks().'&nbsp;</div>';
 ?>
-<p class="centered">
-    <input class="button" type="submit" name="delete" value="Delete Selected Entries"
-                onClick=' return confirm("Are you sure you want to DELETE selected log entries?");'>
+<p class="centered" id="actions">
+    <input class="button" type="submit" name="delete" value="Delete Selected Entries">
 </p>
 <?php
 endif;
 ?>
 </form>
+
+<div style="display:none;" class="dialog" id="confirm-action">
+    <h3>Please Confirm</h3>
+    <a class="close" href="">&times;</a>
+    <hr/>
+    <p class="confirm-action" style="display:none;" id="delete-confirm">
+        <font color="red"><strong>Are you sure you want to DELETE selected logs?</strong></font>
+        <br><br>Deleted logs CANNOT be recovered.
+    </p>
+    <div>Please confirm to continue.</div>
+    <hr style="margin-top:1em"/>
+    <p class="full-width">
+        <span class="buttons" style="float:left">
+            <input type="button" value="No, Cancel" class="close">
+        </span>
+        <span class="buttons" style="float:right">
+            <input type="button" value="Yes, Do it!" class="confirm">
+        </span>
+     </p>
+    <div class="clear"></div>
+</div>
diff --git a/include/staff/teams.inc.php b/include/staff/teams.inc.php
index d9dcee5bbc0031e2707394932294f9e5b88e612b..f63cdb40e6c864657b630b88b4ce059c17ab817e 100644
--- a/include/staff/teams.inc.php
+++ b/include/staff/teams.inc.php
@@ -44,9 +44,10 @@ else
 <div style="float:right;text-align:right;padding-top:5px;padding-right:5px;">
     <b><a href="teams.php?a=add" class="Icon newteam">Add New Team</a></b></div>
 <div class="clear"></div>
-<form action="teams.php" method="POST" name="teams" onSubmit="return checkbox_checker(this,1,0);">
+<form action="teams.php" method="POST" name="teams">
  <?php csrf_token(); ?>
  <input type="hidden" name="do" value="mass_process" >
+ <input type="hidden" id="action" name="a" value="" >
  <table class="list" border="0" cellspacing="1" cellpadding="0" width="940">
     <caption><?php echo $showing; ?></caption>
     <thead>
@@ -67,15 +68,13 @@ else
         if($res && db_num_rows($res)):
             while ($row = db_fetch_array($res)) {
                 $sel=false;
-                if($ids && in_array($row['team_id'],$ids)){
-                    $class="$class highlight";
+                if($ids && in_array($row['team_id'],$ids))
                     $sel=true;
-                }
                 ?>
             <tr id="<?php echo $row['team_id']; ?>">
                 <td width=7px>
-                  <input type="checkbox" name="ids[]" value="<?php echo $row['team_id']; ?>" 
-                            <?php echo $sel?'checked="checked"':''; ?> onClick="highLight(this.value,this.checked);"> </td>
+                  <input type="checkbox" class="ckb" name="ids[]" value="<?php echo $row['team_id']; ?>" 
+                            <?php echo $sel?'checked="checked"':''; ?>> </td>
                 <td><a href="teams.php?id=<?php echo $row['team_id']; ?>"><?php echo $row['name']; ?></a> &nbsp;</td>
                 <td>&nbsp;<?php echo $row['isenabled']?'Active':'<b>Disabled</b>'; ?></td>
                 <td style="text-align:right;padding-right:25px">&nbsp;&nbsp;
@@ -97,9 +96,9 @@ else
         <td colspan="7">
             <?php if($res && $num){ ?>
             Select:&nbsp;
-            <a href="#" onclick="return select_all(document.forms['teams'],true)">All</a>&nbsp;&nbsp;
-            <a href="#" onclick="return reset_all(document.forms['teams'])">None</a>&nbsp;&nbsp;
-            <a href="#" onclick="return toogle_all(document.forms['teams'],true)">Toggle</a>&nbsp;&nbsp;
+            <a id="selectAll" href="#ckb">All</a>&nbsp;&nbsp;
+            <a id="selectNone" href="#ckb">None</a>&nbsp;&nbsp;
+            <a id="selectToggle" href="#ckb">Toggle</a>&nbsp;&nbsp;
             <?php }else{
                 echo 'No teams found!';
             } ?>
@@ -110,17 +109,38 @@ else
 <?php
 if($res && $num): //Show options..
 ?>
-<p class="centered">
-    <input class="button" type="submit" name="enable" value="Enable"
-                onClick=' return confirm("Are you sure you want to ENABLE selected teams?");'>
-    <input class="button" type="submit" name="disable" value="Disable"
-                onClick=' return confirm("Are you sure you want to DISABLE selected teams?");'>
-    <input class="button" type="submit" name="delete" value="Delete"
-                onClick=' return confirm("Are you sure you want to DELETE selected teams?");'>
+<p class="centered" id="actions">
+    <input class="button" type="submit" name="enable" value="Enable" >
+    <input class="button" type="submit" name="disable" value="Disable" >
+    <input class="button" type="submit" name="delete" value="Delete" >
 </p>
 <?php
 endif;
 ?>
-
 </form>
-
+<div style="display:none;" class="dialog" id="confirm-action">
+    <h3>Please Confirm</h3>
+    <a class="close" href="">&times;</a>
+    <hr/>
+    <p class="confirm-action" style="display:none;" id="enable-confirm">
+        Are you sure want to <b>enable</b> selected teams?
+    </p>
+    <p class="confirm-action" style="display:none;" id="disable-confirm">
+        Are you sure want to <b>disable</b> selected teams?
+    </p>
+    <p class="confirm-action" style="display:none;" id="delete-confirm">
+        <font color="red"><strong>Are you sure you want to DELETE selected teams?</strong></font>
+        <br><br>Deleted team CANNOT be recovered.
+    </p>
+    <div>Please confirm to continue.</div>
+    <hr style="margin-top:1em"/>
+    <p class="full-width">
+        <span class="buttons" style="float:left">
+            <input type="button" value="No, Cancel" class="close">
+        </span>
+        <span class="buttons" style="float:right">
+            <input type="button" value="Yes, Do it!" class="confirm">
+        </span>
+     </p>
+    <div class="clear"></div>
+</div>
diff --git a/include/staff/templates.inc.php b/include/staff/templates.inc.php
index dfdfb91c858d820b965867874282d76eeddab30c..a0f5de468a76bf7cde53e73bdc0767606ea6207b 100644
--- a/include/staff/templates.inc.php
+++ b/include/staff/templates.inc.php
@@ -48,9 +48,10 @@ else
 <div style="float:right;text-align:right;padding-top:5px;padding-right:5px;">
  <b><a href="templates.php?a=add" class="Icon newEmailTemplate">Add New Template</a></b></div>
 <div class="clear"></div>
-<form action="templates.php" method="POST" name="tpls" onSubmit="return checkbox_checker(this,1,0);">
+<form action="templates.php" method="POST" name="tpls">
  <?php csrf_token(); ?>
  <input type="hidden" name="do" value="mass_process" >
+<input type="hidden" id="action" name="a" value="" >
  <table class="list" border="0" cellspacing="1" cellpadding="0" width="940">
     <caption><?php echo $showing; ?></caption>
     <thead>
@@ -72,16 +73,16 @@ else
             while ($row = db_fetch_array($res)) {
                 $inuse=($row['depts'] || $row['tpl_id']==$defaultTplId);
                 $sel=false;
-                if($ids && in_array($row['tpl_id'],$ids)){
-                    $class="$class highlight";
+                if($ids && in_array($row['tpl_id'],$ids))
                     $sel=true;
-                }
+                
                 $default=($defaultTplId==$row['tpl_id'])?'<small class="fadded">(System Default)</small>':'';
                 ?>
             <tr id="<?php echo $row['tpl_id']; ?>">
                 <td width=7px>
-                  <input type="checkbox" name="ids[]" value="<?php echo $row['tpl_id']; ?>" 
-                            <?php echo $sel?'checked="checked"':''; ?> onClick="highLight(this.value,this.checked);"> </td>
+                  <input type="checkbox" class="ckb" name="ids[]" value="<?php echo $row['tpl_id']; ?>" 
+                            <?php echo $sel?'checked="checked"':''; ?> <?php echo $default?'disabled="disabled"':''; ?> >
+                </td>
                 <td>&nbsp;<a href="templates.php?id=<?php echo $row['tpl_id']; ?>"><?php echo Format::htmlchars($row['name']); ?></a>
                 &nbsp;<?php echo $default; ?></td>
                 <td>&nbsp;<?php echo $row['isactive']?'Active':'<b>Disabled</b>'; ?></td>
@@ -97,9 +98,9 @@ else
         <td colspan="6">
             <?php if($res && $num){ ?>
             Select:&nbsp;
-            <a href="#" onclick="return select_all(document.forms['tpls'],true)">All</a>&nbsp;&nbsp;
-            <a href="#" onclick="return reset_all(document.forms['tpls'])">None</a>&nbsp;&nbsp;
-            <a href="#" onclick="return toogle_all(document.forms['tpls'],true)">Toggle</a>&nbsp;&nbsp;
+            <a id="selectAll" href="#ckb">All</a>&nbsp;&nbsp;
+            <a id="selectNone" href="#ckb">None</a>&nbsp;&nbsp;
+            <a id="selectToggle" href="#ckb">Toggle</a>&nbsp;&nbsp;
             <?php }else{
                 echo 'No templates found';
             } ?>
@@ -111,16 +112,39 @@ else
 if($res && $num): //Show options..
     echo '<div>&nbsp;Page:'.$pageNav->getPageLinks().'&nbsp;</div>';
 ?>
-<p class="centered">
-    <input class="button" type="submit" name="enable" value="Enable"
-                onClick=' return confirm("Are you sure you want to ENABLE selected templates?");'>
-    <input class="button" type="submit" name="disable" value="Disable"
-                onClick=' return confirm("Are you sure you want to DISABLE selected templates?");'>
-    <input class="button" type="submit" name="delete" value="Delete"
-                onClick=' return confirm("Are you sure you want to DELETE selected templates?");'>
+<p class="centered" id="actions">
+    <input class="button" type="submit" name="enable" value="Enable" >
+    <input class="button" type="submit" name="disable" value="Disable" >
+    <input class="button" type="submit" name="delete" value="Delete" >
 </p>
 <?php
 endif;
 ?>
 </form>
 
+<div style="display:none;" class="dialog" id="confirm-action">
+    <h3>Please Confirm</h3>
+    <a class="close" href="">&times;</a>
+    <hr/>
+    <p class="confirm-action" style="display:none;" id="enable-confirm">
+        Are you sure want to <b>enable</b> selected templates?
+    </p>
+    <p class="confirm-action" style="display:none;" id="disable-confirm">
+        Are you sure want to <b>disable</b>  selected templates?
+    </p>
+    <p class="confirm-action" style="display:none;" id="delete-confirm">
+        <font color="red"><strong>Are you sure you want to DELETE selected templates?</strong></font>
+        <br><br>Deleted templates CANNOT be recovered.
+    </p>
+    <div>Please confirm to continue.</div>
+    <hr style="margin-top:1em"/>
+    <p class="full-width">
+        <span class="buttons" style="float:left">
+            <input type="button" value="No, Cancel" class="close">
+        </span>
+        <span class="buttons" style="float:right">
+            <input type="button" value="Yes, Do it!" class="confirm">
+        </span>
+     </p>
+    <div class="clear"></div>
+</div>
diff --git a/include/staff/tickets.inc.php b/include/staff/tickets.inc.php
index b5b1a4b795c4f8f506c264547c8859ef0276daf1..534a358bfcc01bbb771340f78db2b5fcd7924cbd 100644
--- a/include/staff/tickets.inc.php
+++ b/include/staff/tickets.inc.php
@@ -297,10 +297,11 @@ $negorder=$order=='DESC'?'ASC':'DESC'; //Negate the sorting..
 <!-- SEARCH FORM END -->
 <div class="clear"></div>
 <div style="margin-bottom:20px">
-<form action="tickets.php" method="POST" name='tickets' onSubmit="return checkbox_checker(this,1,0);">
+<form action="tickets.php" method="POST" name='tickets'>
 <?php csrf_token(); ?>
  <a class="refresh" href="<?php echo $_SERVER['REQUEST_URI']; ?>">Refresh</a>
  <input type="hidden" name="a" value="mass_process" >
+ <input type="hidden" name="do" id="action" value="" >
  <input type="hidden" name="status" value="<?php echo $status; ?>" >
  <table class="list" border="0" cellspacing="1" cellpadding="2" width="940">
     <caption><?php echo $showing; ?>&nbsp;&nbsp;&nbsp;<?php echo $results_type; ?></caption>
@@ -357,6 +358,7 @@ $negorder=$order=='DESC'?'ASC':'DESC'; //Negate the sorting..
         $class = "row1";
         $total=0;
         if($res && ($num=db_num_rows($res))):
+            $ids=($errors && $_POST['tids'] && is_array($_POST['tids']))?$_POST['tids']:null;
             while ($row = db_fetch_array($res)) {
                 $tag=$row['staff_id']?'assigned':'openticket';
                 $flag=null;
@@ -384,9 +386,14 @@ $negorder=$order=='DESC'?'ASC':'DESC'; //Negate the sorting..
                 }
                 ?>
             <tr id="<?php echo $row['ticket_id']; ?>">
-                <?php if($thisstaff->canManageTickets()) { ?>
+                <?php if($thisstaff->canManageTickets()) { 
+                              
+                    $sel=false;
+                    if($ids && in_array($row['ticket_id'], $ids))
+                        $sel=true;
+                    ?>
                 <td align="center" class="nohover">
-                    <input type="checkbox" name="tids[]" value="<?php echo $row['ticket_id']; ?>" onClick="highLight(this.value,this.checked);">
+                    <input class="ckb" type="checkbox" name="tids[]" value="<?php echo $row['ticket_id']; ?>" <?php echo $sel?'checked="checked"':''; ?>>
                 </td>
                 <?php } ?>
                 <td align="center" title="<?php echo $row['email']; ?>" nowrap>
@@ -423,11 +430,11 @@ $negorder=$order=='DESC'?'ASC':'DESC'; //Negate the sorting..
     <tfoot>
      <tr>
         <td colspan="7">
-            <?php if($res && $num){ ?>
+            <?php if($res && $num && $thisstaff->canManageTickets()){ ?>
             Select:&nbsp;
-            <a href="#" onclick="return select_all(document.forms['tickets'],true)">All</a>&nbsp;&nbsp;
-            <a href="#" onclick="return reset_all(document.forms['tickets'])">None</a>&nbsp;&nbsp;
-            <a href="#" onclick="return toogle_all(document.forms['tickets'],true)">Toggle</a>&nbsp;&nbsp;
+            <a id="selectAll" href="#ckb">All</a>&nbsp;&nbsp;
+            <a id="selectNone" href="#ckb">None</a>&nbsp;&nbsp;
+            <a id="selectToggle" href="#ckb">Toggle</a>&nbsp;&nbsp;
             <?php }else{
                 echo '<i>';
                 echo $ferror?Format::htmlchars($ferror):'Query returned 0 results.';
@@ -445,36 +452,30 @@ $negorder=$order=='DESC'?'ASC':'DESC'; //Negate the sorting..
     ?>
         <?php
          if($thisstaff->canManageTickets()) { ?>
-           <p class="centered">  
+           <p class="centered" id="actions">  
             <?php
             $status=$_REQUEST['status']?$_REQUEST['status']:$status;
             switch (strtolower($status)) {
                 case 'closed': ?>
-                    <input class="button" type="submit" name="reopen" value="Reopen"
-                        onClick=' return confirm("Are you sure you want to reopen selected tickets?");'>
+                    <input class="button" type="submit" name="reopen" value="Reopen" >
                     <?php
                     break;
                 case 'open':
                 case 'answered':
                 case 'assigned':
                     ?>
-                    <input class="button" type="submit" name="overdue" value="Overdue"
-                        onClick=' return confirm("Are you sure you want to mark selected tickets overdue/stale?");'>
-                    <input class="button" type="submit" name="close" value="Close"
-                        onClick=' return confirm("Are you sure you want to close selected tickets?");'>
+                    <input class="button" type="submit" name="mark_overdue" value="Overdue" >
+                    <input class="button" type="submit" name="close" value="Close">
                     <?php
                     break;
                 default: //search??
                     ?>
-                    <input class="button" type="submit" name="close" value="Close"
-                        onClick=' return confirm("Are you sure you want to close selected tickets?");'>
-                    <input class="button" type="submit" name="reopen" value="Reopen"
-                        onClick=' return confirm("Are you sure you want to reopen selected tickets?");'>
+                    <input class="button" type="submit" name="close" value="Close" >
+                    <input class="button" type="submit" name="reopen" value="Reopen">
             <?php
             }
             if($thisstaff->canDeleteTickets()) { ?>
-                <input class="button" type="submit" name="delete" value="Delete" 
-                    onClick=' return confirm("Are you sure you want to DELETE selected tickets?");'>
+                <input class="button" type="submit" name="delete" value="Delete">
             <?php } ?>
         </p>
         <?php
@@ -483,6 +484,36 @@ $negorder=$order=='DESC'?'ASC':'DESC'; //Negate the sorting..
     </form>
 </div>
 
+<div style="display:none;" class="dialog" id="confirm-action">
+    <h3>Please Confirm</h3>
+    <a class="close" href="">&times;</a>
+    <hr/>
+    <p class="confirm-action" style="display:none;" id="close-confirm">
+        Are you sure want to <b>close</b> selected open tickets?
+    </p>
+    <p class="confirm-action" style="display:none;" id="reopen-confirm">
+        Are you sure want to <b>reopen</b> selected closed tickets?
+    </p>
+    <p class="confirm-action" style="display:none;" id="mark_overdue-confirm">
+        Are you sure want to flag the selected tickets as <font color="red"><b>overdue</b></font>?
+    </p>
+    <p class="confirm-action" style="display:none;" id="delete-confirm">
+        <font color="red"><strong>Are you sure you want to DELETE selected tickets?</strong></font>
+        <br><br>Deleted tickets CANNOT be recovered, including any associated attachments.
+    </p>
+    <div>Please confirm to continue.</div>
+    <hr style="margin-top:1em"/>
+    <p class="full-width">
+        <span class="buttons" style="float:left">
+            <input type="button" value="No, Cancel" class="close">
+        </span>
+        <span class="buttons" style="float:right">
+            <input type="button" value="Yes, Do it!" class="confirm">
+        </span>
+     </p>
+    <div class="clear"></div>
+</div>
+
 <div class="dialog" style="display:none;" id="advanced-search">
     <h3>Advanced Ticket Search</h3>
     <a class="close" href="">&times;</a>
diff --git a/include/staff/tpl.inc.php b/include/staff/tpl.inc.php
index c973ab9ff9c1d083e6a6a13643e8d49ea14ff16b..13dcf25718874fb7eb48371ad68daba9ff078312 100644
--- a/include/staff/tpl.inc.php
+++ b/include/staff/tpl.inc.php
@@ -12,7 +12,7 @@ $info=array_merge($template->getMsgTemplate($info['tpl']),$info);
     <input type="hidden" name="id" value="<?php echo $template->getId(); ?>">
     <input type="hidden" name="a" value="manage">
     Message Template:
-    <select name="tpl" style="width:300px;">
+    <select id="tpl_options" name="tpl" style="width:300px;">
         <option value="">&mdash; Select Setting Group &mdash;</option>
         <?php
         foreach($msgtemplates as $k=>$v) {
diff --git a/scp/apikeys.php b/scp/apikeys.php
index 1e17675442066356a077041f03357fa0c3913414..89f649c1ce0e8f27c35b32a8c34565b4e929a662 100644
--- a/scp/apikeys.php
+++ b/scp/apikeys.php
@@ -41,53 +41,54 @@ if($_POST){
             break;
         case 'mass_process':
             if(!$_POST['ids'] || !is_array($_POST['ids']) || !count($_POST['ids'])) {
-                $errors['err']='You must select at least one API key';
-            }else{
+                $errors['err'] = 'You must select at least one API key';
+            } else {
                 $count=count($_POST['ids']);
-                if($_POST['enable']){
-                    $sql='UPDATE '.API_KEY_TABLE.' SET isactive=1 WHERE id IN ('.
-                        implode(',', db_input($_POST['ids'])).')';
-                    if(db_query($sql) && ($num=db_affected_rows())){
-                        if($num==$count)
-                            $msg='Selected API keys enabled';
-                        else
-                            $warn="$num of $count selected API keys enabled";
-                    }else{
-                        $errors['err']='Unable to enable selected API keys.';
-                    }
-                }elseif($_POST['disable']){
-                    $sql='UPDATE '.API_KEY_TABLE.' SET isactive=0  WHERE id IN ('.
-                        implode(',', db_input($_POST['ids'])).')';
-                    if(db_query($sql) && ($num=db_affected_rows())) {
-                        if($num==$count)
-                            $msg='Selected API keys disabled';
-                        else
-                            $warn="$num of $count selected API keys disabled";
-                    }else{
-                        $errors['err']='Unable to disable selected API keys';
-                    }
-
-                }elseif($_POST['delete']){
-                    $i=0;
-                    foreach($_POST['ids'] as $k=>$v) {
-                        if(($t=API::lookup($v)) && $t->delete())
-                            $i++;
-                    }
-
-                    if($i && $i==$count)
-                        $msg='Selected API keys deleted successfully';
-                    elseif($i>0)
-                        $warn="$i of $count selected API keys deleted";
-                    elseif(!$errors['err'])
-                        $errors['err']='Unable to delete selected API keys';
-                    
-                }else {
-                    $errors['err']='Unknown action';
+                switch(strtolower($_POST['a'])) {
+                    case 'enable':
+                        $sql='UPDATE '.API_KEY_TABLE.' SET isactive=1 '
+                            .' WHERE id IN ('.implode(',', db_input($_POST['ids'])).')';
+                        if(db_query($sql) && ($num=db_affected_rows())) {
+                            if($num==$count)
+                                $msg = 'Selected API keys enabled';
+                            else
+                                $warn = "$num of $count selected API keys enabled";
+                        } else {
+                            $errors['err'] = 'Unable to enable selected API keys.';
+                        }
+                        break;
+                    case 'disable':
+                        $sql='UPDATE '.API_KEY_TABLE.' SET isactive=0 '
+                            .' WHERE id IN ('.implode(',', db_input($_POST['ids'])).')';
+                        if(db_query($sql) && ($num=db_affected_rows())) {
+                            if($num==$count)
+                                $msg = 'Selected API keys disabled';
+                            else
+                                $warn = "$num of $count selected API keys disabled";
+                        } else {
+                            $errors['err']='Unable to disable selected API keys';
+                        }
+                        break;
+                    case 'delete':
+                        $i=0;
+                        foreach($_POST['ids'] as $k=>$v) {
+                            if(($t=API::lookup($v)) && $t->delete())
+                                $i++;
+                        }
+                        if($i && $i==$count)
+                            $msg = 'Selected API keys deleted successfully';
+                        elseif($i>0)
+                            $warn = "$i of $count selected API keys deleted";
+                        elseif(!$errors['err'])
+                            $errors['err'] = 'Unable to delete selected API keys';
+                        break;
+                    default:
+                        $errors['err']='Unknown action - get technical help';
                 }
             }
             break;
         default:
-            $errors['err']='Unknown action';
+            $errors['err']='Unknown action/command';
             break;
     }
 }
diff --git a/scp/banlist.php b/scp/banlist.php
index a31d91d7e8d2392c2d7e23dba570a07257532ec8..d47552fa4d73e3b22892d9951f8015800ad73893 100644
--- a/scp/banlist.php
+++ b/scp/banlist.php
@@ -18,13 +18,13 @@ include_once(INCLUDE_DIR.'class.banlist.php');
 
 /* Get the system ban list filter */
 if(!($filter=Banlist::getFilter())) 
-    $warn='System ban list is empty.';
+    $warn = 'System ban list is empty.';
 elseif(!$filter->isActive())
-    $warn='SYSTEM BAN LIST filter is <b>DISABLED</b> - <a href="filters.php">enable here</a>.'; 
+    $warn = 'SYSTEM BAN LIST filter is <b>DISABLED</b> - <a href="filters.php">enable here</a>.'; 
  
 $rule=null; //ban rule obj.
 if($filter && $_REQUEST['id'] && !($rule=$filter->getRule($_REQUEST['id'])))
-    $errors['err']='Unknown or invalid ban list ID #';
+    $errors['err'] = 'Unknown or invalid ban list ID #';
 
 if($_POST && !$errors && $filter){
     switch(strtolower($_POST['do'])){
@@ -64,50 +64,52 @@ if($_POST && !$errors && $filter){
             break;
         case 'mass_process':
             if(!$_POST['ids'] || !is_array($_POST['ids']) || !count($_POST['ids'])) {
-                $errors['err']='You must select at least one email to process.';
-            }else{
+                $errors['err'] = 'You must select at least one email to process.';
+            } else {
                 $count=count($_POST['ids']);
-                if($_POST['enable']){
-                    $sql='UPDATE '.FILTER_RULE_TABLE.' SET isactive=1 WHERE filter_id='.
-                            db_input($filter->getId()).
-                         ' AND id IN ('.
-                            implode(',', db_input($_POST['ids'])).')';
-                    if(db_query($sql) && ($num=db_affected_rows())){
-                        if($num==$count)
-                            $msg='Selected emails ban status set to enabled';
-                        else
-                            $warn="$num of $count selected emails enabled";
-                    }else{
-                        $errors['err']='Unable to enable selected emails';
-                    }
-                }elseif($_POST['disable']){
-                    $sql='UPDATE '.FILTER_RULE_TABLE.' SET isactive=0 WHERE filter_id='.
-                            db_input($filter->getId()).
-                         ' AND id IN ('.
-                            implode(',', db_input($_POST['ids'])).')';
-                    if(db_query($sql) && ($num=db_affected_rows())) {
-                        if($num==$count)
-                            $msg='Selected emails ban status set to disabled';
-                        else
-                            $warn="$num of $count selected emails ban status set to disabled";
-                    }else{
-                        $errors['err']='Unable to disable selected emails';
-                    }
-                }elseif($_POST['delete']){
-                    $i=0;
-                    foreach($_POST['ids'] as $k=>$v) {
-                        if(($r=FilterRule::lookup($v)) && $r->delete())
-                            $i++;
-                    }
-                    if($i && $i==$count)
-                        $msg='Selected emailes deleted successfully';
-                    elseif($i>0)
-                        $warn="$i of $count selected emails deleted";
-                    elseif(!$errors['err'])
-                        $errors['err']='Unable to delete selected emails';
+                switch(strtolower($_POST['a'])) {
+                    case 'enable':
+                        $sql='UPDATE '.FILTER_RULE_TABLE.' SET isactive=1 '
+                            .' WHERE filter_id='.db_input($filter->getId())
+                            .' AND id IN ('.implode(',', db_input($_POST['ids'])).')';
+                        if(db_query($sql) && ($num=db_affected_rows())){
+                            if($num==$count)
+                                $msg = 'Selected emails ban status set to enabled';
+                            else
+                                $warn = "$num of $count selected emails ban status enabled";
+                        } else  {
+                            $errors['err'] = 'Unable to enable selected emails';
+                        }
+                        break;
+                    case 'disable':
+                        $sql='UPDATE '.FILTER_RULE_TABLE.' SET isactive=0 '
+                            .' WHERE filter_id='.db_input($filter->getId())
+                            .' AND id IN ('.implode(',', db_input($_POST['ids'])).')';
+                        if(db_query($sql) && ($num=db_affected_rows())) {
+                            if($num==$count)
+                                $msg = 'Selected emails ban status set to disabled';
+                            else
+                                $warn = "$num of $count selected emails ban status set to disabled";
+                        } else {
+                            $errors['err'] = 'Unable to disable selected emails';
+                        }
+                        break;
+                    case 'delete':
+                        $i=0;
+                        foreach($_POST['ids'] as $k=>$v) {
+                            if(($r=FilterRule::lookup($v)) && $r->getFilterId()==$filter->getId() && $r->delete())
+                                $i++;
+                        }
+                        if($i && $i==$count)
+                            $msg = 'Selected emails deleted from banlist successfully';
+                        elseif($i>0)
+                            $warn = "$i of $count selected emails deleted from banlist";
+                        elseif(!$errors['err'])
+                            $errors['err'] = 'Unable to delete selected emails';
                     
-                }else{
-                    $errors['err']='Unknown action';
+                        break;
+                    default:
+                        $errors['err'] = 'Unknown action - get technical help';
                 }
             }
             break;
diff --git a/scp/canned.php b/scp/canned.php
index 72a1680aa21b3777afc765a2f2256d2fd433782c..46d65601a49868728bf2ce838f69414365c6deb9 100644
--- a/scp/canned.php
+++ b/scp/canned.php
@@ -70,44 +70,48 @@ if($_POST && $thisstaff->canManageCannedResponses()) {
                 $errors['err']='You must select at least one canned response';
             } else {
                 $count=count($_POST['ids']);
-                if($_POST['enable']) {
-                    $sql='UPDATE '.CANNED_TABLE.' SET isenabled=1 WHERE canned_id IN ('.
-                        implode(',', db_input($_POST['ids'])).')';
-                    if(db_query($sql) && ($num=db_affected_rows())) {
-                        if($num==$count)
-                            $msg='Selected canned responses enabled';
-                        else
-                            $warn="$num of $count selected canned responses enabled";
-                    } else {
-                        $errors['err']='Unable to enable selected canned responses.';
-                    }
-                } elseif($_POST['disable']) {
-                    $sql='UPDATE '.CANNED_TABLE.' SET isenabled=0 WHERE canned_id IN ('.
-                        implode(',', db_input($_POST['ids'])).')';
-                    if(db_query($sql) && ($num=db_affected_rows())) {
-                        if($num==$count)
-                            $msg='Selected canned responses disabled';
-                        else
-                            $warn="$num of $count selected canned responses disabled";
-                    } else {
-                        $errors['err']='Unable to disable selected canned responses';
-                    }
-                }elseif($_POST['delete']) {
-                    $i=0;
-                    foreach($_POST['ids'] as $k=>$v) {
-                        if(($c=Canned::lookup($v)) && $c->delete())
-                            $i++;
-                    }
+                switch(strtolower($_POST['a'])) {
+                    case 'enable':
+                        $sql='UPDATE '.CANNED_TABLE.' SET isenabled=1 '
+                            .' WHERE canned_id IN ('.implode(',', db_input($_POST['ids'])).')';
+                        if(db_query($sql) && ($num=db_affected_rows())) {
+                            if($num==$count)
+                                $msg = 'Selected canned responses enabled';
+                            else
+                                $warn = "$num of $count selected canned responses enabled";
+                        } else {
+                            $errors['err'] = 'Unable to enable selected canned responses.';
+                        }
+                        break;
+                    case 'disable':
+                        $sql='UPDATE '.CANNED_TABLE.' SET isenabled=0 '
+                            .' WHERE canned_id IN ('.implode(',', db_input($_POST['ids'])).')';
+                        if(db_query($sql) && ($num=db_affected_rows())) {
+                            if($num==$count)
+                                $msg = 'Selected canned responses disabled';
+                            else
+                                $warn = "$num of $count selected canned responses disabled";
+                        } else {
+                            $errors['err'] = 'Unable to disable selected canned responses';
+                        }
+                        break;
+                    case 'delete':
+
+                        $i=0;
+                        foreach($_POST['ids'] as $k=>$v) {
+                            if(($c=Canned::lookup($v)) && $c->delete())
+                                $i++;
+                        }
 
-                    if($i==$count)
-                        $msg='Selected canned responses deleted successfully';
-                    elseif($i>0)
-                        $warn="$i of $count selected canned responses deleted";
-                    elseif(!$errors['err'])
-                        $errors['err']='Unable to delete selected canned responses';
-                    
-                } else {
-                    $errors['err']='Unknown command';
+                        if($i==$count)
+                            $msg = 'Selected canned responses deleted successfully';
+                        elseif($i>0)
+                            $warn="$i of $count selected canned responses deleted";
+                        elseif(!$errors['err'])
+                            $errors['err'] = 'Unable to delete selected canned responses';
+                        break;
+                    default:
+                        $errors['err']='Unknown command';
                 }
             }
             break;
diff --git a/scp/categories.php b/scp/categories.php
index 6b645fc847737e335feb0c474d868b819f8c7c2d..add40ed395c1b076660489ecb9569a099124684d 100644
--- a/scp/categories.php
+++ b/scp/categories.php
@@ -51,44 +51,49 @@ if($_POST){
                 $errors['err']='You must select at least one category';
             } else {
                 $count=count($_POST['ids']);
-                if($_POST['public']) {
-                    $sql='UPDATE '.FAQ_CATEGORY_TABLE.' SET ispublic=1 WHERE category_id IN ('.
-                        implode(',', db_input($_POST['ids'])).')';
-                    if(db_query($sql) && ($num=db_affected_rows())) {
-                        if($num==$count)
-                            $msg='Selected categories made PUBLIC';
-                        else
-                            $warn="$num of $count selected categories made PUBLIC";
-                    } else {
-                        $errors['err']='Unable to enable selected categories public.';
-                    }
-                } elseif($_POST['private']) {
-                    $sql='UPDATE '.FAQ_CATEGORY_TABLE.' SET ispublic=0 WHERE category_id IN ('.
-                        implode(',', db_input($_POST['ids'])).')';
-                    if(db_query($sql) && ($num=db_affected_rows())) {
-                        if($num==$count)
-                            $msg='Selected categories made PRIVATE';
-                        else
-                            $warn="$num of $count selected categories made PRIVATE";
-                    } else {
-                        $errors['err']='Unable to disable selected categories PRIVATE';
-                    }
-                }elseif($_POST['delete']) {
-                    $i=0;
-                    foreach($_POST['ids'] as $k=>$v) {
-                        if(($c=Category::lookup($v)) && $c->delete())
-                            $i++;
-                    }
-
-                    if($i==$count)
-                        $msg='Selected categories deleted successfully';
-                    elseif($i>0)
-                        $warn="$i of $count selected categories deleted";
-                    elseif(!$errors['err'])
-                        $errors['err']='Unable to delete selected categories';
+                switch(strtolower($_POST['a'])) {
+                    case 'make_public':
+                        $sql='UPDATE '.FAQ_CATEGORY_TABLE.' SET ispublic=1 '
+                            .' WHERE category_id IN ('.implode(',', db_input($_POST['ids'])).')';
                     
-                } else {
-                    $errors['err']='Unknown command';
+                        if(db_query($sql) && ($num=db_affected_rows())) {
+                            if($num==$count)
+                                $msg = 'Selected categories made PUBLIC';
+                            else
+                                $warn = "$num of $count selected categories made PUBLIC";
+                        } else {
+                            $errors['err'] = 'Unable to enable selected categories public.';
+                        }
+                        break;
+                    case 'make_private':
+                        $sql='UPDATE '.FAQ_CATEGORY_TABLE.' SET ispublic=0 '
+                            .' WHERE category_id IN ('.implode(',', db_input($_POST['ids'])).')';
+
+                        if(db_query($sql) && ($num=db_affected_rows())) {
+                            if($num==$count)
+                                $msg = 'Selected categories made PRIVATE';
+                            else
+                                $warn = "$num of $count selected categories made PRIVATE";
+                        } else {
+                            $errors['err'] = 'Unable to disable selected categories PRIVATE';
+                        }
+                        break;
+                    case 'delete':
+                        $i=0;
+                        foreach($_POST['ids'] as $k=>$v) {
+                            if(($c=Category::lookup($v)) && $c->delete())
+                                $i++;
+                        }
+
+                        if($i==$count)
+                            $msg = 'Selected categories deleted successfully';
+                        elseif($i>0)
+                            $warn = "$i of $count selected categories deleted";
+                        elseif(!$errors['err'])
+                            $errors['err'] = 'Unable to delete selected categories';
+                        break;
+                    default:
+                        $errors['err']='Unknown action/command';
                 }
             }
             break;
diff --git a/scp/css/scp.css b/scp/css/scp.css
index 5955c0304daeb063f3ab6af12bd602ae4a5d851e..59964d4e61561ba78bc704e3e6ddb2d1a73af964 100644
--- a/scp/css/scp.css
+++ b/scp/css/scp.css
@@ -411,6 +411,11 @@ table.list tbody td { background: #fff; padding: 1px; padding-left:2px; vertical
 table.list tbody tr.odd td { background-color: #f0faff; }
 table.list tbody tr:hover td { background: #ffe; }
 table.list tbody tr.odd:hover td { background: #ffd; }
+/* row highlighting on hover + select */
+table.list tbody tr:hover td, table.list tbody tr.highlight td {  background: #FFFFDD; }
+/* disabled highlighting on nohover */
+table.list tbody tr:hover td.nohover, table.list tbody tr.highlight td.nohover {}
+
 
 table.list tfoot td {
     background:#eee;
diff --git a/scp/departments.php b/scp/departments.php
index 31fc4c6df5602f5959d9f4585517a8ebf04fc008..ff92b38fcb42487366d0246aafbdceb11be96b17 100644
--- a/scp/departments.php
+++ b/scp/departments.php
@@ -39,63 +39,65 @@ if($_POST){
             break;
         case 'mass_process':
             if(!$_POST['ids'] || !is_array($_POST['ids']) || !count($_POST['ids'])) {
-                $errors['err']='You must select at least one department';
-            }elseif(!$_POST['public'] && in_array($cfg->getDefaultDeptId(),$_POST['ids'])) {
-                $errors['err']='You can not disable/delete a default department. Remove default Dept. and try again.';
+                $errors['err'] = 'You must select at least one department';
+            }elseif(in_array($cfg->getDefaultDeptId(),$_POST['ids'])) {
+                $errors['err'] = 'You can not disable/delete a default department. Remove default Dept. and try again.';
             }else{
                 $count=count($_POST['ids']);
-                if($_POST['public']){
-                    $sql='UPDATE '.DEPT_TABLE.' SET ispublic=1 WHERE dept_id IN ('
-                        .implode(',', db_input($_POST['ids'])).')';
-                    if(db_query($sql) && ($num=db_affected_rows())){
-                        if($num==$count)
-                            $msg='Selected departments made public';
-                        else
-                            $warn="$num of $count selected departments made public";
-                    }else{
-                        $errors['err']='Unable to make selected department public.';
-                    }
-                }elseif($_POST['private']){
-                    $sql='UPDATE '.DEPT_TABLE.' SET ispublic=0  '.
-                         'WHERE dept_id IN ('
-                            .implode(',', db_input($_POST['ids']))
-                        .') AND dept_id!='.db_input($cfg->getDefaultDeptId());
-                    if(db_query($sql) && ($num=db_affected_rows())) {
-                        if($num==$count)
-                            $msg='Selected departments made private';
-                        else
-                            $warn="$num of $count selected departments made private";
-                    }else{
-                        $errors['err']='Unable to make selected department(s) private. Possibly already private!';
-                    }
-
-                }elseif($_POST['delete']){
-                    //Deny all deletes if one of the selections has members in it.
-                    $sql='SELECT count(staff_id) FROM '.STAFF_TABLE.' WHERE dept_id IN ('
-                        .implode(',', db_input($_POST['ids'])).')';
-                    list($members)=db_fetch_row(db_query($sql));
-                    if($members)
-                        $errors['err']='Dept. with users can not be deleted. Move staff first.';
-                    else{
-                        $i=0;
-                        foreach($_POST['ids'] as $k=>$v) {
-                            if($v!=$cfg->getDefaultDeptId() && ($d=Dept::lookup($v)) && $d->delete())
-                                $i++;
+                switch(strtolower($_POST['a'])) {
+                    case 'make_public':
+                        $sql='UPDATE '.DEPT_TABLE.' SET ispublic=1 '
+                            .' WHERE dept_id IN ('.implode(',', db_input($_POST['ids'])).')';
+                        if(db_query($sql) && ($num=db_affected_rows())){
+                            if($num==$count)
+                                $msg='Selected departments made public';
+                            else
+                                $warn="$num of $count selected departments made public";
+                        } else {
+                            $errors['err']='Unable to make selected department public.';
+                        }
+                        break;
+                    case 'make_private':
+                        $sql='UPDATE '.DEPT_TABLE.' SET ispublic=0  '
+                            .' WHERE dept_id IN ('.implode(',', db_input($_POST['ids'])).') '
+                            .' AND dept_id!='.db_input($cfg->getDefaultDeptId());
+                        if(db_query($sql) && ($num=db_affected_rows())) {
+                            if($num==$count)
+                                $msg = 'Selected departments made private';
+                            else
+                                $warn = "$num of $count selected departments made private";
+                        } else {
+                            $errors['err'] = 'Unable to make selected department(s) private. Possibly already private!';
+                        }
+                        break;
+                    case 'delete':
+                        //Deny all deletes if one of the selections has members in it.
+                        $sql='SELECT count(staff_id) FROM '.STAFF_TABLE
+                            .' WHERE dept_id IN ('.implode(',', db_input($_POST['ids'])).')';
+                        list($members)=db_fetch_row(db_query($sql));
+                        if($members)
+                            $errors['err']='Departments with staff can not be deleted. Move staff first.';
+                        else {
+                            $i=0;
+                            foreach($_POST['ids'] as $k=>$v) {
+                                if($v!=$cfg->getDefaultDeptId() && ($d=Dept::lookup($v)) && $d->delete())
+                                    $i++;
+                            }
+                            if($i && $i==$count)
+                                $msg = 'Selected departments deleted successfully';
+                            elseif($i>0)
+                                $warn = "$i of $count selected departments deleted";
+                            elseif(!$errors['err'])
+                                $errors['err'] = 'Unable to delete selected departments.';
                         }
-                        if($i && $i==$count)
-                            $msg='Selected departments deleted successfully';
-                        elseif($i>0)
-                            $warn="$i of $count selected departments deleted";
-                        elseif(!$errors['err'])
-                            $errors['err']='Unable to delete selected departments.';
-                    }
-                }else {
-                    $errors['err']='Unknown action';
+                        break;
+                    default:
+                        $errors['err']='Unknown action - get technical help';
                 }
             }
             break;
         default:
-            $errors['err']='Unknown action';
+            $errors['err']='Unknown action/command';
             break;
     }
 }
diff --git a/scp/emails.php b/scp/emails.php
index b0d32bb59bf9d415275aaada58c96cf3df892629..bdb1f5f5cb7132c7f2b590b2c6eba607203a5669 100644
--- a/scp/emails.php
+++ b/scp/emails.php
@@ -41,19 +41,18 @@ if($_POST){
             break;
         case 'mass_process':
             if(!$_POST['ids'] || !is_array($_POST['ids']) || !count($_POST['ids'])) {
-                $errors['err']='You must select at least one email address';
-            }else{
+                $errors['err'] = 'You must select at least one email address';
+            } else {
                 $count=count($_POST['ids']);
 
-                $sql='SELECT count(dept_id) FROM '.DEPT_TABLE.' dept '.
-                     'WHERE email_id IN ('.
-                        implode(',', db_input($_POST['ids'])).
-                     ') OR autoresp_email_id IN ('.
-                        implode(',', db_input($_POST['ids'])).')';
+                $sql='SELECT count(dept_id) FROM '.DEPT_TABLE.' dept '
+                    .' WHERE email_id IN ('.implode(',', db_input($_POST['ids'])).') '
+                    .' OR autoresp_email_id IN ('.implode(',', db_input($_POST['ids'])).')';
+
                 list($depts)=db_fetch_row(db_query($sql));
-                if($depts>0){
-                    $errors['err']='One or more of the selected emails is being used by a department. Remove association first!';
-                }elseif($_POST['delete']){
+                if($depts>0) {
+                    $errors['err'] = 'One or more of the selected emails is being used by a department. Remove association first!';
+                } elseif(!strcasecmp($_POST['a'], 'delete')) {
                     $i=0;
                     foreach($_POST['ids'] as $k=>$v) {
                         if($v!=$cfg->getDefaultEmailId() && ($e=Email::lookup($v)) && $e->delete())
@@ -61,19 +60,19 @@ if($_POST){
                     }
 
                     if($i && $i==$count)
-                        $msg='Selected emails deleted successfully';
+                        $msg = 'Selected emails deleted successfully';
                     elseif($i>0)
-                        $warn="$i of $count selected emails deleted";
+                        $warn = "$i of $count selected emails deleted";
                     elseif(!$errors['err'])
-                        $errors['err']='Unable to delete selected emails';
+                        $errors['err'] = 'Unable to delete selected emails';
                     
-                }else {
-                    $errors['err']='Unknown command';
+                } else {
+                    $errors['err'] = 'Unknown action - get technical help';
                 }
             }
             break;
         default:
-            $errors['err']='Unknown action';
+            $errors['err'] = 'Unknown action/command';
             break;
     }
 }
diff --git a/scp/filters.php b/scp/filters.php
index 29045410fe685f10a86a362942f34259a6401edd..dc8443f74f207fea222279bcb5c93d74e444be6b 100644
--- a/scp/filters.php
+++ b/scp/filters.php
@@ -45,53 +45,55 @@ if($_POST){
             break;
         case 'mass_process':
             if(!$_POST['ids'] || !is_array($_POST['ids']) || !count($_POST['ids'])) {
-                $errors['err']='You must select at least one filter to process.';
-            }else{
+                $errors['err'] = 'You must select at least one filter to process.';
+            } else {
                 $count=count($_POST['ids']);
-                if($_POST['enable']){
-                    $sql='UPDATE '.FILTER_TABLE.' SET isactive=1 WHERE id IN ('.
-                        implode(',', db_input($_POST['ids'])).')';
-                    if(db_query($sql) && ($num=db_affected_rows())){
-                        if($num==$count)
-                            $msg='Selected filters enabled';
-                        else
-                            $warn="$num of $count selected filters enabled";
-                    }else{
-                        $errors['err']='Unable to enable selected filters';
-                    }
-                }elseif($_POST['disable']){
-                    $sql='UPDATE '.FILTER_TABLE.' SET isactive=0  WHERE id IN ('.
-                        implode(',', db_input($_POST['ids'])).')';
-                    if(db_query($sql) && ($num=db_affected_rows())) {
-                        if($num==$count)
-                            $msg='Selected filters disabled';
-                        else
-                            $warn="$num of $count selected filters disabled";
-                    }else{
-                        $errors['err']='Unable to disable selected filters';
-                    }
-
-                }elseif($_POST['delete']){
-                    $i=0;
-                    foreach($_POST['ids'] as $k=>$v) {
-                        if(($f=Filter::lookup($v)) && !$f->isSystemBanlist() && $f->delete())
-                            $i++;
-                    }
-
-                    if($i && $i==$count)
-                        $msg='Selected filters deleted successfully';
-                    elseif($i>0)
-                        $warn="$i of $count selected filters deleted";
-                    elseif(!$errors['err'])
-                        $errors['err']='Unable to delete selected filters';
-                    
-                }else {
-                    $errors['err']='Unknown action';
+                switch(strtolower($_POST['a'])) {
+                    case 'enable':
+                        $sql='UPDATE '.FILTER_TABLE.' SET isactive=1 '
+                            .' WHERE id IN ('.implode(',', db_input($_POST['ids'])).')';
+                        if(db_query($sql) && ($num=db_affected_rows())) {
+                            if($num==$count)
+                                $msg = 'Selected filters enabled';
+                            else
+                                $warn = "$num of $count selected filters enabled";
+                        } else {
+                            $errors['err'] = 'Unable to enable selected filters';
+                        }
+                        break;
+                    case 'disable':
+                        $sql='UPDATE '.FILTER_TABLE.' SET isactive=0 '
+                            .' WHERE id IN ('.implode(',', db_input($_POST['ids'])).')';
+                        if(db_query($sql) && ($num=db_affected_rows())) {
+                            if($num==$count)
+                                $msg = 'Selected filters disabled';
+                            else
+                                $warn = "$num of $count selected filters disabled";
+                        } else {
+                            $errors['err'] = 'Unable to disable selected filters';
+                        }
+                        break;
+                    case 'delete':
+                        $i=0;
+                        foreach($_POST['ids'] as $k=>$v) {
+                            if(($f=Filter::lookup($v)) && !$f->isSystemBanlist() && $f->delete())
+                                $i++;
+                        }
+                        
+                        if($i && $i==$count)
+                            $msg = 'Selected filters deleted successfully';
+                        elseif($i>0)
+                            $warn = "$i of $count selected filters deleted";
+                        elseif(!$errors['err'])
+                            $errors['err'] = 'Unable to delete selected filters';
+                        break;
+                    default:
+                        $errors['err']='Unknown action - get technical help';
                 }
             }
             break;
         default:
-            $errors['err']='Unknown action';
+            $errors['err']='Unknown commande/action';
             break;
     }
 }
diff --git a/scp/groups.php b/scp/groups.php
index 22b1bae0acb36959fff05ec3f75323a691053920..849acecfdff57b037c75851205e0cab6050a2ef4 100644
--- a/scp/groups.php
+++ b/scp/groups.php
@@ -39,45 +39,52 @@ if($_POST){
             break;
         case 'mass_process':
             if(!$_POST['ids'] || !is_array($_POST['ids']) || !count($_POST['ids'])) {
-                $errors['err']='You must select at least one group.';
-            }else{
+                $errors['err'] = 'You must select at least one group.';
+            } elseif(in_array($thisstaff->getGroupId(), $_POST['ids'])) {
+                $errors['err'] = "As an admin, you can't disable/delete a group you belong to - you might lockout all admins!";
+            } else {
                 $count=count($_POST['ids']);
-                if($_POST['enable']){
-                    $sql='UPDATE '.GROUP_TABLE.' SET group_enabled=1, updated=NOW() WHERE group_id IN ('.
-                        implode(',', db_input($_POST['ids'])).')';
-                    if(db_query($sql) && ($num=db_affected_rows())){
-                        if($num==$count)
-                            $msg='Selected groups activated';
-                        else
-                            $warn="$num of $count selected groups activated";
-                    }else{
-                        $errors['err']='Unable to activate selected groups';
-                    }
-                }elseif($_POST['disable']){
-                    $sql='UPDATE '.GROUP_TABLE.' SET group_enabled=0, updated=NOW() WHERE group_id IN ('.
-                        implode(',', db_input($_POST['ids'])).')';
-                    if(db_query($sql) && ($num=db_affected_rows())) {
-                        if($num==$count)
-                            $msg='Selected groups disabled';
-                        else
-                            $warn="$num of $count selected groups disabled";
-                    }else{
-                        $errors['err']='Unable to disable selected groups';
-                    }
-                }elseif($_POST['delete']){
-                    foreach($_POST['ids'] as $k=>$v) {
-                        if(($g=Group::lookup($v)) && $g->delete())
-                            $i++;
-                    }
+                switch(strtolower($_POST['a'])) {
+                    case 'enable':
+                        $sql='UPDATE '.GROUP_TABLE.' SET group_enabled=1, updated=NOW() '
+                            .' WHERE group_id IN ('.implode(',', db_input($_POST['ids'])).')';
 
-                    if($i && $i==$count)
-                        $msg='Selected groups deleted successfully';
-                    elseif($i>0)
-                        $warn="$i of $count selected groups deleted";
-                    elseif(!$errors['err'])
-                        $errors['err']='Unable to delete selected groups';
-                }else{
-                    $errors['err']='Unknown action. Get technical help!';
+                        if(db_query($sql) && ($num=db_affected_rows())){
+                            if($num==$count)
+                                $msg = 'Selected groups activated';
+                            else
+                                $warn = "$num of $count selected groups activated";
+                        } else {
+                            $errors['err'] = 'Unable to activate selected groups';
+                        }
+                        break;
+                    case 'disable':
+                        $sql='UPDATE '.GROUP_TABLE.' SET group_enabled=0, updated=NOW() '
+                            .' WHERE group_id IN ('.implode(',', db_input($_POST['ids'])).')';
+                        if(db_query($sql) && ($num=db_affected_rows())) {
+                            if($num==$count)
+                                $msg = 'Selected groups disabled';
+                            else
+                                $warn = "$num of $count selected groups disabled";
+                        } else {
+                            $errors['err'] = 'Unable to disable selected groups';
+                        }
+                        break;
+                    case 'delete':
+                        foreach($_POST['ids'] as $k=>$v) {
+                            if(($g=Group::lookup($v)) && $g->delete())
+                                $i++;
+                        }   
+
+                        if($i && $i==$count)
+                            $msg = 'Selected groups deleted successfully';
+                        elseif($i>0)
+                            $warn = "$i of $count selected groups deleted";
+                        elseif(!$errors['err'])
+                            $errors['err'] = 'Unable to delete selected groups';
+                        break;
+                    default:
+                        $errors['err']  = 'Unknown action. Get technical help!';
                 }
             }
             break;
diff --git a/scp/helptopics.php b/scp/helptopics.php
index 37e865b22057483bc87595023ad92ce9be1bb306..6bb2f7862afacefc00e3e45921c34c4c5a481c2a 100644
--- a/scp/helptopics.php
+++ b/scp/helptopics.php
@@ -41,53 +41,58 @@ if($_POST){
             break;
         case 'mass_process':
             if(!$_POST['ids'] || !is_array($_POST['ids']) || !count($_POST['ids'])) {
-                $errors['err']='You must select at least one help topic';
-            }else{
+                $errors['err'] = 'You must select at least one help topic';
+            } else {
                 $count=count($_POST['ids']);
-                if($_POST['enable']){
-                    $sql='UPDATE '.TOPIC_TABLE.' SET isactive=1 WHERE topic_id IN ('.
-                        implode(',', db_input($_POST['ids'])).')';
-                    if(db_query($sql) && ($num=db_affected_rows())){
-                        if($num==$count)
-                            $msg='Selected help topics enabled';
-                        else
-                            $warn="$num of $count selected help topics enabled";
-                    }else{
-                        $errors['err']='Unable to enable selected help topics.';
-                    }
-                }elseif($_POST['disable']){
-                    $sql='UPDATE '.TOPIC_TABLE.' SET isactive=0  WHERE topic_id IN ('.
-                        implode(',', db_input($_POST['ids'])).')';
-                    if(db_query($sql) && ($num=db_affected_rows())) {
-                        if($num==$count)
-                            $msg='Selected help topics disabled';
-                        else
-                            $warn="$num of $count selected help topics disabled";
-                    }else{
-                        $errors['err']='Unable to disable selected help topic(s)';
-                    }
 
-                }elseif($_POST['delete']){
-                    $i=0;
-                    foreach($_POST['ids'] as $k=>$v) {
-                        if(($t=Topic::lookup($v)) && $t->delete())
-                            $i++;
-                    }
-
-                    if($i && $i==$count)
-                        $msg='Selected help topics deleted successfully';
-                    elseif($i>0)
-                        $warn="$i of $count selected help topics deleted";
-                    elseif(!$errors['err'])
-                        $errors['err']='Unable to delete selected help topics';
+                switch(strtolower($_POST['a'])) {
+                    case 'enable':
+                        $sql='UPDATE '.TOPIC_TABLE.' SET isactive=1 '
+                            .' WHERE topic_id IN ('.implode(',', db_input($_POST['ids'])).')';
                     
-                }else {
-                    $errors['err']='Unknown action';
+                        if(db_query($sql) && ($num=db_affected_rows())) {
+                            if($num==$count)
+                                $msg = 'Selected help topics enabled';
+                            else
+                                $warn = "$num of $count selected help topics enabled";
+                        } else {
+                            $errors['err'] = 'Unable to enable selected help topics.';
+                        }
+                        break;
+                    case 'disable':
+                        $sql='UPDATE '.TOPIC_TABLE.' SET isactive=0 '
+                            .' WHERE topic_id IN ('.implode(',', db_input($_POST['ids'])).')';
+                        if(db_query($sql) && ($num=db_affected_rows())) {
+                            if($num==$count)
+                                $msg = 'Selected help topics disabled';
+                            else
+                                $warn = "$num of $count selected help topics disabled";
+                        } else {
+                            $errors['err'] ='Unable to disable selected help topic(s)';
+                        }
+                        break;
+                    case 'delete':
+                        $i=0;
+                        foreach($_POST['ids'] as $k=>$v) {
+                            if(($t=Topic::lookup($v)) && $t->delete())
+                                $i++;
+                        }
+
+                        if($i && $i==$count)
+                            $msg = 'Selected help topics deleted successfully';
+                        elseif($i>0)
+                            $warn = "$i of $count selected help topics deleted";
+                        elseif(!$errors['err'])
+                            $errors['err']  = 'Unable to delete selected help topics';
+
+                        break;
+                    default:
+                        $errors['err']='Unknown action - get technical help.';
                 }
             }
             break;
         default:
-            $errors['err']='Unknown action';
+            $errors['err']='Unknown command/action';
             break;
     }
 }
diff --git a/scp/js/scp.js b/scp/js/scp.js
index 78fdbe43dd03cda4fac30c0adf92f2c13b2140e2..71d0e69a823e0869f38ec3e9a5562bec296a7baa 100644
--- a/scp/js/scp.js
+++ b/scp/js/scp.js
@@ -6,47 +6,11 @@
  
  */
 
-function selectAll(formObj,task,highlight){
-   var highlight = highlight || false;
-
-   for (var i=0;i < formObj.length;i++){
-      var e = formObj.elements[i];
-      if (e.type == 'checkbox' && !e.disabled){
-         if(task==0){
-            e.checked =false;
-         }else if(task==1){
-            e.checked = true;
-         }else{
-            e.checked = (e.checked) ? false : true;
-         }
-
-         if(highlight && 0) {
-            highLight(e.value,e.checked);
-         }
-       }
-   }
-
-   return false;
-}
-
-function reset_all(formObj){
-    return selectAll(formObj,0,true);
-}
-function select_all(formObj,highlight){
-    return selectAll(formObj,1,highlight);
-}
-function toogle_all(formObj,highlight){
-
-    var highlight = highlight || false;
-    return selectAll(formObj,2,highlight);
-}
-
-
-
-function checkbox_checker(formObj, min,max) {
-
+function checkbox_checker(formObj, min, max) {
 
-    var checked=$("input[type=checkbox]:checked").length;
+    var max = max || 0;
+    var min = min || 1;
+    var checked=$('input:checkbox:checked', formObj).length;
     var action= action?action:"process";
     if (max>0 && checked > max ){
         msg="You're limited to only " + max + " selections.\n"
@@ -69,6 +33,75 @@ $(document).ready(function(){
 
     $("input:not(.dp):visible:enabled:first").focus();
     $('table.list tbody tr:odd').addClass('odd');
+    $('table.list input:checkbox').bind('click, change', function() {
+        $(this)
+            .parents("tr:first")
+            .toggleClass("highlight", this.checked);
+     });
+
+    $('table.list input:checkbox:checked').trigger('change');
+
+    $('#selectAll').click(function(e) {
+        e.preventDefault();
+        var target = $(this).attr('href').substr(1, $(this).attr('href').length);
+        $(this).closest('form')
+            .find('input:enabled:checkbox.'+target)
+            .prop('checked', true)
+            .trigger('change');
+
+        return false;
+     });
+
+
+    $('#selectNone').click(function(e) {
+        e.preventDefault();
+        var target = $(this).attr('href').substr(1, $(this).attr('href').length);
+        $(this).closest('form')
+            .find('input:enabled:checkbox.'+target)
+            .prop('checked', false)
+            .trigger('change');
+        return false;
+     });
+
+    $('#selectToggle').click(function(e) {
+        e.preventDefault();
+        var target = $(this).attr('href').substr(1, $(this).attr('href').length);
+        $(this).closest('form')
+            .find('input:enabled:checkbox.'+target)
+            .each(function() {
+                $(this)
+                    .prop('checked', !$(this).is(':checked'))
+                    .trigger('change');
+             });
+        return false;
+     });
+
+    $('#actions input:submit.button').bind('click', function(e) {
+
+        var formObj = $(this).closest('form');
+        e.preventDefault();
+        if($('.dialog#confirm-action p#'+this.name+'-confirm').length == 0) {
+            alert('Unknown action '+this.name+' - get technical help.');
+        } else if(checkbox_checker(formObj, 1)) {
+            var action = this.name;
+            $('.dialog#confirm-action').undelegate('.confirm');
+            $('.dialog#confirm-action').delegate('input.confirm', 'click.confirm', function(e) {
+                e.preventDefault();
+                $('.dialog#confirm-action').hide();
+                $('#overlay').hide();
+                $('input#action', formObj).val(action);
+                formObj.submit();
+                return false;
+             });
+            $('#overlay').show();
+            $('.dialog#confirm-action .confirm-action').hide();
+            $('.dialog#confirm-action p#'+this.name+'-confirm')
+            .show()
+            .parent('div').show().trigger('click');
+        } 
+        
+        return false;
+     });
 
     if($.browser.msie) {
         $('.inactive').mouseenter(function() {
@@ -110,7 +143,7 @@ $(document).ready(function(){
         return true;
      });
 
-    $('select#setting_options').change(function() {
+    $('select#tpl_options').change(function() {
         $(this).closest('form').submit();
      });
 
@@ -294,17 +327,9 @@ $(document).ready(function(){
         left : ($(window).width() / 2 - 300)
     });
       
-    $('.dialog').delegate('a.close', 'click', function(e) {
-        e.preventDefault();
-        $(this).parent().hide()
-        $('#overlay').hide();
-
-        return false;
-    });
-
-    $('.dialog').delegate('input.close', 'click', function(e) {
+    $('.dialog').delegate('input.close, a.close', 'click', function(e) {
         e.preventDefault();
-        $(this).closest('form').parent().hide()
+        $(this).parents('div.dialog').hide()
         $('#overlay').hide();
 
         return false;
diff --git a/scp/logs.php b/scp/logs.php
index e29ef3702a50cd8949cc355b99b5a12dcb0ceadd..1e3eb57ba0b8548b40f41a401b723e475f4461b3 100644
--- a/scp/logs.php
+++ b/scp/logs.php
@@ -19,26 +19,27 @@ if($_POST){
     switch(strtolower($_POST['do'])){
         case 'mass_process':
             if(!$_POST['ids'] || !is_array($_POST['ids']) || !count($_POST['ids'])) {
-                $errors['err']='You must select at least one log to delete';
-            }else{
+                $errors['err'] = 'You must select at least one log to delete';
+            } else {
                 $count=count($_POST['ids']);
-                if($_POST['delete']){
-                    $sql='DELETE FROM '.SYSLOG_TABLE.' WHERE log_id IN ('
-                        .implode(',', db_input($_POST['ids'])).')';
+                if($_POST['a'] && !strcasecmp($_POST['a'], 'delete')) {
+
+                    $sql='DELETE FROM '.SYSLOG_TABLE
+                        .' WHERE log_id IN ('.implode(',', db_input($_POST['ids'])).')';
                     if(db_query($sql) && ($num=db_affected_rows())){
                         if($num==$count)
                             $msg='Selected logs deleted successfully';
                         else
                             $warn="$num of $count selected logs deleted";
-                    }elseif(!$errors['err'])
+                    } elseif(!$errors['err'])
                         $errors['err']='Unable to delete selected logs';
-                }else{
-                    $errors['err']='Unknown command';
+                } else {
+                    $errors['err']='Unknown action - get technical help';
                 }
             }
             break;
         default:
-            $errors['err']='Unknown option';
+            $errors['err']='Unknown command/action';
             break;
     }
 }
diff --git a/scp/slas.php b/scp/slas.php
index 8dd5b86c90b33b6cf2e88558f9ac679f63af77be..62f09c4da3c592255c634c1474260ae247403033 100644
--- a/scp/slas.php
+++ b/scp/slas.php
@@ -41,53 +41,56 @@ if($_POST){
             break;
         case 'mass_process':
             if(!$_POST['ids'] || !is_array($_POST['ids']) || !count($_POST['ids'])) {
-                $errors['err']='You must select at least one plan.';
-            }else{
+                $errors['err'] = 'You must select at least one plan.';
+            } else {
                 $count=count($_POST['ids']);
-                if($_POST['enable']){
-                    $sql='UPDATE '.SLA_TABLE.' SET isactive=1 WHERE id IN ('.
-                        implode(',', db_input($_POST['ids'])).')';
-                    if(db_query($sql) && ($num=db_affected_rows())){
-                        if($num==$count)
-                            $msg='Selected SLA plans enabled';
-                        else
-                            $warn="$num of $count selected SLA plans enabled";
-                    }else{
-                        $errors['err']='Unable to enable selected SLA plans.';
-                    }
-                }elseif($_POST['disable']){
-                    $sql='UPDATE '.SLA_TABLE.' SET isactive=0  WHERE id IN ('.
-                        implode(',', db_input($_POST['ids'])).')';
-                    if(db_query($sql) && ($num=db_affected_rows())) {
-                        if($num==$count)
-                            $msg='Selected SLA plans disabled';
-                        else
-                            $warn="$num of $count selected SLA plans disabled";
-                    }else{
-                        $errors['err']='Unable to disable selected SLA plans';
-                    }
-
-                }elseif($_POST['delete']){
-                    $i=0;
-                    foreach($_POST['ids'] as $k=>$v) {
-                        if(($p=SLA::lookup($v)) && $p->delete())
-                            $i++;
-                    }
-
-                    if($i && $i==$count)
-                        $msg='Selected SLA plans deleted successfully';
-                    elseif($i>0)
-                        $warn="$i of $count selected SLA plans deleted";
-                    elseif(!$errors['err'])
-                        $errors['err']='Unable to delete selected SLA plans';
+                switch(strtolower($_POST['a'])) {
+                    case 'enable':
+                        $sql='UPDATE '.SLA_TABLE.' SET isactive=1 '
+                            .' WHERE id IN ('.implode(',', db_input($_POST['ids'])).')';
                     
-                }else {
-                    $errors['err']='Unknown action';
+                        if(db_query($sql) && ($num=db_affected_rows())) {
+                            if($num==$count)
+                                $msg = 'Selected SLA plans enabled';
+                            else
+                                $warn = "$num of $count selected SLA plans enabled";
+                        } else {
+                            $errors['err'] = 'Unable to enable selected SLA plans.';
+                        }
+                        break;
+                    case 'disable':
+                        $sql='UPDATE '.SLA_TABLE.' SET isactive=0 '
+                            .' WHERE id IN ('.implode(',', db_input($_POST['ids'])).')';
+                        if(db_query($sql) && ($num=db_affected_rows())) {
+                            if($num==$count)
+                                $msg = 'Selected SLA plans disabled';
+                            else
+                                $warn = "$num of $count selected SLA plans disabled";
+                        } else {
+                            $errors['err'] = 'Unable to disable selected SLA plans';
+                        }
+                        break;
+                    case 'delete':
+                        $i=0;
+                        foreach($_POST['ids'] as $k=>$v) {
+                            if(($p=SLA::lookup($v)) && $p->delete())
+                                $i++;
+                        }
+
+                        if($i && $i==$count)
+                            $msg = 'Selected SLA plans deleted successfully';
+                        elseif($i>0)
+                            $warn = "$i of $count selected SLA plans deleted";
+                        elseif(!$errors['err'])
+                            $errors['err'] = 'Unable to delete selected SLA plans';
+                        break;
+                    default:
+                        $errors['err']='Unknown action - get technical help.';
                 }
             }
             break;
         default:
-            $errors['err']='Unknown action';
+            $errors['err']='Unknown action/command';
             break;
     }
 }
diff --git a/scp/staff.php b/scp/staff.php
index 88c8949f9908542067bf0ebc03e64781c5ce0b08..65f80dcc8056661de55b7f09d7ff2ea99b254eba 100644
--- a/scp/staff.php
+++ b/scp/staff.php
@@ -39,52 +39,59 @@ if($_POST){
             break;
         case 'mass_process':
             if(!$_POST['ids'] || !is_array($_POST['ids']) || !count($_POST['ids'])) {
-                $errors['err']='You must select at least one staff member.';
-            }elseif(in_array($thisstaff->getId(),$_POST['ids'])) {
-                $errors['err']='You can not disable/delete yourself - you could be the only admin!';
-            }else{
+                $errors['err'] = 'You must select at least one staff member.';
+            } elseif(in_array($thisstaff->getId(),$_POST['ids'])) {
+                $errors['err'] = 'You can not disable/delete yourself - you could be the only admin!';
+            } else {
                 $count=count($_POST['ids']);
-                if($_POST['enable']){
-                    $sql='UPDATE '.STAFF_TABLE.' SET isactive=1 WHERE staff_id IN ('.
-                        implode(',', db_input($_POST['ids'])).')';
-                    if(db_query($sql) && ($num=db_affected_rows())){
-                        if($num==$count)
-                            $msg='Selected staff activated';
-                        else
-                            $warn="$num of $count selected staff activated";
-                    }else{
-                        $errors['err']='Unable to activate selected staff';
-                    }
-                }elseif($_POST['disable']){
-                    $sql='UPDATE '.STAFF_TABLE.' SET isactive=0  '.
-                         'WHERE staff_id IN ('.implode(',',$_POST['ids']).') AND staff_id!='.db_input($thisstaff->getId());
-                    if(db_query($sql) && ($num=db_affected_rows())) {
-                        if($num==$count)
-                            $msg='Selected staff disabled';
-                        else
-                            $warn="$num of $count selected staff disabled";
-                    }else{
-                        $errors['err']='Unable to disable selected staff';
-                    }
-                }elseif($_POST['delete']){
-                    foreach($_POST['ids'] as $k=>$v) {
-                        if($v!=$thisstaff->getId() && ($s=Staff::lookup($v)) && $s->delete())
-                            $i++;
-                    }
+                switch(strtolower($_POST['a'])) {
+                    case 'enable':
+                        $sql='UPDATE '.STAFF_TABLE.' SET isactive=1 '
+                            .' WHERE staff_id IN ('.implode(',', db_input($_POST['ids'])).')';
 
-                    if($i && $i==$count)
-                        $msg='Selected staff deleted successfully';
-                    elseif($i>0)
-                        $warn="$i of $count selected staff deleted";
-                    elseif(!$errors['err'])
-                        $errors['err']='Unable to delete selected staff.';
-                }else{
-                    $errors['err']='Unknown action. Get technical help!';
+                        if(db_query($sql) && ($num=db_affected_rows())) {
+                            if($num==$count)
+                                $msg = 'Selected staff activated';
+                            else
+                                $warn = "$num of $count selected staff activated";
+                        } else {
+                            $errors['err'] = 'Unable to activate selected staff';
+                        }
+                        break;
+                    case 'disable':
+                        $sql='UPDATE '.STAFF_TABLE.' SET isactive=0 '
+                            .' WHERE staff_id IN ('.implode(',',$_POST['ids']).') AND staff_id!='.db_input($thisstaff->getId());
+
+                        if(db_query($sql) && ($num=db_affected_rows())) {
+                            if($num==$count)
+                                $msg = 'Selected staff disabled';
+                            else
+                                $warn = "$num of $count selected staff disabled";
+                        } else {
+                            $errors['err'] = 'Unable to disable selected staff';
+                        }
+                        break;
+                    case 'delete':
+                        foreach($_POST['ids'] as $k=>$v) {
+                            if($v!=$thisstaff->getId() && ($s=Staff::lookup($v)) && $s->delete())
+                                $i++;
+                        }
+
+                        if($i && $i==$count)
+                            $msg = 'Selected staff deleted successfully';
+                        elseif($i>0)
+                            $warn = "$i of $count selected staff deleted";
+                        elseif(!$errors['err'])
+                            $errors['err'] = 'Unable to delete selected staff.';
+                        break;
+                    default:
+                        $errors['err'] = 'Unknown action. Get technical help!';
                 }
+                    
             }
             break;
         default:
-            $errors['err']='Unknown action';
+            $errors['err']='Unknown action/command';
             break;
     }
 }
diff --git a/scp/teams.php b/scp/teams.php
index 50d7ca1cae022dd328189b9d8ffdaaad1727c533..b8ebd4b280343641b66082d54058c0fc9971af5f 100644
--- a/scp/teams.php
+++ b/scp/teams.php
@@ -40,49 +40,54 @@ if($_POST){
         case 'mass_process':
             if(!$_POST['ids'] || !is_array($_POST['ids']) || !count($_POST['ids'])) {
                 $errors['err']='You must select at least one team.';
-            }else{
+            } else {
                 $count=count($_POST['ids']);
-                if($_POST['enable']){
-                    $sql='UPDATE '.TEAM_TABLE.' SET isenabled=1 WHERE team_id IN ('.
-                        implode(',', db_input($_POST['ids'])).')';
-                    if(db_query($sql) && ($num=db_affected_rows())){
-                        if($num==$count)
-                            $msg='Selected teams activated';
-                        else
-                            $warn="$num of $count selected teams activated";
-                    }else{
-                        $errors['err']='Unable to activate selected teams';
-                    }
-                }elseif($_POST['disable']){
-                    $sql='UPDATE '.TEAM_TABLE.' SET isenabled=0 WHERE team_id IN ('.
-                        implode(',', db_input($_POST['ids'])).')';
-                    if(db_query($sql) && ($num=db_affected_rows())) {
-                        if($num==$count)
-                            $msg='Selected teams disabled';
-                        else
-                            $warn="$num of $count selected teams disabled";
-                    }else{
-                        $errors['err']='Unable to disable selected teams';
-                    }
-                }elseif($_POST['delete']){
-                    foreach($_POST['ids'] as $k=>$v) {
-                        if(($t=Team::lookup($v)) && $t->delete())
-                            $i++;
-                    }
+                switch(strtolower($_POST['a'])) {
+                    case 'enable':
+                        $sql='UPDATE '.TEAM_TABLE.' SET isenabled=1 '
+                            .' WHERE team_id IN ('.implode(',', db_input($_POST['ids'])).')';
 
-                    if($i && $i==$count)
-                        $msg='Selected teams deleted successfully';
-                    elseif($i>0)
-                        $warn="$i of $count selected teams deleted";
-                    elseif(!$errors['err'])
-                        $errors['err']='Unable to delete selected teams';
-                }else{
-                    $errors['err']='Unknown action. Get technical help!';
+                        if(db_query($sql) && ($num=db_affected_rows())) {
+                            if($num==$count)
+                                $msg = 'Selected teams activated';
+                            else
+                                $warn = "$num of $count selected teams activated";
+                        } else {
+                            $errors['err'] = 'Unable to activate selected teams';
+                        }
+                        break;
+                    case 'disable':
+                        $sql='UPDATE '.TEAM_TABLE.' SET isenabled=0 '
+                            .' WHERE team_id IN ('.implode(',', db_input($_POST['ids'])).')';
+
+                        if(db_query($sql) && ($num=db_affected_rows())) {
+                            if($num==$count)
+                                $msg = 'Selected teams disabled';
+                            else
+                                $warn = "$num of $count selected teams disabled";
+                        } else {
+                            $errors['err'] = 'Unable to disable selected teams';
+                        }
+                        break;
+                    case 'delete':
+                        foreach($_POST['ids'] as $k=>$v) {
+                            if(($t=Team::lookup($v)) && $t->delete())
+                                $i++;
+                        }
+                        if($i && $i==$count)
+                            $msg = 'Selected teams deleted successfully';
+                        elseif($i>0)
+                            $warn = "$i of $count selected teams deleted";
+                        elseif(!$errors['err'])
+                            $errors['err'] = 'Unable to delete selected teams';
+                        break;
+                    default:
+                        $errors['err'] = 'Unknown action. Get technical help!';
                 }
             }
             break;
         default:
-            $errors['err']='Unknown action';
+            $errors['err']='Unknown action/command';
             break;
     }
 }
diff --git a/scp/templates.php b/scp/templates.php
index 4ba95d70a8a707422bf011781b6df9ab292a5f9f..1c0db45b1a84b2dcce432ce66b7aa1e9f7e4cdc8 100644
--- a/scp/templates.php
+++ b/scp/templates.php
@@ -51,49 +51,50 @@ if($_POST){
         case 'mass_process':
             if(!$_POST['ids'] || !is_array($_POST['ids']) || !count($_POST['ids'])) {
                 $errors['err']='You must select at least one template to process.';
-            }else{
+            } else {
                 $count=count($_POST['ids']);
-                if($_POST['enable']){
-                    $sql='UPDATE '.EMAIL_TEMPLATE_TABLE.' SET isactive=1 WHERE tpl_id IN ('.
-                        implode(',', db_input($_POST['ids'])).')';
-                    if(db_query($sql) && ($num=db_affected_rows())){
-                        if($num==$count)
-                            $msg='Selected templates enabled';
+                switch(strtolower($_POST['a'])) {
+                    case 'enable':
+                        $sql='UPDATE '.EMAIL_TEMPLATE_TABLE.' SET isactive=1 '
+                            .' WHERE tpl_id IN ('.implode(',', db_input($_POST['ids'])).')';
+                        if(db_query($sql) && ($num=db_affected_rows())){
+                            if($num==$count)
+                                $msg = 'Selected templates enabled';
+                            else
+                                $warn = "$num of $count selected templates enabled";
+                        } else {
+                            $errors['err'] = 'Unable to enable selected templates';
+                        }
+                        break;
+                    case 'disable':
+                        $i=0;
+                        foreach($_POST['ids'] as $k=>$v) {
+                            if(($t=Template::lookup($v)) && !$t->isInUse() && $t->disable())
+                                $i++;
+                        }
+                        if($i && $i==$count)
+                            $msg = 'Selected templates disabled';
+                        elseif($i)
+                            $warn = "$i of $count selected templates disabled (in-use templates can't be disabled)";
                         else
-                            $warn="$num of $count selected templates enabled";
-                    }else{
-                        $errors['err']='Unable to enable selected templates';
-                    }
-                }elseif($_POST['disable']){
+                            $errors['err'] = "Unable to disable selected templates (in-use or default template can't be disabled)";
+                        break;
+                    case 'delete':
+                        $i=0;
+                        foreach($_POST['ids'] as $k=>$v) {
+                            if(($t=Template::lookup($v)) && !$t->isInUse() && $t->delete())
+                                $i++;
+                        }
 
-                    $i=0;
-                    foreach($_POST['ids'] as $k=>$v) {
-                        if(($t=Template::lookup($v)) && !$t->isInUse() && $t->disable())
-                            $i++;
-                    }
-
-                    if($i && $i==$count)
-                        $msg='Selected templates disabled';
-                    elseif($i)
-                        $warn="$i of $count selected templates disabled (in-use templates can't be disabled)";
-                    else
-                        $errors['err']="Unable to disable selected templates (in-use or default template can't be disabled)";
-                }elseif($_POST['delete']){
-                    $i=0;
-                    foreach($_POST['ids'] as $k=>$v) {
-                        if(($t=Template::lookup($v)) && $t->delete())
-                            $i++;
-                    }
-
-                    if($i && $i==$count)
-                        $msg='Selected templates deleted successfully';
-                    elseif($i>0)
-                        $warn="$i of $count selected templates deleted";
-                    elseif(!$errors['err'])
-                        $errors['err']='Unable to delete selected templates';
-                    
-                }else {
-                    $errors['err']='Unknown template action';
+                        if($i && $i==$count)
+                            $msg = 'Selected templates deleted successfully';
+                        elseif($i>0)
+                            $warn = "$i of $count selected templates deleted";
+                        elseif(!$errors['err'])
+                            $errors['err'] = 'Unable to delete selected templates';
+                        break;
+                    default:
+                        $errors['err']='Unknown template action';
                 }
             }
             break;
diff --git a/scp/tickets.php b/scp/tickets.php
index b2a13ceae914b2a45be39417ef199a21cf7aa719..47395d592c2da9cb505daec7d037fb1349711dfa 100644
--- a/scp/tickets.php
+++ b/scp/tickets.php
@@ -324,62 +324,99 @@ if($_POST && !$errors):
         if($ticket && is_object($ticket))
             $ticket->reload();//Reload ticket info following post processing
     }elseif($_POST['a']) {
+
         switch($_POST['a']) {
             case 'mass_process':
                 if(!$thisstaff->canManageTickets())
                     $errors['err']='You do not have permission to mass manage tickets. Contact admin for such access';    
                 elseif(!$_POST['tids'] || !is_array($_POST['tids']))
                     $errors['err']='No tickets selected. You must select at least one ticket.';
-                elseif(($_POST['reopen'] || $_POST['close']) && !$thisstaff->canCloseTickets())
-                    $errors['err']='You do not have permission to close/reopen tickets';
-                elseif($_POST['delete'] && !$thisstaff->canDeleteTickets())
-                    $errors['err']='You do not have permission to delete tickets';
-                elseif(!$_POST['tids'] || !is_array($_POST['tids']))
-                    $errors['err']='You must select at least one ticket';
-        
-                if(!$errors) {
+                else {
                     $count=count($_POST['tids']);
-                    if(isset($_POST['reopen'])){
-                        $i=0;
-                        $note='Ticket reopened by '.$thisstaff->getName();
-                        foreach($_POST['tids'] as $k=>$v) {
-                            $t = new Ticket($v);
-                            if($t && @$t->reopen()) {
-                                $i++;
-                                $t->logActivity('Ticket Reopened',$note,false,'System');
+                    $i = 0;
+                    switch(strtolower($_POST['do'])) {
+                        case 'reopen':
+                            if($thisstaff->canCloseTickets() || $thisstaff->canCreateTickets()) {
+                                $note='Ticket reopened by '.$thisstaff->getName();
+                                foreach($_POST['tids'] as $k=>$v) {
+                                    if(($t=Ticket::lookup($v)) && $t->isClosed() && @$t->reopen()) {
+                                        $i++;
+                                        $t->logNote('Ticket Reopened', $note);
+                                    }
+                                }
+
+                                if($i==$count)
+                                    $msg = "Selected tickets ($i) reopened successfully";
+                                elseif($i)
+                                    $warn = "$i of $count selected tickets reopened";
+                                else
+                                    $errors['err'] = 'Unable to reopen selected tickets';
+                            } else {
+                                $errors['err'] = 'You do not have permission to reopen tickets';
                             }
-                        }
-                        $msg="$i of $count selected tickets reopened";
-                    }elseif(isset($_POST['close'])){
-                        $i=0;
-                        $note='Ticket closed without response by '.$thisstaff->getName();
-                        foreach($_POST['tids'] as $k=>$v) {
-                            $t = new Ticket($v);
-                            if($t && @$t->close()){ 
-                                $i++;
-                                $t->logActivity('Ticket Closed',$note,false,'System');
+                            break;
+                        case 'close':
+                            if($thisstaff->canCloseTickets()) {
+                                $note='Ticket closed without response by '.$thisstaff->getName();
+                                foreach($_POST['tids'] as $k=>$v) {
+                                    if(($t=Ticket::lookup($v)) && $t->isOpen() && @$t->close()) { 
+                                        $i++;
+                                        $t->logNote('Ticket Closed', $note);
+                                    }
+                                }
+
+                                if($i==$count)
+                                    $msg ="Selected tickets ($i) closed succesfully";
+                                elseif($i)
+                                    $warn = "$i of $count selected tickets closed";
+                                else
+                                    $errors['err'] = 'Unable to close selected tickets';
+                            } else {
+                                $errors['err'] = 'You do not have permission to close tickets';
                             }
-                        }
-                        $msg="$i of $count selected tickets closed";
-                    }elseif(isset($_POST['overdue'])){
-                        $i=0;
-                        $note='Ticket flagged as overdue by '.$thisstaff->getName();
-                        foreach($_POST['tids'] as $k=>$v) {
-                            $t = new Ticket($v);
-                            if($t && !$t->isOverdue())
-                                if($t->markOverdue()) { 
+                            break;
+                        case 'mark_overdue':
+                            $note='Ticket flagged as overdue by '.$thisstaff->getName();
+                            foreach($_POST['tids'] as $k=>$v) {
+                                if(($t=Ticket::lookup($v)) && !$t->isOverdue() && $t->markOverdue()) {
                                     $i++;
-                                    $t->logActivity('Ticket Marked Overdue',$note,false,'System');
+                                    $t->logNote('Ticket Marked Overdue', $note);
+                                }
+                            }
+
+                            if($i==$count)
+                                $msg = "Selected tickets ($i) marked overdue";
+                            elseif($i)
+                                $warn = "$i of $count selected tickets marked overdue";
+                            else
+                                $errors['err'] = 'Unable to flag selected tickets as overdue';
+                            break;
+                        case 'delete':
+                            if($thisstaff->canDeleteTickets()) {
+                                foreach($_POST['tids'] as $k=>$v) {
+                                    if(($t=Ticket::lookup($v)) && @$t->delete()) $i++;
                                 }
-                        }
-                        $msg="$i of $count selected tickets marked overdue";
-                    }elseif(isset($_POST['delete'])){
-                        $i=0;
-                        foreach($_POST['tids'] as $k=>$v) {
-                            $t = new Ticket($v);
-                            if($t && @$t->delete()) $i++;
-                        }
-                        $msg="$i of $count selected tickets deleted";
+                        
+                                //Log a warning
+                                if($i) {
+                                    $log = sprintf('%s (%s) just deleted %d ticket(s)',
+                                            $thisstaff->getName(), $thisstaff->getUserName(), $i);
+                                    $ost->logWarning('Tickets deleted', $log, false);
+
+                                }
+
+                                if($i==$count)
+                                    $msg = "Selected tickets ($i) deleted successfully";
+                                elseif($i)
+                                    $warn = "$i of $count selected tickets deleted";
+                                else
+                                    $errors['err'] = 'Unable to delete selected tickets';
+                            } else {
+                                $errors['err'] = 'You do not have permission to delete tickets';
+                            }
+                            break;
+                        default:
+                            $errors['err']='Unknown or unsupported action - get technical help';
                     }
                 }
                 break;