function Collection(){

// properties
	this._keys = Array();
	this._values = Array();
	this.length = _length;
	this.add = _add;
	this.addNotExisting = _addNotExisting
	this.exists = _exists;
	this.item = _item;
	this.remove = _remove;
	this.debug = _debug;
	this.removeNotExisting = _removeNotExisting;
	this.itemAt = _itemAt;
	this.keyAt = _keyAt;
	this._index = _index;
}
function _removeNotExisting(otherCollection){
	for (var i=(this.length()-1); i<-1;i--)
		if (!otherCollection.exists(this.keyAt(i)))
			this.remove(this.keyAt(i));
}
function _addNotExisting(otherCollection){
	for (var i=0; i<otherCollection.length();i++)
		if (!this.exists(otherCollection.keyAt(i)))
			this.add(otherCollection.keyAt(i), otherCollection.itemAt(i));
}
function _itemAt(index){
	return this._values[index];
}
function _keyAt(index){
	return this._keys[index];
}
function _length(){
	return this._keys.length;
}
function _add(key, value){
	this._keys.push(key);
	this._values.push(value);
}
function _item(key){
	var i = this._index(key);
	if (i!=-1)
		return this._values[i];
	return null;
}
function _exists(key){
	return(this._index(key)!=-1);
}
function _remove(key){
	var i = this._index(key);
	if (i!=-1){
		this._keys.splice(i, 1);
		this._values.splice(i, 1);
	}
	return null;
}
function _index(key){
	for (var i=0; i<this._keys.length;i++){
		if (this._keys[i]==key)
			return i;
	}
	return -1;
}
function _debug(){
	var str='collection.length = '+this._keys.length+'\n';
	for (var i=0; i<this._keys.length;i++)
		str += this._keys[i] + '\n';
	return str;
}
