//returns the value of an xml node's child node by tag name
function GetChildNodeValue(Node, TagName)
{
	var RetVal;
	try {
		RetVal = Node.getElementsByTagName(TagName)[0].childNodes[0].nodeValue;
	} catch(e) {
		RetVal = '';
	}
	return RetVal;
}

//returns the value of an xml node
function GetNodeValue(Node)
{
	var RetVal;
	try {
		RetVal = Node.childNodes[0].nodeValue;
	} catch(e) {
		RetVal = '';
	}
	return RetVal;
}

//creates a new xml node and assigns a value if supplied
function NewNode(xmlDoc, Name, Value)
{
	if(!xmlDoc) return null;
	
	var RetNode = xmlDoc.createElement(Name);
	if(Value) {
		var nValue = xmlDoc.createTextNode(Value.toString());
		RetNode.appendChild(nValue);
	}
	
	return RetNode;
}

//creates a new xml node and assigns a CDATA value if supplied
function NewCdataNode(xmlDoc, Name, Value)
{
	if(!xmlDoc) return null;
	
	var RetNode = xmlDoc.createElement(Name);
	if(Value) {
		var nValue = xmlDoc.createCDATASection(Value.toString());
		RetNode.appendChild(nValue);
	}
	
	return RetNode;
}
