Index: /trunk/expressoMail1_2/js/InfoContact.js
===================================================================
--- /trunk/expressoMail1_2/js/InfoContact.js	(revision 1440)
+++ /trunk/expressoMail1_2/js/InfoContact.js	(revision 1445)
@@ -30,6 +30,6 @@
 		this.td = td;
 		clearTimeout(this.timeout);
-		this.timeout = setTimeout("InfoContact.search('"+email+"')",1000);
-	}	
+	}
+	this.timeout = setTimeout("InfoContact.search('"+email+"')",1000);		
 }
 
@@ -69,82 +69,68 @@
 	var _this = this;
 	var card = Element("card_cc");
+	card.style.left = findPosX(this.td) + 20;
+	var y = findPosY(this.td) + 20 - Element("divScrollMain_"+numBox).scrollTop;
+	var w_height = is_ie ? document.body.clientHeight + document.body.scrollTop : window.innerHeight + window.pageYOffset;
+	if(y + 160 > w_height)
+		card.style.top =  y - 160;	
+	else
+		card.style.top = y;		
+	card.style.display = '';
+	var cn = data.cn;
+	if(cn && cn.toString().length > 35)
+		cn = cn.toString().substring(0,30) + "...";
+	
+	var phoneUser = data.telefone;
+	if(preferences.voip_enabled && phoneUser) {
+		phoneUser = "<a title=\""+get_lang("Call to Comercial Number")+"\" href=\"#\" onclick=\"InfoContact.connectVoip('"+phoneUser+"', 'com')\">"+phoneUser+"</a>";
+		if(data.mobile){
+			phoneUser += " / <a title=\""+get_lang("Call to Mobile Number")+"\" href=\"#\" onclick=\"InfoContact.connectVoip('"+data.mobile+"', 'mob')\">"+data.mobile+"</a>";
+		}
+	}
 
