//create the args global method
jQuery(function($) {
	$.args = {
		names: [],
		
		values: [],
		
		//function to add a value to the array
		add: function(name,value) {
			this.names.push(name);
			this.values.push(value);
		},
		
		//function to clear the array
		clear: function() {
			this.names = [];
			this.values = [];
		},
		
		//function to get a value by its name
		getValue: function(name) {
			//cycle the names array till we find the correct index for the value
			for(var i=0;i<this.names.length;i++) {
				if(this.names[i] == name) {
					return this.values[i];
				}
			}
		},
		
		//function to get a value by its name
		setValue: function(name,value) {
			//cycle the names array till we find the correct index for the value
			for(var i=0;i<this.names.length;i++) {
				if(this.names[i] == name) {
					this.values[i] = value;
				}
			}
		},
		
		//function return the array as a delimited string
		getString: function(delimiter) {
			//ok if we have no delimiter assume its & for the QS
			if(!delimiter)
				delimiter = '&';
			
			var retval = '';
			
			//cycle the names array and build the string
			for(var i=0;i<this.names.length;i++) {
				retval += this.names[i] + '=' + this.values[i] + delimiter;
			}
			
			//no trim the trailing delimiter from the args string
			retval = retval.substr(0,retval.length-1);
			
			//return the build string
			return retval + '';
		}
	}
});

