	function CMap(unique)
	{
		this.mUnique=(!unique)?false:true;
		this.mKeys=new CList();
		this.mValues=new CList();
	}
	CMap.prototype._addPair= function(key,val) {
		var idx=this.mKeys.getLength();
		this.mKeys.insertAt(key,idx);
		this.mValues.insertAt(val,idx);
		return idx;
	}
	
	CMap.prototype.addPair = function(key,val)
	{
		var idx;
		
		if (this.unique) {
			idx=this.mValues.findIndexOf(val);
			if (idx!=-1) return false;
		}
		return this._addPair(key,val);
	}
	CMap.prototype.findKeyOfValue=function(val) {
		var idx;
		idx=this.mValues.findIndexOf(val);
		if (idx==-1) return undefined;
		return this.keys.getAt(idx);
	}
	CMap.prototype.getValueByIndex = function(idx)
	{
		return this.mValues.getAt(idx);
	}
	CMap.prototype.getValueByKey = function(key)
	{
		var idx;
		idx=this.getIndexByKey(key);
		if (idx==-1 ) return undefined;
		return this.mValues.getAt(idx);
	}
	CMap.prototype.getIndexByKey = function(key)
	{
		return this.mKeys.findIndexOf(key);
	}

	
	CMap.prototype.removeByindex = function(idx) {
		this.mKeys.removeAt(idx);
		this.mValues.removeAt(idx);
	}
	CMap.prototype.removeByKey = function(key)
	{
		var idx=this.getIndexByKey(key);
		this.removeByIndex(idx);
	}
	CMap.prototype.getUniqueKey=function() {
		return "CMap_"+(CMap.counter++);
	}
	CMap.counter=0;
	CMap.prototype.findIndexOfValue=function(val) {
		return this.mValues.findIndexOf(val);
	}
	CMap.prototype.getLength=function() {
		return this.mValues.getLength();
	};