function SingleDynamicArray(ArrayDef)
{
	this.myArray = new Array();
}

SingleDynamicArray.prototype.push = function (ElementVal)
{
	if (this.myArray.length==0)
	{
		this.myArray = new Array(0);
		this.myArray[0] = ElementVal;
	}
	else
	{
		this.myArray[this.myArray.length] = ElementVal;
	}
	//This is not supported in explorer 5
}

SingleDynamicArray.prototype.splice = function (Position,length)
{
	this.myArray.splice (Position,length);
}

SingleDynamicArray.prototype.GetArray = function (IndexPos)
{
	if (IndexPos == null)
	{
		return (this.myArray);	
	}
	
	else if (IndexPos < this.myArray.length)
	{
		return (this.myArray[IndexPos]);
	}
}

SingleDynamicArray.prototype.length = function()
{
	return (this.myArray.length);
}

SingleDynamicArray.prototype.ShowArray = function()
{
	return (this.myArray.toString());
}

SingleDynamicArray.prototype.ListArray = function()
{
	var ReturnString = "";
	
	for (var i=0; i < this.myArray.length; i++)
	{
		if (ReturnString.length != "")
		{
			ReturnString = ReturnString + "\n";
		}
			ReturnString = ReturnString + this.myArray[i];
	}
	return (ReturnString);
}

SingleDynamicArray.prototype.StoreArray = function(objArray)
{
	this.myArray = objArray;
}

SingleDynamicArray.prototype.SearchArray = function (ElementVal,CompareType,DataType)
{
	var size = this.myArray.length;
	FoundArray = new Array(1);
	FoundArray[0] = -1;
	
	for (var i=0; i<size; i++)
	{
		if ((DataType.toUpperCase() == "STRING") && (CompareType == 1))
		{
			if (this.myArray[i].toUpperCase() == ElementVal.toUpperCase())
			{
				if (FoundArray[0] == -1)
				{
					FoundArray[0] = i;
				}
				else
				{
					FoundArray[FoundArray.length+1] = i;
				}
			}
		}
		
		else if ((DataType.toUpperCase() == "ARRAY") && CompareType == 0)
		{
			for (var x=0; x<ElementVal.length; x++)
			{		
				if (this.myArray[i] == ElementVal[x])
				{
					if (FoundArray[0] == -1)
					{
						FoundArray[0] = i;
					}
					else
					{
						FoundArray[FoundArray.length+1] = i;
					}
				}
			}
		}
		
		else if ((DataType.toUpperCase() == "ARRAY") && CompareType == 1)
		{
			for (var x=0; x<ElementVal.length; x++)
			{				
				if (this.myArray[i].toUpperCase() == ElementVal[x].toUpperCase())
				{
					if (FoundArray[0] == -1)
					{
						FoundArray[0] = i;
					}
					else
					{
						FoundArray[FoundArray.length+1] = i;
					}
				}
			}
		}
		
		else
		{
			if (this.myArray[i] == ElementVal)
			{
				if (FoundArray[0] == -1)
				{
					FoundArray[0] = i;
				}
				else
				{
					FoundArray[FoundArray.length+1] = i;
				}
			}
		}
	}
	return (FoundArray);
}

SingleDynamicArray.prototype.DeleteElement = function (IndexPos)
{
	var size = this.myArray.length;
	
	if (IndexPos <= size)
	{
		for (var i=0; i<=size; i++)
		this.myArray[i] = ((i == IndexPos) ? "delete" : this.myArray[i]);
		for (var j=IndexPos; j<size-1; j++)
		if (j != size) this.myArray[j] = this.myArray[j+1];
		this.myArray.length = size-1;
	}
}

SingleDynamicArray.prototype.UpdateElement = function (IndexPos,value)
{
	if (IndexPos <= this.myArray.length)
	{
		this.myArray[IndexPos] = value;
	}
}

SingleDynamicArray.prototype.AddElement = function (IndexPos,ElementVal)
{
	var size = this.myArray.length;
	
	if (size == 0)
	{
		this.myArray = new Array(IndexPos);
		this.myArray[IndexPos] = ElementVal;
	}
	else
	{				
		for (var i=size; i>IndexPos; i--)
		{		
			this.myArray[i] = this.myArray[i-1];
		}
		
		this.myArray[IndexPos] = ElementVal
	}
}