/***************************************/


function mShow() {
	var h = "";
	for (var i=0; i<this._keys.length; i++) {
		h += this._keys[i] + "=" + this._vals[i] + "\n";
	}
	return h;
}

function mGetValue(key) {
	for (var i=0; i<this._keys.length; i++) {
		if (key == this._keys[i]) {
			return this._vals[i];
		}
	}
	return null;
}

function mSetValue(key, value) {
	for (var i=0; i<this._keys.length; i++) {
		if (key == this._keys[i]) {
			this._vals[i] = value;
			return;
		}
	}
	this._keys[this._keys.length] = key;
	this._vals[this._vals.length] = value;
	return;
}

function mKeyExists(key) {
	for (var i=0; i<this._keys.length; i++) {
		if (key == this._keys[i]) {
			return true;
		}
	}
	return false;
}

function mDeleteEntry(key) {
	for (var i=0; i<this._keys.length; i++) {
		if (key == this._keys[i]) {
			this._keys.splice(i,1);
			this._vals.splice(i,1);
			return;
		}
	}
	return;
}

function mInvert() {
	(this._keys).reverse();
	(this._vals).reverse();
	return;
}

function mSort() {
	return;
}

function mCount() {
	return this._keys.length;
}

function mKeys() {
	return this._keys;
}

function mValues() {
	return this._vals;
}

function mIsEmpty() {
	if (this._keys.length > 0) {
	  return false;
	}
	else {
	  return true;
	}
}



function Hash() {
	this._keys = new Array();
	this._vals = new Array();
	var j = 0;
	for (var i=0; i<(arguments.length); i++) {
		if ( (i%2 == 0) && (arguments[i] != 'undefined') ) {
			this._keys[j] = arguments[i];
			this._vals[j] = arguments[i+1];
			//alert(this._keys[j] + ' => ' + this._vals[j] + ' (' + typeof this._vals[j] + ')');
			j++;
		}
	}
	this.show = mShow;
	this.get = mGetValue;
	this.read = mGetValue;
	this.set = mSetValue;
	this.write = mSetValue;
	this.exists = mKeyExists;
	this.add = mSetValue;
	this.del = mDeleteEntry;
	this.rm = mDeleteEntry;
	this.invert = mInvert;
	this.sort = mSort;
	this.count = mCount;
	this.keys = mKeys;
	this.vals = mValues;
	this.isEmpty = mIsEmpty;
}



