var url = "ajx_city.php?gtacountry="; // The server-side script
var isWorking = false;

document.getElementById("gtacountry").onchange=updateVarosok;


function handleVarosokResponse() {
  if (http.readyState == 4) {
    if (http.responseText.indexOf('invalid') == -1) {
	  document.getElementById('varosselect').innerHTML = http.responseText;
      isWorking = false;
    }
  }
}

function updateVarosok(gtacity) {

  if (!isWorking && http) {
    var gtacountryValue    = document.getElementById("gtacountry").value;
    http.open("GET", url + escape(gtacountryValue)+"&gtacity="+escape(gtacity), true);

    http.onreadystatechange = handleVarosokResponse;
    isWorking = true;
    http.send(null);
  }
}