function collection() {
	this.keys = new Array();
	this.values = new Array();
	this.add = _add;
	this.get = _get;
	this.item = _item;
	this.s = 0;
	this.size = _size;
	this.remove = _remove;
	this.getLast = _getLast;
	this.getFirst = _getFirst;
	this.getIndex = _getIndex;
	this.clear = _removeAll;
	this.addAll = _addAll;
	this.test = function() {alert(this.s);}
}

function _add(key,val) {
	if(val==null) return;
	if(this.getIndex(key)==-1) {
		this.keys[this.s] = key;
		this.values[this.s] = val;
		this.s++;
	}
}

function _addAll(coll) {
	for(var i=0;i<coll.size();i++)
		this.add(coll.keys[i],coll.values[i]);
}

function _remove(key) {
	if(key==null) return;
	var ind = this.getIndex(key);
	var size = this.size();
	if(ind<size-1) {
		for(var i=ind;i<size-1;i++) {
			this.keys[i] = this.keys[i+1];
			this.values[i] = this.values[i+1];
		}
	}
	this.keys[size] = null;
	this.values[size] = null;
	this.s--;
}

function _removeAll() {
	this.keys = new Array();
	this.values = new Array();
	this.s = 0;
}

function _get(key) {
	if(key==null) return;
	return this.values[this.getIndex(key)];
}

function _item(i) {
	if(i>=this.s) return;
	return this.values[i];
}

function _size() {
	return this.s;
}

function _getLast() {
	if(this.size()>0)
		return this.values[this.size()-1];
	return null;
}

function _getFirst() {
	if(this.size()>0)
		return this.values[0];
	return null;
}

function _getIndex(key) {
	if(key==null) return -1;
	for(var i=0;i<this.s;i++)
		if(this.keys[i]==key)
			return i;
	return -1;
}
