function ArgumentURL() {
	this.leerArgumento = _getArg;
	this.escribirArgumento = _setArg;
	this.quitarArgumento = _removeArg;
	this.toString    = _toString;	//Allows the object to be printed
									//no need to write toString()
	this.argumentos   = new Array();

	// Initiation
	var separator = "&";
	var equalsign = "=";
	
	var str = window.location.search.replace(/%20/g, " ");//sustituye el simbolo %20 de las url's por espacios
	var index = str.indexOf("?"); //comprueba si existe una interrogación y lo almacena
	var sInfo;
	var infoArray = new Array();

	var tmp;
	
	if (index != -1) { //si existe interrogacion
		sInfo = str.substring(index+1,str.length);//guarda la cadena desde la interrogacion
		infoArray = sInfo.split(separator); //crea la matriz con los contenidos separados por "&"
	}

	for (var i=0; i<infoArray.length; i++) { //un bucle para buscar por la matriz de elementos separados por "&"
		tmp = infoArray[i].split(equalsign); //divide los elementos por el signo "="
		if (tmp[0] != "") { //si existen signos "="
			var t = tmp[0]; 
			this.argumentos[tmp[0]] = new Object();
			this.argumentos[tmp[0]].value = tmp[1];
			this.argumentos[tmp[0]].name = tmp[0];
		}
	}

	
	function _toString() {
		var s = "";
		var once = true;
		for (i in this.argumentos) {
			if (once) {
				s += "?";
				once = false;
			}
			s += this.argumentos[i].name;
			s += equalsign;
			s += this.argumentos[i].value;
			s += separator;
		}
		return s.replace(/ /g, "%20");
	}
	
	/*function _getArg(name) {
		if (typeof(this.argumentos[name].name) != "string")
			return null;
		else
			return this.argumentos[name].value;
	}*/
	function _getArg(name) {
		for (var argument in this.argumentos)
			if ( argument == name)
				return this.argumentos[argument].value;
		return null
	}
	
	function _setArg(name,value) {
		this.argumentos[name] = new Object()
		this.argumentos[name].name = name;
		this.argumentos[name].value = value;
	}
	
	function _removeArg(name) {
		this.argumentos[name] = null;
	}
	
	return this;
}
