// JavaScript Document

  
  var ajax = new Array();
   
 function SelChTipologia(sel)
{
	var SelTipologia = sel.options[sel.selectedIndex].value;
	document.getElementById('QueryProvincia').options.length = 0;	// Empty city select box
	var SelNaz = document.forms[0].QueryNazione.value;
        // var selIdx = sel.options[sel.selectedIndex].value;
        // var obj = document.getElementById("Q_query");			//
        // obj.options[obj.options.length] = new Option(selIdx,'1');

	if(SelTipologia.length>0){            
		var index = ajax.length;
		ajax[index] = new sack();
		ajax[index].requestFile = 'getQueryRicerca.asp?QTipo='+SelTipologia+'&QNaz='+SelNaz+'&QInc=1';	// Specifying which file to get
		ajax[index].onCompletion = function(){ createProvincia(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}

function createProvincia(index)
{
	var obj = document.getElementById("QueryProvincia");
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code
}  
   

function SelChProvincia(sel)
{
	var SelProvincia = sel.options[sel.selectedIndex].value;
	document.getElementById('QueryComune').options.length = 0;	// Empty city select box
	var SelTipologia =document.forms[2].queryTipo.value;
        // var selIdx = sel.options[sel.selectedIndex].value;
        // var obj = document.getElementById("Q_query");			//
        // obj.options[obj.options.length] = new Option(selIdx,'1');

	if(SelProvincia.length>0){            
		var index = ajax.length;
		ajax[index] = new sack();
		ajax[index].requestFile = 'getQueryRicerca.asp?QProv='+SelProvincia+'&QTipo='+SelTipologia+'&QInc=1';	// Specifying which file to get
		ajax[index].onCompletion = function(){ createComune(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}

function createComune(index)
{
	var obj = document.getElementById("QueryComune");
	eval(unescape(ajax[index].response));// Executing the response from Ajax as Javascript code
}  

 function SelChTipologia2(sel)
{
	var SelTipologia = sel.options[sel.selectedIndex].value;
	document.getElementById('QueryPrezzo').options.length = 0;	// Empty city select box
	var SelNaz = document.forms[0].QueryNazione.value;
	        // var selIdx = sel.options[sel.selectedIndex].value;
        // var obj = document.getElementById("Q_query");			//
        // obj.options[obj.options.length] = new Option(selIdx,'1');

	if(SelTipologia.length>0){            
		var index = ajax.length;
		ajax[index] = new sack();
		ajax[index].requestFile = 'getQueryRicerca.asp?QTipo2='+SelTipologia+'&QNaz='+SelNaz+'&QInc=1';	// Specifying which file to get
		ajax[index].onCompletion = function(){ createPrezzo(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}


function SelChProvincia2(sel)
{
	var SelProvincia = sel.options[sel.selectedIndex].value;
	document.getElementById('QueryPrezzo').options.length = 0;	// Empty city select box
	var SelTipologia =document.forms[2].queryTipo.value;
        // var selIdx = sel.options[sel.selectedIndex].value;
        // var obj = document.getElementById("Q_query");			//
        // obj.options[obj.options.length] = new Option(selIdx,'1');

	if(SelProvincia.length>0){            
		var index = ajax.length;
		ajax[index] = new sack();
		ajax[index].requestFile = 'getQueryRicerca.asp?QProv2='+SelProvincia+'&QTipo2='+SelTipologia+'&QInc=1';	// Specifying which file to get
		ajax[index].onCompletion = function(){ createPrezzo(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}


function SelChComune(sel)
{
	var SelComune = sel.options[sel.selectedIndex].value;
	document.getElementById('QueryPrezzo').options.length = 0;	// Empty city select box
	var SelProvincia = document.forms[2].QueryProvincia.value;
	 var SelTipologia =document.forms[2].queryTipo.value;
        // var selIdx = sel.options[sel.selectedIndex].value;
        // var obj = document.getElementById("Q_query");			//
        // obj.options[obj.options.length] = new Option(selIdx,'1');

	if(SelComune.length>0){            
		var index = ajax.length;
		ajax[index] = new sack();
		ajax[index].requestFile = 'getQueryRicerca.asp?QCom='+SelComune+'&QProv2='+SelProvincia+'&QTipo2='+SelTipologia+'&QInc=1';	// Specifying which file to get
		ajax[index].onCompletion = function(){ createPrezzo(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}

function createPrezzo(index)
{
	var obj = document.getElementById("QueryPrezzo");
	eval(unescape(ajax[index].response));// Executing the response from Ajax as Javascript code
}  


