diff --git a/html/themes/default/dialog.css b/html/themes/default/dialog.css
new file mode 100644
index 0000000000000000000000000000000000000000..7ed68719db78ccf59e53c98f5d384bfc36e2f684
--- /dev/null
+++ b/html/themes/default/dialog.css
@@ -0,0 +1,32 @@
+
+div.msgtitle {
+width:auto;
+background-color:#F0F0F0;
+border: solid 1px #BBBBBB;
+margin-bottom:7px;
+}
+div.msgtitle h2 {
+margin:10px;
+}
+
+div.msgdialog {
+width:60%;
+z-index:150;
+position:relative;
+display:none;
+margin:auto;
+top:200px;
+}
+@media (max-height: 600px) {
+  div.msgdialog {
+    top:auto;
+  }
+}
+
+/* Small screens (i.e. phones) */
+@media (max-width: 640px) {
+  div.msgdialog {
+    top:auto;
+    width:auto;
+  }
+}
diff --git a/html/themes/default/style.css b/html/themes/default/style.css
index 69366f811efdfe8742402f31b10b034f4a78fc94..271615b909d21bd46ff061fbec13e83d2b9c79c6 100644
--- a/html/themes/default/style.css
+++ b/html/themes/default/style.css
@@ -417,33 +417,6 @@ font-size:1px;
 line-height:0;
 }
 
