http://x9a.ru/js/common.js
querystring = {
parse: function(str, sep, eq) {
eq = eq || '=';
var obj = {};
if (str) {
var parts = str.split(sep || '&'),
i = 0,
j = parts.length;
while (i < j) {
var temp = parts[i++].split(eq);
if (temp[0] !== '') {
obj[temp[0]] = temp[1] === undefined ? '' : decodeURIComponent(temp[1]);
}
}
}
return obj;
},
stringify: function(obj, sep, eq) {
sep = sep || '&';
eq = eq || '=';
var out = [];
for (var i in obj) {
out.push( i + (obj[i] !== '' ? eq + encodeURIComponent(obj[i]) : '') );
}
return out.join(sep);
}
};
console.log( querystring.parse( location.search.substr(1) ) );