

  // Function name to be called when the event occurs causing a requery
  function ShowDistricts(region_code, selected_district_code, id_append, set_nulls)
  {

	if (id_append === undefined) {
			id_append = "";
	}
	
	if (set_nulls === undefined) {
		set_nulls = true;
	}
	if (set_nulls) {
	  document.getElementById('district_code'+id_append).value = '';
	  document.getElementById('ward_code'+id_append).value = '';
	  document.getElementById('villmtaa_code'+id_append).value = '';
	}

  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)
        {
			// Reference to the division to be requeried
      		
        	document.getElementById('district_list'+id_append).innerHTML=xmlHttp.responseText;
			
        }
      }
       
	  // Reference to the file to be put in the division with its query string  
      var url="district/district_list.php";
	  url=url+"?region_code="+region_code;
	  url=url+"&selected_district_code="+selected_district_code;
	  url=url+"&id_append="+id_append;
	  url=url+"&sid="+Math.random();

      xmlHttp.open("GET",url,true);
      xmlHttp.send(null);
  }


