/// This adds some additional, useful methods to the JavaScript array object.

function arrayalert()
{
	// Prints out the array in an alertbox. Useful for debugging.
	var arraystring = '';
	arraystring = 'Array Values:';
	for (i = 0; i < this.length; i++)
	{
		arraystring = arraystring + "\n[" + i + "] " + this[i];
		//arraystring.concat('hello');

	}
	alert(arraystring);
	return 1;
}

function arraydel(whatval)
{
	// Deletes an item from a numerically indexed array. Requires the "pos" method be 
	// added to the array object to determine where the item is in the array.
	valpos = this.pos(whatval)
	if (valpos != undefined)
	{
		this.splice(valpos,1);
		return;
	}
}

function arraywhereis(whatval)
{
	// Determines where whatval is in the array, if at all. If it's not in the array,
	// the function returns undefined.
	for (i = 0; i < this.length; i++)
	{
		if (this[i] == whatval)
		{
			return i;
		}
	}
	return undefined;
}

function arrayadd(whatval)
{
	// Just an alias to array.push.
	this.push(whatval);
}

// Add the new methods to the array prototype.
Array.prototype.alert = arrayalert;
Array.prototype.pos = arraywhereis;
Array.prototype.del = arraydel;
Array.prototype.add = arrayadd;
