// --------------------------------------------------------------------------------------------
//
//	JavaScript file defining an object for the parsing of a URL into URL variables
//	
//	designed by Logical Imagination, LLC
//	www.LogicalImagination.com
//	Copyright © 2007, All Rights Reserved
//
// --------------------------------------------------------------------------------------------

//constructor for a Name/Value pair object
function NameValuePair(name, value)
{
	this.Name = name;
	this.Value = value;
}



function LIURLParser(URL)
{
	this.URLVariables = new Array();
	
	//parse the URL
	var step1 = URL.split("?");
	
	if (step1[1] != null && step1[1] != "")
	{
		var step2 = step1[1].split("&");
		var i;
		for (i=0;i<step2.length;i++)
		{
			var item = step2[i].split("=");
			var pair = new NameValuePair(item[0], item[1]);
			this.URLVariables[this.URLVariables.length] = pair;
		}
	}
	
}

LIURLParser.prototype.GetValue = function(name)
{
	var i;
	for (i=0;i<this.URLVariables.length;i++)
	{
		var pair = this.URLVariables[i];
		if (pair.Name == name)
		{
			return pair.Value;
		}
	}
	return null;
};




