Index: /trunk/expressoMail1_2/inc/class.imap_functions.inc.php
===================================================================
--- /trunk/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 2714)
+++ /trunk/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 2715)
@@ -529,29 +529,7 @@
 		}
 
-		$return['Recent']	= $header->Recent;
-		$return['Unseen']	= $header->Unseen;
-		$return['Deleted']	= $header->Deleted;
-		$return['Flagged']	= $header->Flagged;
-
-		if($header->Answered =='A' && $header->Draft == 'X'){
-			$return['Forwarded'] = 'F';
-		}
-
-		else {
-			$return['Answered']	= $header->Answered;
-			$return['Draft']	= $header->Draft;
-		}
 
 		$return['msg_number'] = $msg_number.$plus_id;
 		$return['msg_folder'] = $msg_folder;
-
-		$date_msg = gmdate("d/m/Y",$header->udate);
-		if (date("d/m/Y") == $date_msg)
-			$return['udate'] = gmdate("H:i",$header->udate);
-		else
-			$return['udate'] = $date_msg;
-
-		$return['msg_day'] = $date_msg;
-		$return['msg_hour'] = gmdate("H:i",$header->udate);
 
 		if (date("d/m/Y") == $date_msg) //no dia
@@ -746,11 +724,5 @@
 		$return['reply_to'] = $this->decode_string($return['reply_to']);
 		$return['subject'] = $this->decode_string($header->fetchsubject);
-		$return['Size'] = $header->Size;
-		$return['reply_toaddress'] = $header->reply_toaddress;
-
-		//All this is to help in local messages
-		$return['timestamp'] = $header->udate_original;
-		$return['login'] = $this->account_id;
-		$return['reply_toaddress'] = $header->reply_toaddress;
+
 		return $return;
 	}
Index: /trunk/expressoMail1_2/js/jscode/draw_api_folders.js
===================================================================
--- /trunk/expressoMail1_2/js/jscode/draw_api_folders.js	(revision 2714)
+++ /trunk/expressoMail1_2/js/jscode/draw_api_folders.js	(revision 2715)
@@ -22,4 +22,29 @@
 	    tbody.appendChild(tr);
     }
+}
+
+function draw_header_box(){
+	switch(sort_box_type){
+		case 'SORTFROM':
+			type_name = get_lang("Who");
+			break;
+		case 'SORTSUBJECT':
+			type_name = get_lang("Subject");
+			break;
+		case 'SORTARRIVAL':
+			type_name = get_lang("Date");
+			break;
+		case 'SORTSIZE':
+			type_name = get_lang("Size");
+			break; 
+		default:
+			type_name = get_lang("Date");
+			break;
+	}
+	document.getElementById("message_header_SORTFROM_"+numBox).innerHTML 	= get_lang("Who");
+	document.getElementById("message_header_SORTSUBJECT_"+numBox).innerHTML = get_lang("Subject");
+	document.getElementById("message_header_SORTARRIVAL_"+numBox).innerHTML = get_lang("Date");
+	document.getElementById("message_header_SORTSIZE_"+numBox).innerHTML	= get_lang("Size");	
+	document.getElementById("message_header_"+(sort_box_type.lastIndexOf("SORT") != "-1" ? sort_box_type : "SORTARRIVAL")+"_"+numBox ).innerHTML = "<B>"+type_name+'</B><img src ="' + URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/arrow_'+(sort_box_reverse == 1 ? 'desc' : 'asc')+'endant.gif">';
 }
 
Index: /trunk/expressoMail1_2/js/jscode/main.js
===================================================================
--- /trunk/expressoMail1_2/js/jscode/main.js	(revision 2714)
+++ /trunk/expressoMail1_2/js/jscode/main.js	(revision 2715)
@@ -344,5 +344,5 @@
 		if(currentTab)
 		{
-			draw_message(msg_info,currentTab);
+			draw_msg.draw_message_body(msg_info,currentTab);
 			var unseen_sort = document.getElementById('span_flag_UNSEEN').getAttribute('onclick');
 			unseen_sort = unseen_sort.toString();
Index: /trunk/expressoMail1_2/js/jscode/messages_controller.js
===================================================================
--- /trunk/expressoMail1_2/js/jscode/messages_controller.js	(revision 2714)
+++ /trunk/expressoMail1_2/js/jscode/messages_controller.js	(revision 2715)
@@ -38,5 +38,5 @@
 			{
 				openTab.type[currentTab] = 2;
-				draw_message_header(header,currentTab);
+				draw_msg.draw_message_header(header,currentTab);
 			}
 		}
