var ajax = new Array();

function getCityList(sel)
{
	var countryCode = sel.options[sel.selectedIndex].value;

	document.getElementById('idzona').options.length = 0;	// Empty city select box
	if(countryCode.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		ajax[index].requestFile = 'http://www.cercocase.roma.it/trova.php?cod='+countryCode;	// Specifying which file to get
		ajax[index].onCompletion = function(){ createCities(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}

function VendiZona(sel)
{
	var countryCode = sel.options[sel.selectedIndex].value;

	document.getElementById('vendiidzona').options.length = 0;	// Empty city select box
	if(countryCode.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		ajax[index].requestFile = 'http://www.cercocase.roma.it/trova.php?cod='+countryCode;	// Specifying which file to get
		ajax[index].onCompletion = function(){ InserisciZona(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}


function gettipoList(sel)
{
	var countryCode = sel.options[sel.selectedIndex].value;
	document.getElementById('tipologia').options.length = 0;	// Empty city select box
	if(countryCode.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		ajax[index].requestFile = 'http://www.cercocase.roma.it/trova.php?zona='+countryCode;	// Specifying which file to get
		ajax[index].onCompletion = function(){ createtipo(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}




function InserisciZona(index)
{
	var obj = document.getElementById('vendiidzona');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}

function createCities(index)
{
	var obj = document.getElementById('idzona');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}

function createtipo(index)
{
	var obj = document.getElementById('tipologia');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}

