]> dev.renevier.net Git - syj.git/blobdiff - public/js/utils.js
better mobile support
[syj.git] / public / js / utils.js
index 1651b618241ad1ad3e531c5a2a063d7c9c78b279..8936797b79db1080f973fde7d49764eeaa44a1be 100644 (file)
@@ -1,4 +1,4 @@
-/*  This file is part of Syj, Copyright (c) 2010 Arnaud Renevier,
+/*  This file is part of Syj, Copyright (c) 2010-2011 Arnaud Renevier,
     and is published under the AGPL license. */
 
 var CloseBtn = Class.create({
@@ -438,10 +438,16 @@ Element.addMethods('div', {
     },
 
     setMessageStatus: function(div, status) {
-        return div.removeClassName('error').
-                removeClassName('warn').
-                removeClassName('info').
-                removeClassName('success').
-                addClassName(status);
+        $A(["error", "warn", "info", "success", "optional"]).each(function(clname) {
+            div.removeClassName(clname);
+        });
+        if (typeof status === "string") {
+            div.addClassName(status);
+        } else {
+            $A(status).each(function(clname) {
+                div.addClassName(clname);
+            });
+        }
+        return div;
     }
 });