function StringUtil() {}

StringUtil.prototype.parseQuery = StringUtil_parseQuery;

function StringUtil_parseQuery(urlString, supressSpaces) {
  var PARAMS_MAP = {};
  separator = ',';
  query = '' + urlString;
  query = query.substring((query.indexOf('?')) + 1);

  if (query.length < 1) { return false; }  // Perhaps we got some bad data?
  keypairs = {};
  numKP = 1;
    // Local vars used to store and keep track of name/value pairs
    // as we parse them back into a usable form.
  while (query.indexOf('&') > -1) {
    keypairs[numKP] = query.substring(0,query.indexOf('&'));
    query = query.substring((query.indexOf('&')) + 1);
    numKP++;
      // Split the query string at each '&', storing the left-hand side
      // of the split in a new keypairs[] holder, and chopping the query
      // so that it gets the value of the right-hand string.
  }
  keypairs[numKP] = query;
    // Store what's left in the query string as the final keypairs[] data.<
  for (i in keypairs) {
    keyName = keypairs[i].substring(0,keypairs[i].indexOf('='));
      // Left of '=' is name.
    keyValue = keypairs[i].substring((keypairs[i].indexOf('=')) + 1);
      // Right of '=' is value.

    if (!supressSpaces) {
      while (keyValue.indexOf('+') > -1) {
        keyValue = keyValue.substring(0,keyValue.indexOf('+')) + ' ' + keyValue.substring(keyValue.indexOf('+') + 1);
        // Replace each '+' in data string with a space.
      }
    }
    keyValue = unescape(keyValue);
      // Unescape non-alphanumerics
    if (PARAMS_MAP[keyName]) {
      PARAMS_MAP[keyName] = PARAMS_MAP[keyName] + separator + keyValue;
        // Object already exists, it is probably a multi-select input,
        // and we need to generate a separator-delimited string
        // by appending to what we already have stored.
    } else {
      PARAMS_MAP[keyName] = keyValue;
        // Normal case: name gets value.
    }
  }
  return PARAMS_MAP;
}