-	//if(card.style.display != '')
-	 {
-		card.style.left = findPosX(this.td) + 20;
-		var y = findPosY(this.td) + 20 - Element("divScrollMain_"+numBox).scrollTop;
-		var w_height = is_ie ? document.body.clientHeight + document.body.scrollTop : window.innerHeight + window.pageYOffset;
-		if(y + 160 > w_height)
-			card.style.top =  y - 160;	
-		else
-			card.style.top = y;		
-		card.style.display = '';
-		var cn = data.cn;
-		if(cn && cn.toString().length > 35)
-			cn = cn.toString().substring(0,30) + "...";
-		
-		var phoneUser = data.telefone;
-		if(preferences.voip_enabled && phoneUser) {
-			phoneUser = "<a title=\""+get_lang("Call to Comercial Number")+"\" href=\"#\" onclick=\"InfoContact.connectVoip('"+phoneUser+"', 'com')\">"+phoneUser+"</a>";
-			if(data.mobile){
-				phoneUser += " / <a title=\""+get_lang("Call to Mobile Number")+"\" href=\"#\" onclick=\"InfoContact.connectVoip('"+data.mobile+"', 'mob')\">"+data.mobile+"</a>";
-			}
-		}
-
-		Element("card_cc_td").innerHTML = "<table cellpadding=0 cellspacing=0 border=0 height='100%' width='100%'><tr><td width='70' height='93' style='padding-top:5px;padding-left:6px' align='center' valign='center'>"+
-											"<img src='./inc/show_img.php?email="+data.email+"'></td><td style='padding-left:2px' align='left' valign='top'>"+
-											"<br><img align='center' src='templates/"+template+"/images/"+(data.type)+"_catalog.png'><font size=1 color=BLACK>&nbsp;<b>"+get_lang("Sender's Information")+"</b></font>"+
-											_this.verifyIM(data.uid,data.email)+
-											"<br><img align='center' src='templates/"+template+"/images/phone.gif'>&nbsp;<font  size=1  color=BLACK>"+(phoneUser ? phoneUser : get_lang("None") )+"</font>"+
-											"</td></tr><tr><td valign='top' align='center' colspan='2'>"+
-											"<font size=1 color=BLACK>"+cn+"</font>"+
-											"<br><span title='"+get_lang("Write message")+"' style='cursor:pointer' onclick='InfoContact.sendMail(\""+cn+"\",\""+data.email+"\")'><font size=1 color=DARKBLUE><u>"+data.email+"</u></font></span>"+
-											"</td></tr></table>";
+	Element("card_cc_td").innerHTML = "<table cellpadding=0 cellspacing=0 border=0 height='100%' width='100%'><tr><td width='70' height='93' style='padding-top:5px;padding-left:6px' align='center' valign='center'>"+
+										"<img src='./inc/show_img.php?email="+data.email+"'></td><td style='padding-left:2px' align='left' valign='top'>"+
+										"<br><img align='center' src='templates/"+template+"/images/"+(data.type)+"_catalog.png'><font size=1 color=BLACK>&nbsp;<b>"+get_lang("Sender's Information")+"</b></font>"+
+										_this.verifyIM(data.uid,data.email)+
+										"<br><img align='center' src='templates/"+template+"/images/phone.gif'>&nbsp;<font  size=1  color=BLACK>"+(phoneUser ? phoneUser : get_lang("None") )+"</font>"+
+										"</td></tr><tr><td valign='top' align='center' colspan='2'>"+
+										"<font size=1 color=BLACK>"+cn+"</font>"+
+										"<br><span title='"+get_lang("Write message")+"' style='cursor:pointer' onclick='InfoContact.sendMail(\""+cn+"\",\""+data.email+"\")'><font size=1 color=DARKBLUE><u>"+data.email+"</u></font></span>"+
+										"</td></tr></table>";
 
 
-	this.timeout_hide = setTimeout("InfoContact.hide()",1000);
-	}
+	this.timeout_hide = setTimeout("InfoContact.hide()",1000);	
 }
 
 emInfoContact.prototype.search = function (email){
 	var _this = this;
-	var ldapSearched = false;
+	var trustedDomain = false;
+	//	If "preferences.notification_domains" was setted, then verify if "mail" has a trusted domain.	
+	if (preferences.notification_domains != undefined && preferences.notification_domains != "") {
+		var domains = preferences.notification_domains.split(',');
+		for (var i = 0; i < domains.length; i++) {
+			if (email.toString().match(domains[i]))
+				trustedDomain = true;
+		}
+	}
+	else
+		trustedDomain = true;
+
 	var handler_search = function(data){
-		if(data != null){			
+		if(data != null){
 			_this.show(data);
 		}
-		else if(!ldapSearched) {
-			ldapSearched = true;
-			var domains = '';
-			var blocked = true;
-			if (preferences.notification_domains != undefined && preferences.notification_domains != "")
-				domains = preferences.notification_domains.split(',');
-			for (var i = 0; i < domains.length; i++)
-			{
-				if (email.toString().match(domains[i]))
-					blocked=false;
-			}
-			if (!blocked)
-				cExecute ("$this.ldap_functions.getUserByEmail&email="+email, handler_search);
-			else
-				_this.label(email);
-		}
 		else
-			_this.label(email);
-			
+			_this.label(email);			
 	}
-
-	if(findPosX(_this.td) == 0) {
-		_this.hide();
-		return;
-	}
-
-	handler_search();
-	//cExecute ("$this.db_functions.getUserByEmail&email="+email, handler_search);
+	
+	if (trustedDomain)
+		cExecute ("$this.ldap_functions.getUserByEmail&email="+email, handler_search);
+	else
+		_this.label(email);
 }
 
 emInfoContact.prototype.hide = function(){
 	this.email = "";
-	clearTimeout(this.timeout);
 	if(Element("div_label"))
 		Element("div_label").style.display = 'none';