-div.errorMsgTitle {
-width:100%;
-font-size:1.4em;
-padding-bottom:.3em;
-padding-top:.3em;
-font-weight:bold;
-background-color:#F0F0F0;
-}
-
-div.errorMsgDialog {
-width:60%;
-background-color:#FFF;
-border:4px solid red;
-z-index:150;
-display:none;
-position:absolute;
-}
-
-div.infoMsgDialog {
-width:60%;
-background-color:#FFF;
-border:2px solid #000;
-z-index:150;
-display:none;
-position:absolute;
-}
-
 div.autocomplete {
 position:absolute;
 background-color:#FFF;
diff --git a/ihtml/themes/default/css.tpl b/ihtml/themes/default/css.tpl
index e222c057c601220b61cc2c9d82bc9f3afe07925c..7226d98d3d5a7dcdd4f5ed2dfcb62bf4e26f97d4 100644
--- a/ihtml/themes/default/css.tpl
+++ b/ihtml/themes/default/css.tpl
@@ -8,6 +8,7 @@
   <link rel="stylesheet" type="text/css" href="{filePath file="setup.css"}" media="screen"/>
   <link rel="stylesheet" type="text/css" href="{filePath file="sieve.css"}" media="screen"/>
   <link rel="stylesheet" type="text/css" href="{filePath file="theme.css"}" media="screen"/>
+  <link rel="stylesheet" type="text/css" href="{filePath file="dialog.css"}" media="screen"/>
 {foreach from=$css_files item=file}
   <link rel="stylesheet" type="text/css" href="{$file}"/>
 {/foreach}
diff --git a/ihtml/themes/default/msg_dialog.tpl b/ihtml/themes/default/msg_dialog.tpl
index f6ddc99127d8c835a8d3a2ef0d280408ff2eac3e..1cefb9b01e7a309b3c759fddf4e8bdd61196d972 100644
--- a/ihtml/themes/default/msg_dialog.tpl
+++ b/ihtml/themes/default/msg_dialog.tpl
@@ -1,46 +1,46 @@
 {if $frame}
-  <div  id='e_layer2'
+  <div
+    id="e_layer2"
     style="
-      position: absolute;
-      left: 0px;
-      top: 0px;
+      position:absolute;
+      left:0px;
+      top:0px;
       right:0px;
       bottom:0px;
       z-index:100;
-      background-image: url(images/opacity_black.png);">
+      background-image:url(images/opacity_black.png);">
 {else}
 
   {if $s_Trace != "" && $i_TraceCnt != 0}
   <div id="trace_{$i_ID}" style="display:none;">
     {$s_Trace}
   </div>
-
   {/if}
 
   {if $i_Type == $smarty.const.INFO_DIALOG || $i_Type == $smarty.const.CONFIRM_DIALOG || $i_Type == $smarty.const.OK_CANCEL_DIALOG}
-  <div id="e_layer{$i_ID}" class="infoMsgDialog" style="top:200px;left:200px;">
+  <div id="e_layer{$i_ID}" class="info msgdialog">
   {else}
-  <div id="e_layer{$i_ID}" class="errorMsgDialog" style="top:200px;left:200px;">
+  <div id="e_layer{$i_ID}" class="error msgdialog">
   {/if}
 
-  <div id="e_layerTitle{$i_ID}" class="errorMsgTitle">
-    <table><tr><td>
+  <div id="e_layerTitle{$i_ID}" class="msgtitle">
+    <h2>
   {if $i_Type == $smarty.const.ERROR_DIALOG}
-          <img src="images/error.png" alt="{t}Error{/t}">
+      <img src="images/error.png" class="center" alt="{t}Error{/t}"/>
   {elseif $i_Type == $smarty.const.WARNING_DIALOG}
-          <img src="images/warning.png"  alt="{t}Warning{/t}">
+      <img src="images/warning.png" class="center"  alt="{t}Warning{/t}"/>
   {elseif $i_Type == $smarty.const.INFO_DIALOG || $i_Type == $smarty.const.CONFIRM_DIALOG || $i_Type == $smarty.const.OK_CANCEL_DIALOG}
-          <img src="images/info.png" alt="{t}Information{/t}">
+      <img src="images/info.png" class="center" alt="{t}Information{/t}"/>
   {/if}
-    </td><td style="font-size: 1.1em; font-weight:bold;">{$s_Title}</td></tr>
-  </table>
+      {$s_Title}
+    </h2>
   </div>
 
-    <table style="z-index:250;width:100%; border-top: solid 1px #BBBBBB;" cellspacing=0 cellpadding=2 border=0>
+    <table style="z-index:250;width:100%;">
       <tr>
-        <td style="width:100%; padding:7px; padding-bottom:14px;">
+        <td style="width:100%;">
           {$s_Message}
-          <br>
+          <br/>
         </td>
         {if $s_Trace != "" && $i_TraceCnt != 0}
         <td style="width:20px; vertical-align:top; cursor:pointer;">
@@ -48,30 +48,24 @@
         </td>
         {/if}
       </tr>
-      <tr>
-        {if $s_Trace != "" && $i_TraceCnt != 0}
-        <td colspan="3" align="center" style="border-top: solid 1px #BBBBBB;">
-        {else}
-        <td colspan="2" align="center" style="border-top: solid 1px #BBBBBB;">
-        {/if}
-  {if $i_Type == $smarty.const.ERROR_DIALOG || $i_Type == $smarty.const.WARNING_DIALOG || $i_Type == $smarty.const.INFO_DIALOG}
-          <input type="button" id="MSG_OK{$i_ID}" type="button" name="MSG_OK{$i_ID}"
-            onClick="next_msg_dialog();" value="{t}Ok{/t}">
-  {elseif $i_Type == $smarty.const.CONFIRM_DIALOG}
-          <input type="button" id="MSG_OK{$i_ID}" type="submit" name="MSG_OK{$i_ID}"
-            onClick="next_msg_dialog();" value="{t}Ok{/t}">
-          <input type="button" type="button" name="MSG_CANCEL{$i_ID}"
-            onClick="next_msg_dialog();" value="{t}Cancel{/t}">
-  {elseif $i_Type == $smarty.const.OK_CANCEL_DIALOG}
-          <input type="button" id="MSG_OK{$i_ID}" type="submit" name="MSG_OK{$i_ID}"
-            onClick="next_msg_dialog();" value="{t}Ok{/t}">
-          <input type="button" type="submit" name="MSG_CANCEL{$i_ID}"
-            onClick="next_msg_dialog();" value="{t}Cancel{/t}">
-  {/if}
-        </td>
-      </tr>
     </table>
+    <div class="plugbottom">
+      {if $i_Type == $smarty.const.ERROR_DIALOG || $i_Type == $smarty.const.WARNING_DIALOG || $i_Type == $smarty.const.INFO_DIALOG}
+        <input type="button" id="MSG_OK{$i_ID}" type="button" name="MSG_OK{$i_ID}"
+          onClick="next_msg_dialog();" value="{t}Ok{/t}"/>
+      {elseif $i_Type == $smarty.const.CONFIRM_DIALOG}
+        <input type="button" id="MSG_OK{$i_ID}" type="submit" name="MSG_OK{$i_ID}"
+          onClick="next_msg_dialog();" value="{t}Ok{/t}"/>
+        <input type="button" type="button" name="MSG_CANCEL{$i_ID}"
+          onClick="next_msg_dialog();" value="{t}Cancel{/t}"/>
+      {elseif $i_Type == $smarty.const.OK_CANCEL_DIALOG}
+        <input type="button" id="MSG_OK{$i_ID}" type="submit" name="MSG_OK{$i_ID}"
+          onClick="next_msg_dialog();" value="{t}Ok{/t}"/>
+        <input type="button" type="submit" name="MSG_CANCEL{$i_ID}"
+          onClick="next_msg_dialog();" value="{t}Cancel{/t}"/>
+      {/if}
     </div>
+  </div>
   <script type="text/javascript">
     focus_field('MSG_OK{$i_ID}');
   </script>
diff --git a/include/class_msg_dialog.inc b/include/class_msg_dialog.inc
index 88ca4b469434149f87aea5e96d44ef6a24e500bd..f01cd0cd7f7990d77be53c57898f868f544c9075 100644
--- a/include/class_msg_dialog.inc
+++ b/include/class_msg_dialog.inc
@@ -211,25 +211,25 @@ class msg_dialog
         count(session::get('msg_dialogs'))) {
       /* Get frame one */
       $smarty = get_smarty();
-      $smarty->assign("frame", TRUE);
+      $smarty->assign('frame', TRUE);
       $return = $smarty->fetch(get_template_path('msg_dialog.tpl'));
 
       $msg_dialogs = session::get('msg_dialogs');
       foreach ($msg_dialogs as $key => $dialog) {
-        if (!preg_match("/".$dialog->get_ID()."/", "")) {
+        if (!preg_match('/'.$dialog->get_ID().'/', '')) {
           $return     .= $dialog->execute();
-          $dialog_ids = $dialog->get_ID().",".$dialog_ids;
+          $dialog_ids = $dialog->get_ID().','.$dialog_ids;
         }
         unset($msg_dialogs[$key]);
       }
       session::set('msg_dialogs', $msg_dialogs);
-      $dialog_ids = preg_replace("/,$/", "", $dialog_ids);
+      $dialog_ids = preg_replace('/,$/', '', $dialog_ids);
 
-      $return .= "</div>";
-      $return .= "<input type='hidden' style='width:400px;' name='pending_msg_dialogs' id='pending_msg_dialogs' value='".$dialog_ids."'>";
-      $return .= "<input type='hidden' style='width:400px;' name='closed_msg_dialogs' id='closed_msg_dialogs' value=''>";
-      $return .= "<input type='hidden' style='width:400px;' name='current_msg_dialogs' id='current_msg_dialogs' value=''>";
-      $return .= "<input type='hidden' style='width:700px;' name='js_debug' id='js_debug'>";
+      $return .= '</div>'."\n";
+      $return .= '<input type="hidden" style="width:400px;" name="pending_msg_dialogs"  id="pending_msg_dialogs" value="'.$dialog_ids.'"/>'."\n";
+      $return .= '<input type="hidden" style="width:400px;" name="closed_msg_dialogs"   id="closed_msg_dialogs" value=""/>'."\n";
+      $return .= '<input type="hidden" style="width:400px;" name="current_msg_dialogs"  id="current_msg_dialogs" value=""/>'."\n";
+      $return .= '<input type="hidden" style="width:700px;" name="js_debug"             id="js_debug">'."\n";
     }
     return $return;
   }