function IntNameFromIntNode(node)
{
	var s = "";
	var n = firstChildEl(node);
	while (n)
	{
		s += (s.length?", ":"") + n.getAttribute("name");
		n = nextSiblingEl(n);
	}
	return s;
}

function SetMapFromIntNode(node, nRegion)
{
	var lat = node.getAttribute("lat");
	var lon = node.getAttribute("lon");

	DriveToLatLon(Number(lat), Number(lon), nRegion);
}

function MakeIntersectionLine(node)
{
	var nValue = node.getAttribute("id");
	var sText = IntNameFromIntNode(node);

	var opt = new Option(sText, nValue, false, false);
	opt.node = node;
	opt.fShow = function() { SetMapFromIntNode(this.node, this.parentNode.nRegion); }

	return opt;
}

function JumpXMLSelected()
{
	var sel = this.eSel;
	var pos = sel.selectedIndex;
	if (pos!=-1)
	{
		var opt = sel.options[pos];
		opt.fShow();
	}
	RemoveFormContainer(this.eContainer);
}

function MakeXMLList(xml, funcMakeLine, nRegion)
{
	var divEl, div = document.createElement("DIV");

	divEl = div.appendChild(document.createElement("DIV"));
	divEl.appendChild(document.createTextNode("Multiple matches.  Select from following list:"));

	divEl = div.appendChild(document.createElement("DIV"));
	var sel = divEl.appendChild(document.createElement("SELECT"));
	sel.nRegion = nRegion;
	sel.size = 5;

	var n = firstChildEl(xml);
	while (n)
	{
		sel.add(funcMakeLine(n));
		n = nextSiblingEl(n);
	}

	var eC = MakeDialog("Multiple Matches", div, 300);

	var button;
	button = div.appendChild(document.createElement("BUTTON"));
	button.eContainer = eC;
	button.eSel = sel;
	button.appendChild(document.createTextNode("Show Selected"));
	button.onclick = JumpXMLSelected;

	button = div.appendChild(document.createElement("BUTTON"));
	button.eContainer = eC;
	button.appendChild(document.createTextNode("Cancel"));
	button.onclick = function() { RemoveFormContainer(this.eContainer); }

}
