Index: trunk/expressoMail1_2/js/local_messages.js
===================================================================
--- trunk/expressoMail1_2/js/local_messages.js	(revision 1381)
+++ trunk/expressoMail1_2/js/local_messages.js	(revision 1466)
@@ -9,5 +9,19 @@
 		this.fileSubmitter = null;
 	}
-
+	local_messages.prototype.installGears = function (){
+		temp = confirm(get_lang("To use local messages you have to install google gears. Would you like to install it now?"));
+		if (temp && typeof(preferences.googlegears_url) != 'undefined'){
+			if (is_ie)
+				location.href = preferences.googlegears_url + "/gears.exe";
+			else
+				location.href = preferences.googlegears_url + "/gears.xpi";
+			return false;
+		}
+		if (temp) {
+			location.href = "http://gears.google.com/?action=install&message="+
+				get_lang("To use local messages, install Google Gears")+"&return=" + document.location.href;
+		}
+		else return false;
+	}
 	local_messages.prototype.init_local_messages = function(){
 		if(this.dbGears == null)
@@ -849,5 +863,4 @@
 		
 	}
-
 	local_messages.prototype.update_offline = function(redirect) {
 		this.init_local_messages();
@@ -872,6 +885,5 @@
 				temp = confirm(document.getElementById('lang_gears_redirect').value);
 				if (temp) {
-					location.href = "http://gears.google.com/?action=install&message="+
-					"Para utilizar o recurso de mensagens locais, instale o google gears&return=" + document.location.href;				
+					expresso_local_messages.installGears();
 				}
 				return;
@@ -891,6 +903,5 @@
 				temp = confirm(document.getElementById('lang_gears_redirect').value);
 				if (temp) {
-					location.href = "http://gears.google.com/?action=install&message="+
-					"Para utilizar o recurso de mensagens locais, instale o google gears&return=" + document.location.href;
+					 expresso_local_messages.installGears();
 				}
 				return;
Index: trunk/expressoMail1_2/js/draw_api.js
===================================================================
--- trunk/expressoMail1_2/js/draw_api.js	(revision 1416)
+++ trunk/expressoMail1_2/js/draw_api.js	(revision 1466)
@@ -168,12 +168,6 @@
 		if (preferences.use_local_messages==1 || expresso_offline) {
 			if (!window.google || !google.gears) {
-				temp = confirm(get_lang("To use local messages you have to install google gears. Would you like to be redirected to gears installation page?"));
-				if (temp) {
-					location.href = "http://gears.google.com/?action=install&message="+
-					get_lang("To use local messages, install Google Gears")+"&return=" + document.location.href;
-				}
-				else {
+				if (!expresso_local_messages.installGears())
 					preferences.use_local_messages=0;
-				}
 			}
 			else{
Index: trunk/expressoMail1_2/index.php
===================================================================
--- trunk/expressoMail1_2/index.php	(revision 1290)
+++ trunk/expressoMail1_2/index.php	(revision 1466)
@@ -66,4 +66,5 @@
 	$_SESSION['phpgw_info']['user']['preferences']['expressoMail']['number_of_contacts'] = $current_config['expressoMail_Number_of_dynamic_contacts'] ? $current_config['expressoMail_Number_of_dynamic_contacts'] : "0";
 	$_SESSION['phpgw_info']['user']['preferences']['expressoMail']['notification_domains'] = $current_config['expressoMail_notification_domains'];
+	$_SESSION['phpgw_info']['user']['preferences']['expressoMail']['googlegears_url'] = $current_config['expressoMail_googlegears_url'];	
     $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_assinar_criptografar'] = $GLOBALS['phpgw_info']['server']['use_assinar_criptografar'] ?  $GLOBALS['phpgw_info']['server']['use_assinar_criptografar'] : "0";
     $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_signature_digital_cripto'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature_digital_cripto'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature_digital_cripto'] : "0";
Index: trunk/expressoMail1_2/templates/default/config.tpl
===================================================================
--- trunk/expressoMail1_2/templates/default/config.tpl	(revision 1441)
+++ trunk/expressoMail1_2/templates/default/config.tpl	(revision 1466)
@@ -76,6 +76,12 @@
     <td> 	 	 
     <input size="1" name="newsettings[expressoMail_Max_attachment_size]" value="{value_expressoMail_Max_attachment_size}">&nbsp;Mb
-    </td> 	 	 
-    </tr> 
+    </td>
+    </tr>
+    <tr bgcolor="{row_off}">
+    <td>{lang_googlegears_url}</td>
+    <td>
+    <input size="80" name="newsettings[expressoMail_googlegears_url]" value="{value_expressoMail_googlegears_url}"> 
+    </td>
+    </tr>  
 <!-- END body -->
 <!-- BEGIN footer -->
