Index: trunk/expressoMail1_2/js/rich_text_editor.js
===================================================================
--- trunk/expressoMail1_2/js/rich_text_editor.js	(revision 5385)
+++ trunk/expressoMail1_2/js/rich_text_editor.js	(revision 5417)
@@ -104,10 +104,10 @@
         
         if(preferences.plain_text_editor == 1)
-            {
-          RichTextEditor.plain[ID] = true;  
-                RichTextEditor.editorReady = true;
-            }
+		{
+			RichTextEditor.plain[ID] = true;  
+			RichTextEditor.editorReady = true;
+		}
         else 
-		  RichTextEditor.active(pObj);
+			RichTextEditor.active(pObj);
 }
 
@@ -264,19 +264,15 @@
 
 cRichTextEditor.prototype.execPosInstance = function(inst) {
-         
-        var editor =  CKEDITOR.instances[inst]; 
+	var editor =  CKEDITOR.instances[inst]; 
+	var id = inst.replace('body_','');
+	editor.document.on('keydown', function(event)
+	{
+		away = false;
+		var save_link = Element("save_message_options_"+id);
+		save_link.onclick = function onclick() {openTab.toPreserve[id] = true;save_msg(id);} ;
+		$("#save_message_options_"+id).button({ disabled: false });
+	});
         
-       
-        var id = inst.replace('body_','');
-        
-        editor.document.on('keydown', function(event)
-        {
-            away = false;
-            var save_link = Element("save_message_options_"+id);
-            save_link.onclick = function onclick() {openTab.toPreserve[id] = true;save_msg(id);} ;
-            save_link.className = 'message_options';
-        });
-        
-        //Adicionando atalhos de preferencias  
+//Adicionando atalhos de preferencias  
 //TODO: Não esta pegando o numero (keycode)
 //        if (preferences.use_shortcuts == '1')
@@ -291,25 +287,41 @@
 	if( window.parent.loadscript && loadscript.autoStatusIM )
 	{
-            CKEDITOR.instances[inst].document.on('keydown', function(event){
-                   loadscript.autoStatusIM;
-            });            	
+		CKEDITOR.instances[inst].document.on('keydown', function(event){
+			loadscript.autoStatusIM;
+		});            	
 	}
         
-        if (preferences.auto_save_draft == 1)
+	if (preferences.auto_save_draft == 1)
 	{
-            openTab.autosave_timer[id] = false;
-            var save_link = document.getElementById("save_message_options"+id);
-            CKEDITOR.instances[inst].document.on('keydown', function(event){
-               if (openTab.autosave_timer[id])
-                    clearTimeout(openTab.autosave_timer[id]);
-               openTab.autosave_timer[id] = setTimeout("save_msg("+id+")", autosave_time);
-                        
-            });  
-        }
-        /////////////////////////////////////////////////////////////////////////////////////
-        
-   
-       
-       RichTextEditor.editorReady = true;
+		openTab.autosave_timer[id] = false;
+		var save_link = document.getElementById("save_message_options"+id);
+		CKEDITOR.instances[inst].document.on('keydown', function(event){
+		   if (openTab.autosave_timer[id])
+				clearTimeout(openTab.autosave_timer[id]);
+		   openTab.autosave_timer[id] = setTimeout("save_msg("+id+")", autosave_time);
+					
+		});  
+	}
+	
+	/*var rich_button = document.createElement("a");
+	//rich_button.className = "button small";
+	rich_button.name = "textplain_rt_checkbox_"+id;
+	rich_button.innerHTML = get_lang('Simple text mode')+" >>";
+	rich_button.href = "#";
+	rich_button.onclick = function (){
+		var check = $("#"+$(this).attr("name")).attr("checked");
+		$("#"+$(this).attr("name")).attr("checked", (!check ? true : false));
+		$("#"+$(this).attr("name")).trigger('click');
+		//RichTextEditor.setPlain($("#"+$(this).attr("name")).attr("checked"), id);
+	};
+	if($("#cke_top_body_"+id).find(".cke_toolbar:last"))
+	$("#cke_top_body_"+id).find(".cke_toolbar:last").append("<span class='button small'></span>");
+	$("#cke_top_body_"+id).find("span:last").append(rich_button);
+	$("#cke_top_body_"+id).attr("colSpan", "2");
+	$("#cke_contents_body_"+id).attr("colSpan", "2");
+	$("#cke_bottom_body_"+id).attr("colSpan", "2");*/
+	$(".cke_editor").css("white-space", "normal");
+	
+	RichTextEditor.editorReady = true;
 }
 cRichTextEditor.prototype.setPlain = function (active,id){
@@ -325,10 +337,11 @@
                 var save_link = Element("save_message_options_"+id);
                 save_link.onclick = function onclick() {openTab.toPreserve[id] = true;save_msg(id);} ;
-                save_link.className = 'message_options';
+				$("#save_message_options_"+id).button({ disabled: false });
+                //save_link.className = 'message_options';
             });
-
+			$("[name=textplain_rt_checkbox_"+id+"]").button({ disabled: false });
       }   
       else
-          RichTextEditor.active('body_'+id);
+          RichTextEditor.active('body_'+id, id);
 }
 
@@ -412,5 +425,5 @@
              CKEDITOR.remove(CKEDITOR.instances[id]);
 }
-cRichTextEditor.prototype.active = function(id)
+cRichTextEditor.prototype.active = function(id, just_id)
 {
    
@@ -428,5 +441,5 @@
               height: height
           }); 
-
+	$("[name=textplain_rt_checkbox_"+just_id+"]").button({ disabled: false });
 }
 cRichTextEditor.prototype.focus = function(id)
