function ArrayHash()
{
	this.length = 0;
	this.index = new Array();	//maintains a list of all the keys
	this.items = new Array();
	for (var i = 0; i < arguments.length; i += 2) {
		if (typeof(arguments[i + 1]) != 'undefined') {
			this.items[arguments[i]] = arguments[i + 1];
			this.length++;
		}
	}
   
	this.setItem = function(in_key, in_value)
	{	
		var tmp_previous;
		if (typeof(in_value) != 'undefined') {
			if (typeof(this.items[in_key]) == 'undefined') {
				this.length++;
				this.index.push(in_key);
			}
			else {
				tmp_previous = this.items[in_key];
			}

			this.items[in_key] = in_value;
		}
		return tmp_previous;
	}
	
	this.removeItem = function(in_key)
	{
		var tmp_previous;
		if (typeof(this.items[in_key]) != 'undefined') {
			this.length--;
			this.index = jQuery.grep(this.index, function(value) { return value != in_key; });
			var tmp_previous = this.items[in_key];
			delete this.items[in_key];
		}
	   
		return tmp_previous;
	}
	
	this.getItem = function(in_key) {
		return this.items[in_key];
	}

	this.hasItem = function(in_key)
	{
		return typeof(this.items[in_key]) != 'undefined';
	}
	
	this.clear = function()
	{
		for (var i in this.items) {
			delete this.items[i];
		}

		this.length = 0;
	}
	
	this.rename = function(oldKey, newKey)
	{
		this.items[newKey] = this.items[oldKey];//fix data
		this.removeItem(this.items[oldKey]);
		this.index.push(newKey);//and fix index
		this.index = jQuery.grep(this.index, function(value) { return value != oldKey; });
		
	}
	
	this.getIndex = function()
	{
		return this.index;
	}
	
}
scriptLoaded();
