code: function validateName(var_name) {
          var o = "";
          for (var i = 0; i < var_name.length; i++) {
              var code = var_name.charCodeAt(i);
              if ((code > 47 && code < 58) || // numeric (0-9)
                  (code > 64 && code < 91) || // upper alpha (A-Z)
                  (code > 96 && code < 123) || // lower alpha (a-z)
                  var_name[i] === "$" ||
                  var_name[i] === "_" ||
                  var_name[i] === "." ||
                  var_name[i] === "&" ||
                  code > 255 // utf
                  ) {
                  o += var_name[i];
              } else {
                  o += "_$" + code + "_";
              }
          }
          if (!isNaN(o[0])) o =  "_" + o ; // first letter is number, add _ ahead.
          return o;
      }
docs: validate variable name.