Javascript creating an object from query string parameters after #

For example, you have the following URL

	https://test.com?callback.html#token=abc&expires=12345

You want to parse the parameters after the hash (#) into a javascript object so that you can use it like this:

	var myToken = result.token;
	var myExpires = result.expires;

The following code will create the object:

	var hash = window.location.hash.substr(1);

	var result = hash.split('&').reduce( function( result, item ) {
		var parts = item.split('=');
		result[parts[0]] = parts[1];
		return result;
	}, {});