function Url(path)
{
	var pieces 		= path.split("/");
	if (pieces.length<1) return null;
	var protocol	= "";
	var domain		= "";
	var virtual		= path;
	if (path.indexOf("//")>0) 
	{
		protocol 	= pieces[0];
		domain 		= pieces[2];
		virtual		= path.substr(path.indexOf(domain) + domain.length);
	}
	var end 				= pieces[pieces.length-1];
	var file				= "";
	var filename		= "";
	var extension		= "";
	var querystring	= "";
	var dot					= end.lastIndexOf(".");
	var q						= end.lastIndexOf("?");
	if (dot>0)
	{
		file 				= end;
		filename		= file.substr(0, dot);
		extension 	= (q>0) ? file.substr(dot+1, q-1) : file.substr(dot+1);
	}
	if (q>0)
	{
		querystring	= end.substr(q+1);
	}

	this.protocol 		= protocol;
	this.domain 		= domain;
	this.file 			= file;
	this.filename		= filename;
	this.extension 		= extension;
	this.querystring	= querystring;
	this.virtual		= virtual;
	
	return this;
}


// a helper class for creating querystrings
function QueryStringObject()
{
	// the name / value 2-d array
	this.values = [];
	
	// loads values based on the contents of a form
	// form = a reference to the form
	this.loadForm = function(form)
	{
		for (var i=0; i<form.elements.length; i++)
		{
			var element = form.elements[i];
			switch (element.type)
			{
				case "text":
				case "select-one":
				case "hidden":
				case "password":
				case "textarea":
					this.add(element.name, element.value);
					break;
				case "radio":
				case "checkbox":
					if (element.checked) this.add(element.name, element.value);
					break;
				case "select-multiple":
					for (var y=0; y<element.options.length; y++)
					{
						var opt = element.options[y];
						if (opt.selected) this.add(element.name, opt.value);
					}
					break;
			}
		}
	}
	
	// adds an element to the querystring's array
	// name = the name of the element
	// value = the value of the element
	this.add = function(name, value)
	{
		if (typeof(this.values[name]) != "undefined")
		{
			this.values[name][this.values[name].length] = value;
		}
		else
		{
			this.values[name] = [value];
		}
	}
	
	// returns the formatted querystring
	this.toString = function()
	{
		var s = "";
		var first = true;
		for (var name in this.values)
		{
			var values = this.values[name];
			for (var i=0; i<values.length; i++)
			{
				if (!first) s += "&";
				s += name + "=" + escape(values[i]);
				first = false;
			}
		}
		return s;
	}
}