Index: /trunk/expressoMail1_2/js/main.js
===================================================================
--- /trunk/expressoMail1_2/js/main.js	(revision 878)
+++ /trunk/expressoMail1_2/js/main.js	(revision 901)
@@ -768,6 +768,13 @@
 			else
 				body.contentWindow.focus();
-			if (is_ie)
-				body.contentWindow.document.onkeypress = function(){if(body.contentWindow.event.keyCode == 13){changeEnterKey(body.contentWindow)}};
+			config_events( body.contentWindow.document, 'onkeyup', function( e )
+			{
+				if ( e.keyCode == 13 )
+				{
+					var paragraphs = body.contentWindow.document.getElementsByTagName( 'p' );
+					for ( p = 0; p < paragraphs.length; p++ )
+						paragraphs.item( p ).style.margin = '0px';
+				}
+			});
 			msg_reply_from = document.createElement('input');
 			msg_reply_from.id = "msg_reply_from_" + new_border_ID;
@@ -798,6 +805,13 @@
 			else
 				body.contentWindow.focus();
-			if (is_ie)
-				body.contentWindow.document.onkeypress = function(){if(body.contentWindow.event.keyCode == 13){changeEnterKey(body.contentWindow)}};
+			config_events( body.contentWindow.document, 'onkeyup', function( e )
+			{
+				if ( e.keyCode == 13 )
+				{
+					var paragraphs = body.contentWindow.document.getElementsByTagName( 'p' );
+					for ( p = 0; p < paragraphs.length; p++ )
+						paragraphs.item( p ).style.margin = '0px';
+				}
+			});
 			msg_reply_from = document.createElement('input');
 			msg_reply_from.id = "msg_reply_from_" + new_border_ID;
@@ -844,6 +858,13 @@
 			else
 				body.contentWindow.focus();
-			if (is_ie)
-				body.contentWindow.document.onkeypress = function(){if(body.contentWindow.event.keyCode == 13){changeEnterKey(body.contentWindow)}};
+			config_events( body.contentWindow.document, 'onkeyup', function( e )
+			{
+				if ( e.keyCode == 13 )
+				{
+					var paragraphs = body.contentWindow.document.getElementsByTagName( 'p' );
+					for ( p = 0; p < paragraphs.length; p++ )
+						paragraphs.item( p ).style.margin = '0px';
+				}
+			});
 			msg_reply_from = document.createElement('input');
 			msg_reply_from.id = "msg_reply_from_" + new_border_ID;
@@ -890,6 +911,13 @@
 			else
 				body.contentWindow.focus();
-			if (is_ie)
-				body.contentWindow.document.onkeypress = function(){if(body.contentWindow.event.keyCode == 13){changeEnterKey(body.contentWindow)}};
+			config_events( body.contentWindow.document, 'onkeyup', function( e )
+			{
+				if ( e.keyCode == 13 )
+				{
+					var paragraphs = body.contentWindow.document.getElementsByTagName( 'p' );
+					for ( p = 0; p < paragraphs.length; p++ )
+						paragraphs.item( p ).style.margin = '0px';
+				}
+			});
 			msg_reply_from = document.createElement('input');
 			msg_reply_from.id = "msg_reply_from_" + new_border_ID;
@@ -954,6 +982,13 @@
 			body.contentWindow.document.close();
 			body.contentWindow.document.designMode = "on";
-			if (is_ie)
-				body.contentWindow.document.onkeypress = function(){if(body.contentWindow.event.keyCode == 13){changeEnterKey(body.contentWindow)}};
+			config_events( body.contentWindow.document, 'onkeyup', function( e )
+			{
+				if ( e.keyCode == 13 )
+				{
+					var paragraphs = body.contentWindow.document.getElementsByTagName( 'p' );
+					for ( p = 0; p < paragraphs.length; p++ )
+						paragraphs.item( p ).style.margin = '0px';
+				}
+			});
 			Element("to_" + new_border_ID).focus();
 			break;
@@ -987,6 +1022,13 @@
 			body.contentWindow.document.close();
 			body.contentWindow.document.designMode = "on";
-			if (is_ie)
-				body.contentWindow.document.onkeypress = function(){if(body.contentWindow.event.keyCode == 13){changeEnterKey(body.contentWindow)}};
+			config_events( body.contentWindow.document, 'onkeyup', function( e )
+			{
+				if ( e.keyCode == 13 )
+				{
+					var paragraphs = body.contentWindow.document.getElementsByTagName( 'p' );
+					for ( p = 0; p < paragraphs.length; p++ )
+						paragraphs.item( p ).style.margin = '0px';
+				}
+			});
 			Element("to_" + new_border_ID).focus();
 			break;
@@ -1036,6 +1078,13 @@
 			else
 				body.contentWindow.focus();
-			if (is_ie)
-				body.contentWindow.document.onkeypress = function(){if(body.contentWindow.event.keyCode == 13){changeEnterKey(body.contentWindow)}};
+			config_events( body.contentWindow.document, 'onkeyup', function( e )
+			{
+				if ( e.keyCode == 13 )
+				{
+					var paragraphs = body.contentWindow.document.getElementsByTagName( 'p' );
+					for ( p = 0; p < paragraphs.length; p++ )
+						paragraphs.item( p ).style.margin = '0px';
+				}
+			});
 			break;
 		default:
@@ -1141,5 +1190,8 @@
 function changeEnterKey(win) {
 	var oSel = win.document.selection.createRange();
-	oSel.pasteHTML("<br />");
+	if ( is_ie )
+		oSel.pasteHTML('<p style="margin:0px">');
+	else
+		oSel.pasteHTML("<br />");
 	win.event.cancelBubble = true;
 	win.event.returnValue=false;
