Index: /trunk/expressoMail1_2/inc/class.imap_functions.inc.php
===================================================================
--- /trunk/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 2844)
+++ /trunk/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 2853)
@@ -219,4 +219,13 @@
 		$head_array['attachment'] = $imap_attachment->get_attachment_headerinfo($this->mbox, $msg_number);
 
+		if($head_array['ContentType'] =='normal') return $head_array;
+
+                include_once("class.message_components.inc.php");
+		$msg = &new message_components($this->mbox);
+		$msg->fetch_structure($msg_number);
+		if(!$this->has_cid)
+		{
+			$head_array['signature'] = $this->get_signature($msg,$msg_number,$this->mbox);
+		}
 		return $head_array;
 	}
@@ -1277,6 +1286,4 @@
 		{
             $sign = array();
-			$temp = $this->get_info_head_msg($msg_number);
-			if($temp['ContentType'] =='normal') return $sign;
 			$file_type = strtolower($file_type);
 			if(strtolower($msg->encoding[$msg_number][$index]) == 'base64')
Index: /trunk/expressoMail1_2/js/jscode/draw_messages.js
===================================================================
--- /trunk/expressoMail1_2/js/jscode/draw_messages.js	(revision 2839)
+++ /trunk/expressoMail1_2/js/jscode/draw_messages.js	(revision 2853)
@@ -39,5 +39,5 @@
 		tbody_message_others_options.appendChild(appendChilds(tr111, td111, sender, sender_values));
 	}
-
+        
 	var from = createAndSet('TD',['id','class'],["from_"+this.id,"header_message_field"],info_msg.from.full);
 
@@ -50,4 +50,19 @@
 	appendChilds(tr1,td1,from,from_values,local_message);
 
+        if(typeof(info_msg.signature) != 'undefined'){
+            if(info_msg.signature.length > 0){
+                var aux_signature = '';
+                for (i=0; i < info_msg.signature.length; i++)
+                   aux_signature += '<span>'+info_msg.signature[i]+'</span> <br /> ';
+                var tr7 = document.createElement("TR");
+                tr7.className = "tr_message_header";
+                var td7 = document.createElement("TD");
+                td7.innerHTML = 'Assinatura<br/>Digital:';
+                td7.vAlign = 'top';
+                var _certs = createAndSet('TD',['id', 'class'],["certs_"+this.id, "header_message_field"],aux_signature);
+                tbody_message_others_options.appendChild(appendChilds(tr7,td7,_certs));
+            }
+        }
+        
 	if (info_msg.reply_to){
 		var tr11 = document.createElement("TR");
@@ -320,12 +335,12 @@
 		td.innerHTML += "&nbsp<img style='cursor:pointer' onclick='javascript:Element(\"option_hide_more_"+id+"\").onclick()' src ='" + URL_SERVER + "expressoMail1_2/templates/"+template+"/images/clip.gif' title='"+info_msg.attachment.names+"'>";
 
-	if (typeof(info_msg.signature) == 'string')
-	{
-		if (info_msg.signature != "void")
-			td.innerHTML += '&nbsp;<img style="cursor:pointer" onclick="alert(\''+ get_lang("This message is signed, and you can trust.") + info_msg.signature +'\');" src="' + URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/signed.gif">';
-		else
-			td.innerHTML += "&nbsp;<img style='cursor:pointer' onclick='alert(\""+get_lang("This message is signed, but it is invalid. You should not trust on it.")+"\");' title='"+get_lang("Voided message")+"' src='" + URL_SERVER + "expressoMail1_2/templates/"+template+"/images/invalid.gif'>";
-	}
-
+	if(typeof(info_msg.signature) != 'undefined')
+            {
+                        if(info_msg.signature[0].indexOf('Message untouched') >= 0)
+                            td.innerHTML += "&nbsp<img style='cursor:pointer' onclick='javascript:Element(\"option_hide_more_"+id+"\").onclick()' src ='" + URL_SERVER + "expressoMail1_2/templates/"+template+"/images/signed_msg.gif' title='"+get_lang("Details")+"'>";
+                        else
+                            td.innerHTML += "&nbsp<img style='cursor:pointer' onclick='javascript:Element(\"option_hide_more_"+id+"\").onclick()' src ='" + URL_SERVER + "expressoMail1_2/templates/"+template+"/images/invalid.gif' title='"+get_lang("Details")+"'>";
+            }
+            
 	if (info_msg.DispositionNotificationTo)
 	{
@@ -440,8 +455,9 @@
 		tr0.appendChild(td0);
 		tbody_message.appendChild(tr0);
-                if (info_msg.signature && info_msg.signature.length > 0)
-		{
-			tbody_message.appendChild(putSignature(this.id,info_msg,td));
-		}
+                //if (info_msg.signature && info_msg.signature.length > 0)
+		//{
+			//tbody_message.appendChild(draw_msg.putSignature(this.id,info_msg,td));
+                        //alert(info_msg.signature);
+		//}
 	}
 	else 	// IF DRAFT
@@ -628,53 +644,4 @@
     return to_addybook_add;
 };
-
-
-draw_message.prototype.show_signature_certificate_data = function(){
-	var _height = Element("div_message_scroll_"+this.id).style.height;
-	_height = parseInt(_height.replace("px",""));
-	var _offset = 130;
-	if (this.value == 'more_cert'){
-		//this.innerHTML += "<b><u>Mais InformaÃ¯Â¿ÅÃ¯Â¿Åes</u></b>";
-		this.value = 'hide_cert';
-		Element("div_message_scroll_"+this.id).style.height = (_height + _offset)+"px";
-		Element('tr_signature_'+this.id).style.display = 'none';
-		Element('td_signature_'+this.id).style.display = 'none';
-
-	}
-	else{
-		//this.innerHTML += "Mais InformaÃ¯Â¿ÅÃ¯Â¿Åes";
-		this.value = 'more_cert';
-		Element("div_message_scroll_"+this.id).style.height = (_height - _offset)+"px";
-		Element('tr_signature_'+this.id).style.display = '';
-		Element('td_signature_'+this.id).style.display = '';
-	}
-};
-
-draw_message.prototype.putSignature = function(info_msg,tdx){
-        var tr_signature = document.createElement("TR");
-        var td_signature = document.createElement("TD");
-        td_signature.className = 'tr_message_header';
-        tr_signature.id = 'tr_signature_'+this.id;
-        td_signature.colSpan = "5";
-        tr_signature.style.display = 'none';
-
-        for (i=0; i < info_msg.signature.length; i++)
-                td_signature.innerHTML += '<span>'+info_msg.signature[i]+'</span> <br /> ';
-        td_signature.innerHTML += '<hr></hr>';
-        var signature_status_pos = info_msg.signature[0].indexOf('Message untouched');
-        td_signature.id = "td_signature_"+this.id;
-        if(signature_status_pos < 0 )
-        {
-                tdx.innerHTML += '&nbsp;<img style="cursor:pointer" src="' + URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/signed_error.gif" title="'+get_lang("Details")+'" onclick="show_signature_certificate_data(\'' + this.id + '\')">';
-                tr_signature.style.display = '';
-        }
-        else
-        {
-                tdx.innerHTML += '&nbsp;<img style="cursor:pointer" src="' + URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/signed_table.gif" title="'+get_lang("Details")+'" onclick="show_signature_certificate_data(\'' + this.id + '\')">';
-        }
-        tr_signature.appendChild(td_signature);
-        return tr_signature;
-    };
-
 
 draw_message.prototype.getThumbs = function(attachments, thumbs, msg_number, msg_folder){
