Index: /trunk/expressoMail1_2/js/search.js
===================================================================
--- /trunk/expressoMail1_2/js/search.js	(revision 5285)
+++ /trunk/expressoMail1_2/js/search.js	(revision 5444)
@@ -50,28 +50,4 @@
 			div_form_search.appendChild(call_form_search);
 			form_search.appendChild(div_form_search);
-
-                        Calendar._TT['WEEKEND'] = '0,6'; // hack
-                        Calendar._TT['DAY_FIRST'] = 'Mostrar %s primeiro';
-                        Calendar.setup({
-                            inputField  : 'since_date',
-                            button      : 'since_date-trigger',
-                            ifFormat    : '%d/%m/%Y',
-                            daFormat    : '%d/%m/%Y'
-                        });
-
-                        Calendar.setup({
-                            inputField  : 'before_date',
-                            button      : 'before_date-trigger',
-                            ifFormat    : '%d/%m/%Y',
-                            daFormat    : '%d/%m/%Y'
-                        });
-
-                        Calendar.setup({
-                            inputField  : 'on_date',
-                            button      : 'on_date-trigger',
-                            ifFormat    : '%d/%m/%Y',
-                            daFormat    : '%d/%m/%Y'
-                        });
-
 		}
 
@@ -110,5 +86,23 @@
 			EsearchE.func_search(value, null, 'SORTDATE_REVERSE');
 		}
-
+		var dates = $("#since_date, #before_date").datepicker({
+			showOn: "button",
+			buttonImage: "../phpgwapi/templates/default/images/datepopup.gif",
+			buttonImageOnly: true,
+			onSelect: function( selectedDate ) {
+				var option = this.id == "since_date" ? "minDate" : "maxDate",
+					instance = $( this ).data( "datepicker" ),
+					date = $.datepicker.parseDate(
+						instance.settings.dateFormat ||
+						$.datepicker._defaults.dateFormat,
+						selectedDate, instance.settings );
+				dates.not( this ).datepicker( "option", option, date );
+			}
+		});
+		$("#on_date").datepicker({
+			showOn: "button",
+			buttonImage: "../phpgwapi/templates/default/images/datepopup.gif",
+			buttonImageOnly: true
+		});
 	}
 	
@@ -139,13 +133,13 @@
                         + '     <label>'+get_lang("Since Date")+':</label>'
                         + '     <input style="margin-left: 6px;" type="text" id="since_date" size="8" maxlength="10" onkeypress="return dateMask(this, event);">'
-                        + '     <img id="since_date-trigger" src="../phpgwapi/templates/default/images/datepopup.gif" title="'+get_lang("Select Date")+'" style="cursor:pointer; cursor:hand;"/>'
+                        //+ '     <img id="since_date-trigger" src="../phpgwapi/templates/default/images/datepopup.gif" title="'+get_lang("Select Date")+'" style="cursor:pointer; cursor:hand;"/>'
                         + '     <label style="margin-left: 20px;">'+get_lang('Before Date')+':</label>'
                         + '     <input style="margin-left: 6px;" type="text" id="before_date" size="8" maxlength="10" onkeypress="return dateMask(this, event);">'
-                        + '     <img id="before_date-trigger" src="../phpgwapi/templates/default/images/datepopup.gif" title="'+get_lang("Select Date")+'" style="cursor:pointer; cursor:hand;"/>'
+                        //+ '     <img id="before_date-trigger" src="../phpgwapi/templates/default/images/datepopup.gif" title="'+get_lang("Select Date")+'" style="cursor:pointer; cursor:hand;"/>'
                         + '     <br style="margin-bottom:15px"/>'
 
                         + '     <label>'+get_lang('On Date')+':</label>'
                         + '     <input style="margin-left: 6px;" type="text" id="on_date" size="8" maxlength="10" onkeypress="return dateMask(this, event);">'
