diff --git a/expressoMail1_2/inc/class.imap_functions.inc.php b/expressoMail1_2/inc/class.imap_functions.inc.php
index 2c39b83..4febff4 100755
--- a/expressoMail1_2/inc/class.imap_functions.inc.php
+++ b/expressoMail1_2/inc/class.imap_functions.inc.php
@@ -1502,12 +1502,12 @@ class imap_functions
 
 		// Layout problem: Change html elements
 		// with absolute position to relate position, CASE INSENSITIVE.
-                $body = str_replace("\x00", '', $body);
-                $body = @mb_eregi_replace("POSITION: ABSOLUTE;","",$body);
+        $body = str_replace("\x00", '', $body);
+        $body = @mb_eregi_replace("POSITION: ABSOLUTE;","",$body);
 
-		$tag_list = Array('head','blink','object','frame',
+		$tag_list = array('blink','object','frame',
 			'iframe','layer','ilayer','plaintext','script','base',
-			'applet','embed','frameset','xml','xmp','style');
+			'applet','embed','frameset','xml','xmp');
 
 		$blocked_tags = array();
 		foreach($tag_list as $index => $tag) {
diff --git a/expressoMail1_2/js/draw_api.js b/expressoMail1_2/js/draw_api.js
index db85238..52751ac 100755
--- a/expressoMail1_2/js/draw_api.js
+++ b/expressoMail1_2/js/draw_api.js
@@ -2017,20 +2017,21 @@ function draw_message(info_msg, ID){
 	//td.setAttribute("colSpan","2");
 	newBody = newBody.replace("<body","<span");
 	newBody = newBody.replace("<BODY","<span");
-	while ( ( /<span[^>]*><span[^>]*>/ig ).test( newBody ) )
+	while ( ( /<span[^>]*><span[^>]*>/ig ).test( newBody ) ){
 		newBody = newBody.replace( /(<span[^>]*>)<span[^>]*>/ig, '$1' );
+	}
 
-	var _body = document.createElement( 'div' );
-	_body.id = 'body_' + ID;
-	_body.innerHTML = newBody;
-	_body.style.fontSize = '16px';
+	var bodyMessage = $("<iframe/>");
+	bodyMessage.attr('id','body_' + ID);
+	bodyMessage.attr('width','100%');
+	bodyMessage.attr('height','100%');
+	bodyMessage.attr('frameborder','0');
 
-	var _elements = _body.getElementsByTagName( '*' );
-	for( var i = 0; i < _elements.length; i++ )
-		if ( _elements[ i ].attributes && _elements[ i ].attributes.getNamedItem( 'id' ) )
-			_elements[ i ].attributes.removeNamedItem( 'id' );
+	bodyMessage.on('load', function(){
+		$(this).contents().find('body').html( newBody );
+	});
 
-	div.appendChild( _body );
+	div.appendChild( $(bodyMessage)[0] );
 
 	function mailto( link )
 	{
diff --git a/expressoMail1_2/js/main.js b/expressoMail1_2/js/main.js
index 646b548..7247a19 100644
--- a/expressoMail1_2/js/main.js
+++ b/expressoMail1_2/js/main.js
@@ -1157,10 +1157,40 @@ function new_message(type, border_ID){
 		data.cco = data.cco.replace(/&lt;/gi,"<");
 		data.cco = data.cco.replace(/&gt;/gi,">");
 	}
-	if (document.getElementById("subject_" + border_ID))
+	if (document.getElementById("subject_" + border_ID)){
 		data.subject = document.getElementById("subject_" + border_ID).innerHTML;
-	if (document.getElementById("body_" + border_ID))
-		data.body = document.getElementById("body_" + border_ID).innerHTML;
+	}
+	
+	if( $("#body_" + border_ID ) ){
+
+		var messageBody = $("#body_" + border_ID).contents().find("html").clone(true);
+
+		// Clean styles
+		$(messageBody).find("style").each( function(){
+			
+			var contentStyle = $(this).html();
+		
+			contentStyle = contentStyle.replace(/\/*/gi, '' );
+			contentStyle = contentStyle.replace(/\*\//gi, '' );
+
+			$(this).html( "/*" + contentStyle + "*/" );
+		});
+
+		// Clean link
+		$(messageBody).find("link").each( function(){
+			
+			var tagLink = $(this);
+
+			$.each( this.attributes, function(){
+				
+				this.value = this.value.replace( /##/gi, '');
+				
+				$(tagLink).attr( this.name, "##" + this.value + "##" );
+			});
+		});
+
+		data.body = $(messageBody).html();
+	}
 
 	if (Element('date_' + border_ID)){
 		data.date = Element('date_' + border_ID).innerHTML;
@@ -1169,11 +1199,14 @@ function new_message(type, border_ID){
 	if (Element('date_day_' + border_ID)){
 		data.date_day = Element('date_day_' + border_ID).value;
 	}
+	
 	if (Element('date_hour_' + border_ID)){
 		data.date_hour = Element('date_hour_' + border_ID).value;
 	}
-	if(typeof(preferences.signature) == 'undefined')
+	
+	if( typeof(preferences.signature) == 'undefined' ){
 		preferences.signature = "";
+	}
 
 	var signature = preferences.type_signature == 'html' ? preferences.signature : preferences.signature.replace(/\n/g, "<br>");
 
@@ -1192,7 +1225,7 @@ function new_message(type, border_ID){
 				body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>" + "<br>" + signature + "</body></html>");
 			}
 			else{
-			body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'></body></html>");
+				body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'></body></html>");
 			}
 			body.contentWindow.document.close();
 			body.contentWindow.document.designMode = "on";
@@ -1227,9 +1260,8 @@ function new_message(type, border_ID){
 			// Insert the signature automaticaly at message body if use_signature preference is set
 			if ( ( !preferences.auto_signature ) && preferences.use_signature == "1") {
 				body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>" + "<br>" + signature + "</body></html>" + block_quoted_body + "</body></html>");
-			}
-			else {
-			body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>"+block_quoted_body+"</body></html>");
+			} else {
+				body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>"+block_quoted_body+"</body></html>");
 			}
 			body.contentWindow.document.close();
 			body.contentWindow.document.designMode = "on";
@@ -1280,9 +1312,8 @@ function new_message(type, border_ID){
 			// Insert the signature automaticaly at message body if use_signature preference is set
 			if ( ( !preferences.auto_signature ) && preferences.use_signature == "1") {
 				body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>" + "<br>" + signature + "</body></html>");
-			}
-			else {
-			body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'></body></html>");
+			} else {
+				body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'></body></html>");
 			}
 			body.contentWindow.document.close();
 			body.contentWindow.document.designMode = "on";
@@ -1310,15 +1341,16 @@ function new_message(type, border_ID){
 			// delete user email from to_all array.
 			data.to_all = new Array();
 			var j = 0;
-				for(i = 0; i < _array_to_all.length; i++) {
-				if(_array_to_all[i].lastIndexOf(Element("user_email").value) == "-1"){
-					data.to_all[j++] = _array_to_all[i];
-				}
-		}
-			if (data.to_all != get_lang("undisclosed-recipient"))
+            for(i = 0; i < _array_to_all.length; i++) {
+                if(_array_to_all[i].lastIndexOf(Element("user_email").value) == "-1"){
+                    data.to_all[j++] = _array_to_all[i];
+                }
+            }
+			if (data.to_all != get_lang("undisclosed-recipient")){
 				data.to_all = data.to_all.join(",");
-			else
+			} else {
 				data.to_all = "";
+			}
 			title = "Re: " + data.subject;
 			Element("to_" + new_border_ID).value = data.to;
 			Element("to_" + new_border_ID).value += ', ' + data.to_all;
@@ -1336,17 +1368,17 @@ function new_message(type, border_ID){
 			// Insert the signature automaticaly at message body if use_signature preference is set
 			if ( ( !preferences.auto_signature ) && preferences.use_signature == "1") {
 				body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>" + "<br>" + signature + "</body></html>" + block_quoted_body + "</body></html>");
-			}
-			else {
-			body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>"+block_quoted_body+"</body></html>");
+			} else {
+                body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>"+block_quoted_body+"</body></html>");
 			}
 			body.contentWindow.document.close();
 			body.contentWindow.document.designMode = "on";
 			//Focus
-			if (is_ie)
-				window.setTimeout('document.getElementById("body_'+new_border_ID+'").contentWindow.focus();', 300);
-			else
-				body.contentWindow.focus();
+			if (is_ie){
+                window.setTimeout('document.getElementById("body_'+new_border_ID+'").contentWindow.focus();', 300);
+			} else {
+                body.contentWindow.focus();
+			}
 			config_events( body.contentWindow.document, 'onkeyup', function( e )
 			{
 				if ( e.keyCode == 13 )
@@ -1422,9 +1454,8 @@ function new_message(type, border_ID){
 			// Insert the signature automaticaly at message body if use_signature preference is set
 			if ( ( !preferences.auto_signature ) && preferences.use_signature == "1") {
 				body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>" + "<br>" + signature + "</body></html>" + make_forward_body(data.body, data.to, data.date, data.subject, data.to_all, data.cc) + "</body></html>");
-			}
-			else {
-			body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>"+make_forward_body(data.body, data.to, data.date, data.subject, data.to_all, data.cc)+"</body></html>");
+			} else {
+                body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>"+make_forward_body(data.body, data.to, data.date, data.subject, data.to_all, data.cc)+"</body></html>");
 			}
 			body.contentWindow.document.close();
 			body.contentWindow.document.designMode = "on";
@@ -1468,9 +1499,8 @@ function new_message(type, border_ID){
 			// Insert the signature automaticaly at message body if use_signature preference is set
 			if ( ( !preferences.auto_signature ) && preferences.use_signature == "1") {
 				body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'>" + "<br>" + signature + "</body></html>");
-			}
-			else {
-			body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'></body></html>");
+			} else {
+                body.contentWindow.document.write("<html><body bgcolor='#FFFFFF'></body></html>");
 			}
 			body.contentWindow.document.close();
 			body.contentWindow.document.designMode = "on";
@@ -2428,12 +2458,12 @@ function print_msg(msg_folder, msg_number, border_ID){
 	var date                = Element('date_'+border_ID);
 	var subject             = Element('subject_'+border_ID);
 	var attachments         = Element('attachments_'+border_ID);
-	var body                = Element('body_'+border_ID);
-	
+	var body                = $('#body_'+border_ID).contents().find("html");
+
 	if(!is_ie)
 	{
 		var link = location.href.replace(/\/expressoMail1_2\/(.*)/, "");
-		var tab_tags = body.getElementsByTagName("IMG");
+		var tab_tags = $(body)[0].getElementsByTagName("IMG");
 		for(var i = 0; i < tab_tags.length;i++)
 		{
 			var _img = document.createElement("IMG");
@@ -2505,7 +2535,7 @@ function print_msg(msg_folder, msg_number, border_ID){
 			html += "<tr><td width=7%><font size='2'>" + get_lang('Subject')+ ": </font></td><td><font size='2'>"+subject.innerHTML+"</font></td></tr>";
 			html += show_attachs; //to show the names of the attachments
 			html += "</tbody></table><hr>";
-			window_print.document.write(html + body.innerHTML);
+			window_print.document.write(html + $(body).html() );
 			if(!is_ie){
 				var tab_tags = window_print.document.getElementsByTagName("IMG");
 				for(var i = 0; i < tab_tags.length;i++)
diff --git a/expressoMail1_2/js/rich_text_editor.js b/expressoMail1_2/js/rich_text_editor.js
index d2320c8..b6ad2e3 100755
--- a/expressoMail1_2/js/rich_text_editor.js
+++ b/expressoMail1_2/js/rich_text_editor.js
@@ -34,50 +34,63 @@ cRichTextEditor.prototype.loadEditor = function(ID) {
 	document.getElementById('fontsize').selectedIndex = 0;
 }
 
-cRichTextEditor.prototype.createElementEditor = function(pObj)
-{
-		iframe = document.createElement("IFRAME");
-		iframe.id = pObj;
-		iframe.name = pObj;
-		iframe.width = "100%";
-		iframe.height = 300;
-		iframe.setAttribute("unselectable","on");
-		iframe.setAttribute("tabIndex","1");
-		iframe.setAttribute( 'frameborder', '0' );
-
-		config_events( iframe, 'onload', function( )
-		{
-			if ( iframe.contentWindow.document.body && iframe.contentWindow.document.body.contentEditable ) {
-				
-				if(mobile_device)
-					iframe.contentWindow.document.body.contentEditable = true;
-				else
-					iframe.contentWindow.document.designMode = "on";
-			}
-			
-			if ( iframe.contentWindow.document.documentElement ){
-				iframe.contentWindow.document.documentElement.style.background = '#fff';
-				iframe.contentWindow.document.documentElement.style.fontSize = '16px';
+cRichTextEditor.prototype.createElementEditor = function (pObj) {
+
+	var IDEditor = this.id;
+
+	var iframe = $("<iframe/>")
+	iframe.attr('id', pObj);
+	iframe.attr('name', pObj);
+	iframe.attr('width', "100%");
+	iframe.attr('unselectable', 'on');
+	iframe.attr('tabIndex', '1');
+	iframe.attr('frameborder', '0');
+
+	var resizeIframe = function(){
+
+		var idTag = 'div_message_scroll_' + IDEditor;
+		var heightIframe = parseFloat($("div[id=" + idTag + "]").height() * 0.69);
+		iframe.attr('height', heightIframe);
+	};
+
+	config_events($(iframe)[0], 'onload', function () {
+		if ($(iframe)[0].contentWindow.document.body && $(iframe)[0].contentWindow.document.body.contentEditable) {
+			if (mobile_device) {
+				$(iframe)[0].contentWindow.document.body.contentEditable = true;
+			} else {
+				$(iframe)[0].contentWindow.document.designMode = "on";
 			}
-		});
-
-		var div_iframe = $('<div style="border: 2px solid; border-color: #111 #b2b2c1 #b2b2c1 #111;">').append( iframe );
-		if ( preferences.auto_signature ) div_iframe.append( $('<iframe id="signature_ro_'+this.id+'" width="100%" frameborder="0">') );
-		parentDiv.appendChild( div_iframe[0] );
-
-		var source = document.createElement( 'input' );
-		source.id = 'viewsource_rt_checkbox_' + this.id;
-		source.type = "checkbox";
-		source.setAttribute("tabIndex","-1");
-		source.onclick = function( )
-		{
-			RichTextEditor.viewsource(this.checked);
-		};
-		source = parentDiv.appendChild(
-			document.createElement( 'span' ).appendChild( source ).parentNode
-		).appendChild(
-			document.createTextNode( get_lang( 'View HTML source' ) + '.' )
-		).parentNode;
+		}
+
+		if ($(iframe)[0].contentWindow.document.documentElement) {
+			$(iframe)[0].contentWindow.document.documentElement.style.background = '#fff';
+			$(iframe)[0].contentWindow.document.documentElement.style.fontSize = '16px';
+		}
+
+		resizeIframe();
+
+	});
+
+	var div_iframe = $('<div style="border: 2px solid; border-color: #111 #b2b2c1 #b2b2c1 #111;">').append($(iframe)[0]);
+
+	if (preferences.auto_signature) { div_iframe.append($('<iframe id="signature_ro_' + this.id + '" width="100%" frameborder="0">')) };
+
+	parentDiv.appendChild(div_iframe[0]);
+
+	$(window).on("resize", function () { resizeIframe(); });
+
+	var source = document.createElement('input');
+	source.id = 'viewsource_rt_checkbox_' + this.id;
+	source.type = "checkbox";
+	source.setAttribute("tabIndex", "-1");
+	source.onclick = function () {
+		RichTextEditor.viewsource(this.checked);
+	};
+	source = parentDiv.appendChild(
+		document.createElement('span').appendChild(source).parentNode
+	).appendChild(
+		document.createTextNode(get_lang('View HTML source') + '.')
+	).parentNode;
 }
 
 cRichTextEditor.prototype.loadStyle = function(tag, css_file) {
