function updateCityFinder()
{
var xmlHttp;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {
			parseCityOptions(xmlHttp.responseText);
      }
    }
	country = document.city_search.country;
	destinationid = document.city_search.destinationid;
	city_search_submit = document.getElementById("city_submit");
	city_search_reset = document.getElementById("city_reset");
	
	country.disabled="disabled";
	destinationid.disabled="disabled";
	city_search_submit.disabled="disabled";
	city_search_reset.disabled="disabled";
	city_search_submit.className="disabled";
	city_search_reset.className="disabled";
	
	url = "/library/city-finder.php";
	url += "?country="+country.value;
	url += "&destinationid="+destinationid.value.replace(" ", "+");
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
  }

function parseCityOptions(text)
	{
	try //Internet Explorer
		{
		xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
		xmlDoc.async="false";
		xmlDoc.loadXML(text);
		}
	catch(e)
		{
		try // Firefox, Mozilla, Opera, etc.
			{
			parser=new DOMParser();
			xmlDoc=parser.parseFromString(text,"text/xml");
			}
		catch(e)
			{
			alert(e.message);
			return;
			}
		}
	var x=xmlDoc.getElementsByTagName("select");
	for (i=0;i<x.length;i++)
		{
		id = x[i].getAttribute("id");
		element = document.getElementById("city_"+id+"_select");
		string = '<select name="' + id + '" id="' + id + '" onchange="updateCityFinder()">' + "\n";
		var y=x[i].getElementsByTagName("option");
		for (j=0;j<y.length;j++)
			{
			string += '<option value="'+y[j].getElementsByTagName("value")[0].childNodes[0].nodeValue+'"';
			if (y[j].getAttribute("selected") == "selected") string += ' selected="selected"';
			string += '>'+y[j].getElementsByTagName("text")[0].childNodes[0].nodeValue;
			string +='</option>'+"\n";
			}
		string += '</select>'+"\n";
		element.innerHTML = string;
		element.disabled="";
		}
	city_search_submit = document.getElementById("city_submit");
	city_search_reset = document.getElementById("city_reset");
	
	city_search_submit.disabled="";
	city_search_reset.disabled="";
	city_search_submit.className="";
	city_search_reset.className="";
	}