-                        + '     <img style="margin-right: -8px" id="on_date-trigger" src="../phpgwapi/templates/default/images/datepopup.gif" title="'+get_lang("Select Date")+'" style="cursor:pointer; cursor:hand;"/><span>&nbsp;&nbsp;</span>'
+                        //+ '     <img style="margin-right: -8px" id="on_date-trigger" src="../phpgwapi/templates/default/images/datepopup.gif" title="'+get_lang("Select Date")+'" style="cursor:pointer; cursor:hand;"/><span>&nbsp;&nbsp;</span>'
                         + '     <br style="margin-bottom:30px"/>'
 
@@ -520,5 +514,5 @@
 				{
 					attachNum = parseInt(aux.flag.substr(aux.flag.indexOf('T')+1));
-					td1 = "<img src='templates/"+template+"/images/clip.gif' title='"+attachNum +' '+ get_lang('attachment(s)')+"'>";
+					td1 = "<img src='templates/"+template+"/images/clip.gif'>";
 				}
 				else
@@ -589,5 +583,6 @@
 				td.setAttribute("NoWrap","true");
 									td.style.overflow = "hidden";
-				var td1  =  '<div style="width:100%;overflow:hidden">'+aux.from+"</div>";
+									
+				var td1  =  '<div style="width:100%;overflow:hidden">'+aux.from.name+"</div>";
 			}
 
@@ -1298,42 +1293,42 @@
             {
                 var allMsg 	= [3];
-        	var count  	= ( data['num_msgs'] ) ?  data['num_msgs'] : "0";
-                var tmp		= [];
-
-                // Gears - local
-                if ( local_folders.length > 0 ){
-                    expresso_local_messages.setSortType('SORTDATE');
-                    tmp = expresso_local_messages.search( local_folders, fields );
-                }
-
-                if( data['num_msgs'] )
-                {
-                    allMsg['data'] 		= data['data'];
-                    allMsg['num_msgs']	= data['num_msgs'];
-                }
-
-                if( tmp.length > 0 )
-                {
-                    allMsg['gears_num_msgs'] = tmp.length ;
-                }
-
-        	if( ( data['num_msgs'] ) == 0 )
-                {
-                    alert( get_lang("None result was found.") );
-                }
-                else
-                {
-            	if( (tmp.length > 0) && (!data['num_msgs']) ) 
-                    {
-            		EsearchE.viewLocalMessage();
-                    }
-            	else
-            	{
-					if(count > 0)
-						EsearchE.func_clean();
-                     write_msg( count + " " + get_lang("results found") );
-                    EsearchE.mount_result( allMsg, 'SORTDATE' );
-                }
-            }
+				var count  	= ( data['num_msgs'] ) ?  data['num_msgs'] : "0";
+				var tmp		= [];
+
+				// Gears - local
+				if ( local_folders.length > 0 ){
+					expresso_local_messages.setSortType('SORTDATE');
+					tmp = expresso_local_messages.search( local_folders, fields );
+				}
+
+				if( data['num_msgs'] )
+				{
+					allMsg['data'] 		= data['data'];
+					allMsg['num_msgs']	= data['num_msgs'];
+				}
+
+				if( tmp.length > 0 )
+				{
+					allMsg['gears_num_msgs'] = tmp.length ;
+				}
+
+				if( ( data['num_msgs'] ) == 0 )
+				{
+					alert( get_lang("None result was found.") );
+				}
+				else
+				{
+					if( (tmp.length > 0) && (!data['num_msgs']) ) 
+					{
+						EsearchE.viewLocalMessage();
+					}
+					else
+					{
+						if(count > 0)
+							EsearchE.func_clean();
+						write_msg( count + " " + get_lang("results found") );
+						EsearchE.mount_result( allMsg, 'SORTDATE' );
+					}
+				}
             }
 
@@ -1497,4 +1492,6 @@
 	    EsearchE.all_boxes.splice(0,(EsearchE.all_boxes.length));
 	  	EsearchE.del_mailboxes();
+		$("#since_date, #before_date").datepicker("option", "minDate", "");
+		$("#since_date, #before_date").datepicker("option", "maxDate", "");
 	}
 
@@ -1507,4 +1504,5 @@
 		_this.type = type;
 		_this.searchW['window_search'].close();
+		$("#since_date, #before_date, #on_date").datepicker( "destroy" );
 	}
 	// Monta a janela em tela;