Index: /trunk/expressoMail1_2/js/jscode/draw_api_messages.js
===================================================================
--- /trunk/expressoMail1_2/js/jscode/draw_api_messages.js	(revision 2714)
+++ /trunk/expressoMail1_2/js/jscode/draw_api_messages.js	(revision 2715)
@@ -34,31 +34,8 @@
 var translatedFolders = new Map();
 
-
-function draw_header_box(){
-	switch(sort_box_type){
-		case 'SORTFROM':
-			type_name = get_lang("Who");
-			break;
-		case 'SORTSUBJECT':
-			type_name = get_lang("Subject");
-			break;
-		case 'SORTARRIVAL':
-			type_name = get_lang("Date");
-			break;
-		case 'SORTSIZE':
-			type_name = get_lang("Size");
-			break; 
-		default:
-			type_name = get_lang("Date");
-			break;
-	}
-	document.getElementById("message_header_SORTFROM_"+numBox).innerHTML 	= get_lang("Who");
-	document.getElementById("message_header_SORTSUBJECT_"+numBox).innerHTML = get_lang("Subject");
-	document.getElementById("message_header_SORTARRIVAL_"+numBox).innerHTML = get_lang("Date");
-	document.getElementById("message_header_SORTSIZE_"+numBox).innerHTML	= get_lang("Size");	
-	document.getElementById("message_header_"+(sort_box_type.lastIndexOf("SORT") != "-1" ? sort_box_type : "SORTARRIVAL")+"_"+numBox ).innerHTML = "<B>"+type_name+'</B><img src ="' + URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/arrow_'+(sort_box_reverse == 1 ? 'desc' : 'asc')+'endant.gif">';
+/* Class draw_message */
+function draw_message(){
 }
-
-function createNxtPrevButtons(msg_folder,ID,folder_id){
+draw_message.prototype.createNxtPrevButtons = function(msg_folder,ID,folder_id){
 	var next_previous_msg_td = createAndSet("TD",[ "noWrap", "align", "width" ], [ "true", "right", "40px"]);
 	var img_next_msg = createAndSet("IMG", [ 'id', 'src', 'title' ], [
@@ -165,7 +142,7 @@
 	return next_previous_msg_td;
 
-}
+};
 var idx_cc = 0;
-function draw_plugin_cc(ID, addrs)
+draw_message.prototype.draw_plugin_cc = function(ID, addrs)
 {
     expresso.connector.loadScript("jscode/ccQuickAdd");
@@ -205,8 +182,8 @@
     to_addybook_add += "</SPAN>";
     return to_addybook_add;
-}
-
-
-function show_signature_certificate_data(ID){
+};
+
+
+draw_message.prototype.show_signature_certificate_data = function(ID){
         var _height = Element("div_message_scroll_"+ID).style.height;
         _height = parseInt(_height.replace("px",""));
@@ -227,7 +204,7 @@
                 Element('td_signature_'+ID).style.display = '';
         }
-    }
-
-function putSignature(ID,info_msg,tdx){
+    };
+
+draw_message.prototype.putSignature = function(ID,info_msg,tdx){
         var tr_signature = document.createElement("TR");
         var td_signature = document.createElement("TD");
@@ -253,6 +230,6 @@
         tr_signature.appendChild(td_signature);
         return tr_signature;
-    }
-function make_options_message(info_msg, tbody_message){
+    };
+draw_message.prototype.make_options_message = function(info_msg, tbody_message){
 	var tr0 = document.createElement("TR");
 	tr0.className = "tr_message_header";
@@ -275,5 +252,5 @@
 	}
 
-	var next_previous_msg_td = createNxtPrevButtons(info_msg.msg_folder,ID,folder_id);
+	var next_previous_msg_td = this.createNxtPrevButtons(info_msg.msg_folder,ID,folder_id);
 	if (typeof(next_previous_msg_td) == 'undefined')
 		return false;
@@ -461,7 +438,7 @@
 	}
 	return true;
-}
-
-function draw_message_header(header,border_id){
+};
+
+draw_message.prototype.draw_message_header = function(header,border_id){
 	var defaultWidth = document.body.offsetWidth - 37;
 	if(Element("folderscol").style.display != 'none')
@@ -471,5 +448,5 @@
 	table_message.id = 'table_message_'+border_id;
 	var tbody_message = document.createElement("TBODY");
-	if (!make_options_message(header,tbody_message))
+	if (!this.make_options_message(header,tbody_message))
 		return;
 
@@ -478,8 +455,8 @@
 	content.appendChild(table_message);
 	loading_img = content.appendChild(loading_img);
-}
-
-
-function draw_message(info_msg, ID){
+};
+
+
+draw_message.prototype.draw_message_body = function (info_msg, ID){
 	var defaultWidth = document.body.offsetWidth - 37;
 	if(Element("folderscol").style.display != 'none')
@@ -503,5 +480,5 @@
 		sender.className = "header_message_field";
 		sender.id = "sender_"+ID;
-		sender.innerHTML += draw_plugin_cc(ID, info_msg.sender.full);
+		sender.innerHTML += this.draw_plugin_cc(ID, info_msg.sender.full);
 		var sender_values = createAndSet("INPUT",['id','type','value'],["sender_values_"+ID,"HIDDEN",info_msg.sender.full]);
 
@@ -512,5 +489,5 @@
 
 	if (info_msg.Draft != "X"){
-		from.innerHTML += draw_plugin_cc(ID, info_msg.from);
+		from.innerHTML += this.draw_plugin_cc(ID, info_msg.from);
 		tbody_message_others_options.appendChild(tr1);
 	}
@@ -523,5 +500,5 @@
 		tr11.className = "tr_message_header";
 		var _td11 = createAndSet('TD',['noWrap'],['true'],get_lang("Reply to")+": ");
-		var _reply_to = createAndSet('TD',['id', 'class'],["reply_to_"+ID, "header_message_field"],draw_plugin_cc(ID, info_msg.reply_to));
+		var _reply_to = createAndSet('TD',['id', 'class'],["reply_to_"+ID, "header_message_field"],this.draw_plugin_cc(ID, info_msg.reply_to));
 		var _reply_to_values = createAndSet('INPUT',['id', 'type', 'value'],["reply_to_values_"+ID,"HIDDEN",info_msg.reply_to]);
 		tbody_message_others_options.appendChild(appendChilds(tr11,_td11,_reply_to,_reply_to_values));
@@ -542,10 +519,10 @@
 	toaddress_array[ID] = info_msg.toaddress2.split(",");
 	if (toaddress_array[ID].length > 1){
-		to.innerHTML += draw_plugin_cc(ID, toaddress_array[ID][0]);
+		to.innerHTML += this.draw_plugin_cc(ID, toaddress_array[ID][0]);
 		var _div_toaddrs = createAndSet('SPAN',['id','style'],["div_toaddress_"+ID,'display: inline']," (<a STYLE='color: RED;' onclick=javascript:show_div_address_full('"+ID+"','to');>"+get_lang('more')+"</a>)");
 		to.appendChild(_div_toaddrs);
 	}
 	else {
-		to.innerHTML += draw_plugin_cc(ID,toaddress_array[ID]);
+		to.innerHTML += this.draw_plugin_cc(ID,toaddress_array[ID]);
 	}
 	to.className = "header_message_field";
@@ -565,10 +542,10 @@
 			div_ccaddress.id = "div_ccaddress_"+ID;
 			var div_ccaddress_full = createAndSet("SPAN",['id', 'style'],["div_ccaddress_full_"+ID, "display: inline"]);
-			cc.innerHTML = draw_plugin_cc(ID, ccaddress_array[ID][0]);
+			cc.innerHTML = this.draw_plugin_cc(ID, ccaddress_array[ID][0]);
 			div_ccaddress.innerHTML += " (<a STYLE='color: RED;' onclick=javascript:show_div_address_full('"+ID+"','cc');>"+get_lang('more')+"</a>)";
 			cc.appendChild(div_ccaddress);
 		}
 		else{
-			cc.innerHTML = draw_plugin_cc(ID, info_msg.cc);
+			cc.innerHTML = this.draw_plugin_cc(ID, info_msg.cc);
 		}
 		tbody_message_others_options.appendChild(appendChilds(tr3,td3,cc,cc_values));
