Index: trunk/expressoMail1_2/js/jscode/draw_api_messages.js
===================================================================
--- trunk/expressoMail1_2/js/jscode/draw_api_messages.js	(revision 2705)
+++ trunk/expressoMail1_2/js/jscode/draw_api_messages.js	(revision 2708)
@@ -215,56 +215,50 @@
 
 
-function getSignature(ID,info_msg){
-			var tr_signature = document.createElement("TR");
-			var td_signature = document.createElement("TD");
-			td_signature.className = 'tr_message_header';
-			tr_signature.id = 'tr_signature_'+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 /> ';
-			var signature_status_pos = info_msg.signature[0].indexOf('Message untouched');
-			td_signature.id = "td_signature_"+ID;
-			if(signature_status_pos < 0 )
-			{
-				td.innerHTML += '&nbsp;<img style="cursor:pointer" src="' + URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/signed_error.gif" title="'+get_lang("Details")+'">';
-				tr_signature.style.display = '';
-			}
-			else
-			{
-				td.innerHTML += '&nbsp;<img style="cursor:pointer" src="' + URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/signed_table.gif" title="'+get_lang("Details")+'">';
-			}
-			td.onclick = function(){
-				var _height = Element("div_message_scroll_"+ID).style.height;
-				_height = parseInt(_height.replace("px",""));
-				var _offset = 130;
-				if (this.value == 'more_cert'){
-					//this.innerHTML += "<b><u>Mais Informacoes</u></b>";
-					this.value = 'hide_cert';
-					Element("div_message_scroll_"+ID).style.height = (_height + _offset)+"px";
-					Element('tr_signature_'+ID).style.display = 'none';
-					Element('td_signature_'+ID).style.display = 'none';
-
-				}
-				else{
-					//this.innerHTML += "Mais Informacoes";
-					this.value = 'more_cert';
-					Element("div_message_scroll_"+ID).style.height = (_height - _offset)+"px";
-					Element('tr_signature_'+ID).style.display = '';
-					Element('td_signature_'+ID).style.display = '';
-				}
-			};
-
-			tr_signature.appendChild(td_signature);
-			return tr_signature;
-			/******************************************* Old signature   ***********************************************/
-			//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="'+tpl_img_path+'/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='"+tpl_img_path+"/invalid.gif'>";
-			/*****************************************															********/
-}
-
+function show_signature_certificate_data(ID){
+        var _height = Element("div_message_scroll_"+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_"+ID).style.height = (_height + _offset)+"px";
+                Element('tr_signature_'+ID).style.display = 'none';
+                Element('td_signature_'+ID).style.display = 'none';
+
+        }
+        else{
+                //this.innerHTML += "Mais InformaÃ¯Â¿ÅÃ¯Â¿Åes";
+                this.value = 'more_cert';
+                Element("div_message_scroll_"+ID).style.height = (_height - _offset)+"px";
+                Element('tr_signature_'+ID).style.display = '';
+                Element('td_signature_'+ID).style.display = '';
+        }
+    }
+
+function putSignature(ID,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_'+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_"+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(\'' + 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(\'' + ID + '\')">';
+        }
+        tr_signature.appendChild(td_signature);
+        return tr_signature;
+    }
 function make_options_message(info_msg, tbody_message){
 	var tr0 = document.createElement("TR");
@@ -428,14 +422,12 @@
 		tbody_message_options.appendChild(_tr_other_options);
 		////////// END OTHER OPTIONS ////////////////
-
-		if (info_msg.signature && info_msg.signature.length > 0)
-		{
-			tbody_message_options.appendChild(getSignature(ID,info_msg));
-		}
-
 		table_message_options.appendChild(tbody_message_options);
 		td0.appendChild(table_message_options);
 		tr0.appendChild(td0);
 		tbody_message.appendChild(tr0);
+                if (info_msg.signature && info_msg.signature.length > 0)
+		{
+			tbody_message.appendChild(putSignature(ID,info_msg,td));
+		}
 	}
 	else 	// IF DRAFT
