/* General functions for handling xml */

	notWhitespace = /\S/;

function cleanWhitespace(node) 
{
	for (var x = 0; x < node.childNodes.length; x++) 
	{
		var childNode = node.childNodes[x]
		if ((childNode.nodeType == 3)&&(!notWhitespace.test(childNode.nodeValue)))
		{
			// that is, if it's a whitespace text node
			node.removeChild(node.childNodes[x])
			x--
		}
		
		if (childNode.nodeType == 1) 
		{
			// elements can have text child nodes of their own
			cleanWhitespace(childNode)
		}
	}
}


if(!document.all) {
Document.prototype.__defineGetter__("xml", function () { return (new XMLSerializer()).serializeToString(this);});
}
