// JavaScript Document
function get_locations(input,response,xml_data)
{
	var location_nodes;
	var this_location_node;
	var location_id = "";
	var location_description = "";
		
	// response mode
	if (response != "")
	{
		locations = xml_data.getElementsByTagName('location');
		
		document.all.location.options.length = 0;
				
		for (var counter=0;counter<locations.length;counter++)
		{
			this_location = xml_data.getElementsByTagName('location')[counter];
			
			location_id = this_location.getElementsByTagName('id')[0].firstChild.data;
			location_description = this_location.getElementsByTagName('description')[0].firstChild.data;
			
			document.all.location.options[counter] = new Option(location_description,location_id);
			
			if (location_description == "Any") document.all.location.selectedIndex = counter;	
		}	
	}
	// input mode
	else
	{
		if (input != "")
		{
			var rn = Math.round(1000000*Math.random());
			var url = "http://www.musicians4bands.com/helpers/xml get locations.php?id="+rn+"&country="+input;
			
			document.all.location.options.length = 0;
			document.all.location.options[0] = new Option("Please Wait...",0);
			
			rpc_exec(url);
		}
		else document.all.location.options.length = 0;
	}
}