@@ -577,5 +554,5 @@
 	if (info_msg.bcc)
 	{
-		tbody_message_others_options.appendChild(getBcc(info_msg.bcc));
+		tbody_message_others_options.appendChild(this.getBcc(info_msg.bcc));
 	}
 
@@ -682,5 +659,5 @@
 	td.colSpan = '2';
 
-	var newBody = blockImage(info_msg,ID,td);
+	var newBody = this.blockImage(info_msg,ID,td);
 
 	td.appendChild(div);
@@ -721,5 +698,5 @@
 		//Make the thumbs of the message.
 		//////////////////////////////////////////////////////////////////////////////////////////////////////
-		div.appendChild(getThumbs(info_msg.attachments, info_msg.thumbs, info_msg.msg_number, info_msg.msg_folder));
+		div.appendChild(this.getThumbs(info_msg.attachments, info_msg.thumbs, info_msg.msg_number, info_msg.msg_folder));
 	}
 
@@ -747,6 +724,7 @@
 	}
 
-}
-function getThumbs(attachments, thumbs, msg_number, msg_folder){
+};
+
+draw_message.prototype.getThumbs = function(attachments, thumbs, msg_number, msg_folder){
 		var table_message_thumbs = document.createElement("TABLE");
 		table_message_thumbs.width = "80%";
@@ -788,7 +766,7 @@
 		table_message_thumbs.appendChild(tbody_message_thumbs);
 		return table_message_thumbs;
-}
-
-function getBcc(bccField){
+};
+
+draw_message.prototype.getBcc = function(bccField){
 	/*
 	 * @AUTHOR Rodrigo Souza dos Santos
@@ -814,5 +792,5 @@
 		 * on a hardcode concept.
 		 */
-		//cco.innerHTML = draw_plugin_cc(ID, ccoaddress_array[ID][0]);
+		//cco.innerHTML = this.draw_plugin_cc(ID, ccoaddress_array[ID][0]);
 		cco.innerHTML = ccoaddress_array[ID][0];
 		div_ccoaddress.innerHTML += " (<a STYLE='color: RED;' onclick=javascript:show_div_address_full('"+ID+"','cco');>"+get_lang('more')+"</a>)";
@@ -825,12 +803,12 @@
 		 * on a hardcode concept.
 		 */
-		//cco.innerHTML = draw_plugin_cc(ID, info_msg.cco);
+		//cco.innerHTML = this.draw_plugin_cc(ID, info_msg.cco);
 		cco.innerHTML = bccField;
 	}
 	cco.className = "header_message_field";
 	return appendChilds(tr3,td3,cco,cco_values);
-}
-
-function blockImage(info_msg,ID,td){
+};
+
+draw_message.prototype.blockImage = function(info_msg,ID,td){
 	var imgTag = info_msg.body.match(/(<img[^>]*src[^>=]*=['"]?[^'">]*["']?[^>]*>)|(<[^>]*(style[^=>]*=['"][^>]*background(-image)?:[^:;>]*url\()[^>]*>)/gi);
 
@@ -877,5 +855,7 @@
 	return newBody;
 
-}
+};
+
+draw_msg = new draw_message();
 
 function changeLinkState(el,state){
@@ -1654,5 +1634,5 @@
 
 		for(var idx = 1 ; idx  < _address.length;idx++) {
-			div_address_full.innerHTML += isOverLimit ?  '<br>'+_address[idx] : ','+draw_plugin_cc(id,_address[idx]);
+			div_address_full.innerHTML += isOverLimit ?  '<br>'+_address[idx] : ','+this.draw_plugin_cc(id,_address[idx]);
 		}		
 		div_address_full.innerHTML += " (<a STYLE='color: RED;' onclick=document.getElementById('div_"+type+"address_full_"+id+"').style.display='none';document.getElementById('div_"+type+"address_"+id+"').style.display='';>"+get_lang('less')+"</a>)";
