function ajaxFunction(){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
		return ajaxRequest;
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
			return ajaxRequest;
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
				return ajaxRequest;
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
}

var url_getRerion = "get_region.php?param="; // The server-side script
var url_getModel  = "get_model.php?param="; // The server-side script

function handleHttpResponse() {			

  if (http.readyState == 4) {	  
  	
      response = http.responseXML;
        //var division = response.getElementsByTagName('division')[0].firstChild.data;
        var select   = response.getElementsByTagName('select')[0].firstChild.data;
        var tag_id   = response.getElementsByTagName('tag_id')[0].firstChild.data;
        //document.getElementById(tag_id+"_division").innerHTML = division;
        document.getElementById(tag_id+"_select").innerHTML   = select;
  }
}

function getRerion(country_id,select_name) {
	var theUL = document.getElementById('location2_COMBOBOX_select'); // the UL
	theUL.innerHTML = '<div class="loading"></div>';

var srt_url = url_getRerion + escape(country_id) + "&select_name=" + escape(select_name);
  http.open("GET", srt_url, true);
  http.onreadystatechange = handleHttpResponse;
  http.send(null);
}

function getModel(country_id,select_name) {
	var theUL = document.getElementById('location3_COMBOBOX_select'); // the UL
	
	// switch UL with a loading div
	theUL.innerHTML = '<div class="loading"></div>';

  var srt_url = url_getModel + escape(country_id) + "&select_name=" + escape(select_name);
  http.open("GET", srt_url, true);
  http.onreadystatechange = handleHttpResponse;
  http.send(null);
}

var http = ajaxFunction(); // We create the HTTP Object


