//    Licensed Materials - Property of IBM
//
//    IBM Cognos Products: ps
//
//    (C) Copyright IBM Corp. 2005, 2011
//
//    US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
// Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
// Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).

// This javascript file accepts a name and 2 values - the first value is the string representation, the second is the XML encoded representation.
// name, stringValue, xmlencodedStringValue [, name , stringValue, xmlencodedStringValue [...]]

// This javascript file contains the following functions:
// setNameArray - loads the arrays with the appropriate information.
// getNameStringValue - returns the stringValue.
// getNameXMLValue - returns the xmlencodeStringValue.

// Declare name holding array.
var itemReturnArray = new Array();

function setItemReturnArray()
{
	var args = arguments.length;
	itm = arguments[0];
	if(itemReturnArray[itm]==null)
	{
		itemReturnArray[itm] = new Array;
	}
	for(i=1; i < args ;i++)
	{
		nm = arguments[i];
		if(itemReturnArray[itm][nm]==null)
		{
			itemReturnArray[itm][nm] = new Array(); // create the array to store the values
		}
		itemReturnArray[itm][nm][0] = arguments[++i]; // store stringValue
		itemReturnArray[itm][nm][1] = arguments[++i]; // store xmlencodedStringValue
	}
}

function getReturnStringValue(itm,nm)
{
	var err = itemReturnArray[itm]==null ? 'true' : itemReturnArray[itm][nm]==null ? 'true' : 'false';
	return err=='false' ? itemReturnArray[itm][nm][0] : ''; // return StringValue
}

function getReturnXMLValue(itm,nm)
{
	var err = itemReturnArray[itm]==null ? 'true' : itemReturnArray[itm][nm]==null ? 'true' : 'false';
	return err=='false' ? itemReturnArray[itm][nm][1] : ''; // return xmlencodedStringValue
}