//*******************************************************************
// Arguments JavaScript Class Def. & Variable Declaration.
//
//			// (c) 2000-2006 Kappa Solutions Ltd.
//*******************************************************************
//	This class holds member variables corresponding to the
//	arguments in the query string of a document URL. The variables 
//	are created by the constructor.
//*******************************************************************

// Constructor. *****************************************************
function Args() {
	// This constructor method creates member variables for each
	// argument passed in the document URL.

	// Strip the leading q-mark and make an array of the argument
	// name/value pairs...
	var search = unescape(document.location.search.replace(/^\?/, ""));
			// Replace q-mark at begining of string

	var list = search.split("&");
	for (var entry in list) {
		// For each pair, create a member variable and store the
		// value (stripping start and end quotes and plus signs if 
		// neccessary)...
		var pair = list[entry].split("=");
		if (pair.length > 1) {
			this[pair[0]] = pair[1].replace(/\+/g, " ").replace(/^'/, "").replace(/'$/, "");
		}
	}
}
// Get As XML. ******************************************************
Args.prototype.getAsXML = function () {
	var xml = "<ARGS>";
	for (prop in this) {
		if (prop!="getAsXML") {
			xml += "<" + prop + ">" + this[prop] + "</" + prop + ">";
		}
	}
	xml += "</ARGS>";
	return xml;
}
// Declaration. *****************************************************
if (!args) var args = new Args();
