/*
	$Header:   //nm-filestore/archives/CodeDB/archives/webroot/icnetwork/js/arrayExtensions.js-arc   1.0   Jun 14 2005 12:05:04   twoodwark  $

	Author: 	Toby Woodwark
	Date:		2005-06-06
	Name: 		ArrayExtensions.js
	Desciption: Javascript array object additions

	$Log:   //nm-filestore/archives/CodeDB/archives/webroot/icnetwork/js/arrayExtensions.js-arc  $
   Rev 1.0   Jun 14 2005 12:05:04   twoodwarkInitial revision.

*/
Array.prototype.contains = function (value) {
//return true if the array contains that value; compares objects equal using toString()
	for (var z=0,l=this.length;z<l;z++) {
		if (this[z]==value) return true;
		else if (typeof(value)=="object" && this[z].toString()==value.toString()) return true;
	}
	return false;
}

Array.prototype.removed = function (value) {
//return the array with elements equalling value removed
	var newthis=[];
	for (var z=0,l=this.length;z<l;z++) {
		if (!(this[z]==value || (typeof(value)=="object" && this[z].toString()==value.toString()))) {
			newthis[newthis.length]=this[z];
		}
	}
	return newthis;
}

Array.prototype.dupesRemoved = function () {
//return the array with duplicate elts removed
	var newthis=[];
	for (var z=0,l=this.length;z<l;z++) {
		if (!newthis.contains(this[z])) {
			newthis[newthis.length]=this[z];
		}
	}
	return newthis;
}
