function XParser()
{
	this.deserializeString = function(s)
	{
		var object		= new Object();		// Creates a new object
		var nameVal		= null;				// Holds array for a single name-value pair
		var string		= s;				// string to deserialize
		var separator	= ",";				// Character used to separate multiple values

		// If the value being passed in is the location.search information it contains a question mark we need to get rid of
		if (string.charAt(0) == "?")
		{
			// Removes "?" character from query string.
			string = string.substring(1, string.length);
		}

		// Separates string into name-value pairs.
		var keypairs = string.split("&");
		
		// Loops through name-value pairs.
		for (var i=0; i < keypairs.length; i++)
		{
			// Splits name-value into array (nameVal[0]=name, nameVal[1]=value).
			nameVal = keypairs[i].split("=");

			// Replaces "+" characters with spaces and then unescapes name-value pair.
			for (a in nameVal) nameVal[a] = unescape(nameVal[a]);

			// Checks to see if name already exists in the object
			// (since select lists may contain multiple values).
			if (object[nameVal[0]]) object[nameVal[0]] += separator + nameVal[1];
			else object[nameVal[0]] = nameVal[1];
		}
		return object;
	};
	
	this.extractToNamedObjects = function(node)
	{
		var retVal;
		var nodeName = "";
		var nodeValue = "";

		// If this is an Element node
		if (node.nodeType == 1)
		{
			var o = new Object();
			for (var c = node.firstChild; c != null; c = c.nextSibling)
			{
				if (c.nodeType == 1)
				{
					nodeName	= c.getAttribute("Name")? c.getAttribute("Name"): c.nodeName;
					nodeValue	= extractToNamedObjects(c);
				
					// It is already there, we have to make this into an Array
					if (o[nodeName])
					{
						// If the value is already an Array then we will just add it
						if (o[nodeName].constructor.toString().indexOf("function Array()") != -1)
						{
							o[nodeName].push(nodeValue);
						}
						else
						{
							var newArray = new Array();
							newArray.currentPosition = 0;
							newArray.push(o[nodeName]);
							newArray.push(nodeValue);
							
							o[nodeName] = newArray;
						}
					}
					else
					{
						o[nodeName] = nodeValue;
					}

					retVal = o;
				}
				else if (c.nodeType == 3 || c.nodeType == 4)
				{
					retVal = c.nodeValue;
				}
			}
			
		}
		else if ((child.nodeType == 3) || (child.nodeType == 4)) // Text or CDATA
		{
			retVal = node.nodeValue;
		}

		return retVal;
	};
	
	return this;
}
