function
RpcResponses(
	oXmlResposnes,
	oUtils
) {
	//alert (oXmlResposnes.xml);
	this.m_oXmlResponses = oXmlResposnes;
	this.m_oXmlUtils = new XmlUtilsIe();
	this.m_arrResponses = new Array();
	this.m_arrIdsResponses = new Array();
	this.getResponsesXml = RpcResponses_getResponsesXml;
	this.getResponsesArray = RpcResponses_getResponsesArray;
	this.addResponse = RpcResponses_addResponse;
	this.getResponse = RpcResponses_getResponse
	this.getResponseById = RpcResponses_getResponseById;
	this.init = RpcResponses_init;
	this.isExpired = 0;

	if (typeof oUtils != typeof undefined)
		this.m_oUtils = oUtils;
	else
		this.m_oUtils = new Utils();

	this.init();
}

function
RpcResponses_getResponsesArray() {
	return this.m_arrResponses;
}

function
RpcResponses_getResponsesXml() {
	return this.m_oXmlResponses;
}

function
RpcResponses_getResponse(
	strCommandName
) {
	return this.m_arrResponses[strCommandName];
}

function
RpcResponses_getResponseById(
	nRequestId
) {
	return this.m_arrIdsResponses[nRequestId];
}

function
RpcResponses_addResponse(
	oRpcResponse
) {
	this.m_arrResponses[oRpcResponse.getCommand()] = oRpcResponse;
	this.m_arrIdsResponses[oRpcResponse.getId()] = oRpcResponse;
}


function
RpcResponses_init()
{
	this.oErrorCodes = new PMP4ResultCodes();

	var nResponsesLength = this.getResponsesXml().selectNodes("//RESPONSE").length;
	var fIsExpired = false
	for (
		var i = 0;
		i < nResponsesLength && !fIsExpired;
		i++
	) {
		var oXmlResponse = this.getResponsesXml().selectNodes("//RESPONSE").item(i);
		var oRpcResponse = new RpcResponse(
			this.m_oXmlUtils.getNodeValue(
				oXmlResponse.selectSingleNode("METHODNAME"),
				"unknown",
				oXmlResponse
			),
			this.m_oXmlUtils.getNodeValue(
				oXmlResponse.selectSingleNode("ID"),
				"",
				oXmlResponse
			),
			this.m_oXmlUtils.getNodeValue(
				oXmlResponse.selectSingleNode("RESULT"),
				"0",
				oXmlResponse
			),
			this.m_oXmlUtils.getNodeValue(
				oXmlResponse.selectSingleNode("MESSAGE"),
				"unknown",
				oXmlResponse
			),
			oXmlResponse.selectSingleNode("RESULTCONTENT")
		);

		if (oRpcResponse.getResultCode() == this.oErrorCodes.ACCESS_DENIED) {
			this.m_oUtils.handleSessionExpired();
			/*
				Empty the responses arrays
			*/
			this.m_arrResponses = new Array();
			this.m_arrIdsResponses = new Array();
			fIsExpired = true;
                        this.isExpired = true;
		}
		else {
			this.addResponse(oRpcResponse);
		}
	}
}
