Simplify address validation
diff --git a/site/js/dev/ponymail_assign_vars.js b/site/js/dev/ponymail_assign_vars.js
index 1d03dcc..ef2df5e 100644
--- a/site/js/dev/ponymail_assign_vars.js
+++ b/site/js/dev/ponymail_assign_vars.js
@@ -60,7 +60,6 @@
 var pb_refresh = 0
 var treeview_guard = {}
 var mbox_month = null
-var INVALID_MAGIC_MARKER = "$INVALID"
 
 var URL_BASE = pm_config.URLBase ? pm_config.URLBase.replace(/\/+/g, "/") : ""
 
diff --git a/site/js/dev/ponymail_helperfuncs.js b/site/js/dev/ponymail_helperfuncs.js
index 7f38d44..d9514ec 100644
--- a/site/js/dev/ponymail_helperfuncs.js
+++ b/site/js/dev/ponymail_helperfuncs.js
@@ -175,11 +175,11 @@
     return (obj && obj.constructor && obj.constructor == Array)
 }
 
-
-// ML address: only accept valid mailing list IDs
-function validate_address(val) {
-    var m = val.match(/^[-@A-Za-z.0-9]+$/);
-    return m ? m[0] : INVALID_MAGIC_STRING;
+// ML address: only accept valid mailing list name, domain or both
+// return true if the address is valid
+function valid_address(val) {
+    return val.match(/^[-@A-Za-z.0-9]+$/);
 }
+
 // Check for slow URLs every 0.1 seconds
 window.setInterval(checkForSlows, 100)
diff --git a/site/js/dev/ponymail_pagebuilder.js b/site/js/dev/ponymail_pagebuilder.js
index 9a1d4bb..8619aeb 100644
--- a/site/js/dev/ponymail_pagebuilder.js
+++ b/site/js/dev/ponymail_pagebuilder.js
@@ -393,15 +393,13 @@
         xdomain = list.replace(/^.*?@/, "")
     }
     
-    if (list) list = validate_address(list);
-    if (xdomain) xdomain = validate_address(xdomain);
-    
     // If invalid address passed, complain and exit - no need to attempt fetching stats
-    if (list == INVALID_MAGIC_STRING || xdomain == INVALID_MAGIC_STRING) {
+    // N.B. Only check list and xdomain if they are defined
+    if ((list && ! valid_address(list)) || (xdomain && ! valid_address(xdomain))) {
         alert("Invalid mailing list address supplied!");
         return
     }
-    
+
     // Sort lists by usage before we enter here...
     var listnames = []
     if (all_lists[xdomain]) {
diff --git a/site/js/dev/ponymail_trends.js b/site/js/dev/ponymail_trends.js
index 7de7668..69f9e7a 100644
--- a/site/js/dev/ponymail_trends.js
+++ b/site/js/dev/ponymail_trends.js
@@ -287,12 +287,11 @@
     var dspan = a_arr[1]
     var query = a_arr[2]
     
-    list = validate_address(list);
-    if (list == INVALID_MAGIC_STRING) {
+    if (!valid_address(list)) {
         alert("Invalid mailing list address supplied!");
         return
     }
-    
+
     // Try to detect header searches, if present
     var nquery = ""
     if (query && query.length > 0) {
diff --git a/site/js/ponymail.js b/site/js/ponymail.js
index 701be87..80325d0 100644
--- a/site/js/ponymail.js
+++ b/site/js/ponymail.js
@@ -68,7 +68,6 @@
 var pb_refresh = 0
 var treeview_guard = {}
 var mbox_month = null
-var INVALID_MAGIC_MARKER = "$INVALID"
 
 var URL_BASE = pm_config.URLBase ? pm_config.URLBase.replace(/\/+/g, "/") : ""
 
@@ -2321,12 +2320,12 @@
     return (obj && obj.constructor && obj.constructor == Array)
 }
 
-
-// ML address: only accept valid mailing list IDs
-function validate_address(val) {
-    var m = val.match(/^[-@A-Za-z.0-9]+$/);
-    return m ? m[0] : INVALID_MAGIC_STRING;
+// ML address: only accept valid mailing list name, domain or both
+// return true if the address is valid
+function valid_address(val) {
+    return val.match(/^[-@A-Za-z.0-9]+$/);
 }
+
 // Check for slow URLs every 0.1 seconds
 window.setInterval(checkForSlows, 100)
 
@@ -4045,15 +4044,13 @@
         xdomain = list.replace(/^.*?@/, "")
     }
     
-    if (list) list = validate_address(list);
-    if (xdomain) xdomain = validate_address(xdomain);
-    
     // If invalid address passed, complain and exit - no need to attempt fetching stats
-    if (list == INVALID_MAGIC_STRING || xdomain == INVALID_MAGIC_STRING) {
+    // N.B. Only check list and xdomain if they are defined
+    if ((list && ! valid_address(list)) || (xdomain && ! valid_address(xdomain))) {
         alert("Invalid mailing list address supplied!");
         return
     }
-    
+
     // Sort lists by usage before we enter here...
     var listnames = []
     if (all_lists[xdomain]) {
@@ -5091,12 +5088,11 @@
     var dspan = a_arr[1]
     var query = a_arr[2]
     
-    list = validate_address(list);
-    if (list == INVALID_MAGIC_STRING) {
+    if (!valid_address(list)) {
         alert("Invalid mailing list address supplied!");
         return
     }
-    
+
     // Try to detect header searches, if present
     var nquery = ""
     if (query && query.length > 0) {