Index: config/main.inc.php.dist
===================================================================
--- config/main.inc.php.dist	(revision 335)
+++ config/main.inc.php.dist	(working copy)
@@ -225,6 +225,9 @@
 // list of configuration option names that need to be available in Javascript.
 $rcmail_config['javascript_config'] = array('read_when_deleted', 'flag_for_deletion');
 
+// use preview pane
+$rcmail_config['preview'] = TRUE;
 
+
 // end of config file
 ?>
Index: program/js/app.js
===================================================================
--- program/js/app.js	(revision 335)
+++ program/js/app.js	(working copy)
@@ -1256,18 +1256,27 @@
     this.in_selection_before = false;
         
     // row was double clicked
-    if (this.task=='mail' && this.list_rows && this.list_rows[id].clicked && this.in_selection(id))
+    if (this.task=='mail' && this.list_rows)
       {
-      if (this.env.mailbox==this.env.drafts_mailbox)
+      // row was double clicked
+      if (this.list_rows[id].clicked && this.in_selection(id))
         {
-        this.set_busy(true);
-        location.href = this.env.comm_path+'&_action=compose&_draft_uid='+id+'&_mbox='+urlencode(this.env.mailbox);
+        if (this.env.mailbox==this.env.drafts_mailbox)
+          {
+          this.set_busy(true);
+          location.href = this.env.comm_path+'&_action=compose&_draft_uid='+id+'&_mbox='+urlencode(this.env.mailbox);
+          }
+        else
+          {
+          this.show_message(id);
+          }
+        return false;
         }
+      // row was single clicked
       else
         {
-        this.show_message(id);
+          this.show_preview(id);
         }
-      return false;
       }
     else if (this.task=='addressbook')
       {
@@ -1502,6 +1511,50 @@
 
     return true;  
     };
+
+
+  // when user clicks on a row
+  this.show_preview = function(id, safe)
+    {
+    var add_url = '';
+    var target = window;
+    var contentframe = rcube_find_object('mailcontframe');
+    var previewpane = rcube_find_object('mailpreviewframe');
+    if (this.env.contentframe && window.frames && window.frames[this.env.contentframe])
+      {
+      target = window.frames[this.env.contentframe];
+      add_url = '&_framed=1';
+      }
+
+    if (safe)
+      add_url = '&_safe=1';
+
+    if (id && previewpane)
+      {
+      if (previewpane.style.display && previewpane.style.display=='none')
+        {
+        var top = contentframe.offsetTop;
+        var left = contentframe.offsetLeft;
+        var height = contentframe.offsetHeight;
+        var width = contentframe.offsetWidth;
+        contentframe.style.height = (height/2) + 'px';
+        previewpane.style.display = 'block';
+        previewpane.style.left = left + 'px';
+        previewpane.style.width = (width-2) + 'px';
+        previewpane.style.top = (top+(height/2)+1) + 'px';
+        previewpane.style.height = (height/2) + 'px';
+        previewpane.style.position = 'absolute';
+        }
+      if (previewpane.firstChild)
+        previewpane.removeChild(previewpane.firstChild);
+      var iframe = document.createElement('iframe');
+	  iframe.setAttribute('src', '?_task=mail&_action=preview&_uid=' + id);
+	  iframe.style.border = 'none';
+	  iframe.style.height = previewpane.style.height;
+	  iframe.style.width = previewpane.style.width;
+      previewpane.appendChild(iframe);
+      }
+    };
     
 
   // when user doble-clicks on a row
Index: program/steps/mail/show.inc
===================================================================
--- program/steps/mail/show.inc	(revision 335)
+++ program/steps/mail/show.inc	(working copy)
@@ -171,6 +171,8 @@
 
 if ($_action=='print')
   parse_template('printmessage');
+else if ($_action=='preview')
+  parse_template('previewmessage');
 else
   parse_template('message');
-?>
\ No newline at end of file
+?>
Index: skins/default/mail.css
===================================================================
--- skins/default/mail.css	(revision 335)
+++ skins/default/mail.css	(working copy)
@@ -120,7 +120,16 @@
   height: expression((parseInt(document.documentElement.clientHeight)-125)+'px');
 }
 
+#mailpreviewframe
+{
+  position: absolute;
+  border: 1px solid #999999;
+  background-color: #F9F9F9;
+  overflow: auto;
+  display: none;
+}
 
+
 #messagepartframe
 {
   border: 1px solid #999999;
@@ -588,6 +597,11 @@
   height: expression((parseInt(document.documentElement.clientHeight)-125)+'px');
 }
 
+#previewframe
+{
+  background-color: #FFFFFF;
+}
+
 table.headers-table
 {
   width: 100%;
Index: skins/default/templates/mail.html
===================================================================
--- skins/default/templates/mail.html	(revision 335)
+++ skins/default/templates/mail.html	(working copy)
@@ -52,6 +52,8 @@
   attachmentIcon="/images/icons/attachment.png" />
 </div>
 
+<div id="mailpreviewframe" style="display: none;"></div>
+
 <div id="listcontrols">
 <roundcube:label name="select" />:&nbsp;
 <roundcube:button command="select-all" label="all" classAct="active" />&nbsp;
Index: index.php
===================================================================
--- index.php	(revision 335)
+++ index.php	(working copy)
@@ -241,7 +241,7 @@
   {
   include_once('program/steps/mail/func.inc');
   
-  if ($_action=='show' || $_action=='print')
+  if ($_action=='show' || $_action=='print' || $_action=='preview')
     include('program/steps/mail/show.inc');
 
   if ($_action=='get')
