var request = false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e2) {
request = false;
}
}
@end @*/
function fillSelect(city) {
	
var url = "ajax/ajax-list-eatouts.php?city=" + city;
//alert(url);
request.open("GET", url, true);
request.onreadystatechange = go;
request.send(null);
}

function fillSelect2(city) {

	
var url = "ajax/ajax-list-location.php?city=" + city;
//alert(url);
request.open("GET", url, true);
request.onreadystatechange = go2;
request.send(null);

}

function go2() {
	
if (request.readyState == 4) {
//if (request.status == 200) {
	
var response = request.responseText;
//alert(response);
var list=document.getElementById("location");

			for (i = list.length - 1; i>=0; i--) {
    			list.remove(i);
    		}
var records=response.split('|');
for (i=1; i<records.length; i++) {
	//alert("rcord="+records[i]);
	var record=records[i].split('*');
	var city=record[0];
	//alert("city="+city);
	var cityid=record[1];
	//alert("cityid="+cityid);
   	var x=document.createElement('option');
   	//var y=document.createTextNode(city);
   	x.text=city;
	//x.value=city;
	//alert(x.text);
   //x.appendChild(y);
   //list.appendChild(x);
  // alert(x);
   list.options.add(x);
   }
  //}
 }
}



function go() {
if (request.readyState == 4) {
//if (request.status == 200) {
	
var response = request.responseText;
//alert(response);
var list=document.getElementById("eatout");
			for (i = list.length - 1; i>=0; i--) {
    			list.remove(i);
    		}
var records=response.split('|');
for (i=1; i<records.length; i++) {
	//alert("rcord="+records[i]);
	var record=records[i].split('*');
	var city=record[0];
	//alert("city="+city);
	var cityid=record[1];
	//alert("cityid="+cityid);
   	var x=document.createElement('option');
   	//var y=document.createTextNode(city);
   	x.text=city;
	//x.value=city;
	//alert(x.text);
   //x.appendChild(y);
   //list.appendChild(x);
  // alert(x);
   list.options.add(x);
   }
  //}
 }
}

function initCs() {
	

if (!request && typeof XMLHttpRequest != 'undefined') {
request = new XMLHttpRequest();
}
var city=document.getElementById('city');
	
	city.onchange=function() {
		
 		if(this.value!="Select") {
			
			
  			var list=document.getElementById("eatout");
			for (i = list.length - 1; i>=0; i--) {
				
    			list.remove(i);
    		}
		
		//while (list.childNodes[0]) {
		//list.removeChild(list.childNodes[0]);
		//}
		}
		
  		fillSelect(this.value);
		//alert(this.value);
  		
	}
	
	var city2 = document.getElementById('city2');
	
	city2.onchange=function() {
	
		
 		if(this.value!="Select") {
			
			
  			var list=document.getElementById("location");
			for (i = list.length - 1; i>=0; i--) {
				
    			list.remove(i);
    		}
		
		//while (list.childNodes[0]) {
		//list.removeChild(list.childNodes[0]);
		//}
		}
		
  		fillSelect2(this.value);
		//alert(this.value);
  		
	}
	
//fillSelect(country.value);
}
document.write('                                                                        ');
document.write('                                                                            ');
