/* $Header: /cvs/cvs_archive/LawsonPlatform/ui/portal/objects/ValueStorage.js,v 1.1.2.1.18.1 2007/02/06 21:17:28 keno Exp $ */
/* $NoKeywords: $ */
/* LaVersion=8-)@(#)@9.0.0.5.138 2008-02-06 04:00:00 (200805) */
//-----------------------------------------------------------------------------
//	Proprietary Program Material
//	This material is proprietary to Lawson Software, and is not to be
//	reproduced or disclosed except in accordance with software contract
//	provisions, or upon written authorization from Lawson Software.
//
//	Copyright (C) 2000-2007 by Lawson Software. All Rights Reserved.
//	Saint Paul, Minnesota
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
// Name/Value Storage constructor
function ValueStorage()
{
	this.length=0;
	this.items=new Array()
	this.index=new Object()
}
ValueStorage.prototype.add=function(name,value)
{
	var i=this.items.length;
	if(typeof(value)=="undefined")
		value="";

	var item=new Object();
	item.name=name;
	item.value=value;
	this.items[i]=item;
	this.length=this.items.length;
	this.index[name]=i;

	return this.items[i];
}
ValueStorage.prototype.children=function(index)
{
	if(arguments.length==0)
		return this.items;
	return this.items[index];
}
ValueStorage.prototype.getItem=function(name)
{
	var index=this.index[name];
	if(typeof(index)=="undefined")
		return null;
	return this.items[index];
}
ValueStorage.prototype.setItem=function(name,value)
{
	if (typeof(value) == "undefined")
		value=""
	var index=this.index[name];
	if(typeof(index)=="undefined")
		return false;
	var item=this.items[index];
	if (!item) return false;
	item.value=value
	return true;
}
ValueStorage.prototype.remove=function(name)
{
	var index=this.index[name];
	if(typeof(index)=="undefined")
		return;
	this.items.splice(index,1);
	this.length=this.items.length;
}
