// XML Helper functions
var ie = false
function NodeValue(_node)
{
	if( _node && _node.firstChild )
		return _node.firstChild.nodeValue
	return ""
}
function TagNodeValue(_doc,_tag)
{
	return NodeValue(_doc.getElementsByTagName(_tag)[0])
}
function TagNodes(_doc,_tag)
{
	return _doc.getElementsByTagName(_tag)
}

function NbChildren(_nodes)
{
	var nb=0
	var i
	for(i=0; i<_nodes.childNodes.length; i++)
		if(_nodes.childNodes[i].nodeType==1)
			nb++
	return nb
}
function Child(_node,_i)
{
	var i
	var nb=0
	for(i=0; i<_node.childNodes.length; i++)
	{
		if(_node.childNodes[i].nodeType!=1)	continue
		if(nb==_i)	return _node.childNodes[i]
		nb++
	}
	return null
}

// All Browsers xml loader
function CreateXmlDoc(_callback)
{
	xmlDoc = null
	if (document.implementation && document.implementation.createDocument)
	{
		xmlDoc = document.implementation.createDocument("", "", null);
		xmlDoc.readyState = 4;
		xmlDoc.onload = _callback;
	}
	else if (window.ActiveXObject)
	{
		ie = true
		xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
		xmlDoc.onreadystatechange = _callback;
	}
	else
	{
		alert('Your browser can\'t handle this script, please get a newer version');
		return;
	}
	xmlDoc.async = false
	return xmlDoc
}
