function getMarche(id_categoria){
	var ddl_contenitore = $("id_marca");
	ddl_contenitore.options.length=0;

	new Ajax.Request('/annunci/ajax_xml.php', 
		{
		asynchronous: true,
		method      : "get",
		parameters  : "action=elenco_marche&id_categoria=" + id_categoria,
		onLoading   : function(rq){$('SF_marche_results').hide();$('SF_marche_loader').show();},
		onComplete  : function(rq){$('SF_marche_loader').hide();$('SF_marche_results').show();},
		onFailure   : function(rq){alert('Errore ' + rq.status + ' -- ' + rq.statusText);},
		onSuccess   : function(rq){
						ddl_contenitore.options[ddl_contenitore.options.length] = new Option("--", "",  false, false);;
						// populate the dropdown list with data from the xml doc
						var XML_Results = rq.responseXML.documentElement;
						var xml_dati = XML_Results.getElementsByTagName('result');
						for (var i=0; i<xml_dati.length; i++){ddl_contenitore.options[ddl_contenitore.length] = new Option(GetInnerText(xml_dati[i]), xml_dati[i].getAttribute("ID"),  false, false);}
					}
		}
	);
}

function getModelli(id_marca, id_categoria){
	var ddl_contenitore = $("id_modello");
	ddl_contenitore.options.length=0;

	new Ajax.Request('/annunci/ajax_xml.php', 
		{
		asynchronous: true,
		method      : "get",
		parameters  : "action=elenco_modelli&id_marca=" + id_marca + "&id_categoria=" + id_categoria,
		onLoading   : function(rq){$('SF_modelli_results').hide();$('SF_modelli_loader').show();},
		onComplete  : function(rq){$('SF_modelli_loader').hide();$('SF_modelli_results').show();},
		onFailure   : function(rq){alert('Errore ' + rq.status + ' -- ' + rq.statusText);},
		onSuccess   : function(rq){
						ddl_contenitore.options[ddl_contenitore.options.length] = new Option("--", "",  false, false);;
						// populate the dropdown list with data from the xml doc
						var XML_Results = rq.responseXML.documentElement;
						var xml_dati = XML_Results.getElementsByTagName('result');
						for (var i=0; i<xml_dati.length; i++){ddl_contenitore.options[ddl_contenitore.length] = new Option(GetInnerText(xml_dati[i]), xml_dati[i].getAttribute("ID"),  false, false);}
					}
		}
	);
}

function getVCMarche(id_categoria){
	var ddl_contenitore = $("id_vc_marca");
	ddl_contenitore.options.length=0;

	new Ajax.Request('/annunci/ajax_xml.php', 
		{
		asynchronous: true,
		method      : "get",
		parameters  : "action=elenco_vc_marche&id_categoria=" + id_categoria,
		onLoading   : function(rq){$('SF_vc_marche_results').hide();$('SF_vc_marche_loader').show();},
		onComplete  : function(rq){$('SF_vc_marche_loader').hide();$('SF_vc_marche_results').show();},
		onFailure   : function(rq){alert('Errore ' + rq.status + ' -- ' + rq.statusText);},
		onSuccess   : function(rq){
						ddl_contenitore.options[ddl_contenitore.options.length] = new Option("--", "",  false, false);;
						// populate the dropdown list with data from the xml doc
						var XML_Results = rq.responseXML.documentElement;
						var xml_dati = XML_Results.getElementsByTagName('result');
						for (var i=0; i<xml_dati.length; i++){ddl_contenitore.options[ddl_contenitore.length] = new Option(GetInnerText(xml_dati[i]), xml_dati[i].getAttribute("ID"),  false, false);}
					}
		}
	);
}

function getCarrozzerie(id_categoria){
	var ddl_contenitore = $("id_carrozzeria");
	ddl_contenitore.options.length=0;
	new Ajax.Request('/annunci/ajax_xml.php', 
		{
		asynchronous: true,
		method      : "get",
		parameters  : "action=elenco_carrozzerie&id_categoria=" + id_categoria,
		onLoading   : function(rq){$('SF_carrozzerie_results').hide();$('SF_carrozzerie_loader').show();},
		onComplete  : function(rq){$('SF_carrozzerie_loader').hide();$('SF_carrozzerie_results').show();},
		onFailure   : function(rq){alert('Errore ' + rq.status + ' -- ' + rq.statusText);},
		onSuccess   : function(rq){
						ddl_contenitore.options[ddl_contenitore.options.length] = new Option("--", "",  false, false);;
						// populate the dropdown list with data from the xml doc
						var XML_Results = rq.responseXML.documentElement;
						var xml_dati = XML_Results.getElementsByTagName('result');
						for (var i=0; i<xml_dati.length; i++){ddl_contenitore.options[ddl_contenitore.length] = new Option(GetInnerText(xml_dati[i]), xml_dati[i].getAttribute("ID"),  false, false);}
					}
		}
	);

}

function getTipologie(id_categoria){
	var ddl_contenitore = $("id_tipo_veicolo");
	ddl_contenitore.options.length=0;
	new Ajax.Request('/annunci/ajax_xml.php', 
		{
		asynchronous: true,
		method      : "get",
		parameters  : "action=elenco_tipologie&id_categoria=" + id_categoria,
		onLoading   : function(rq){$('SF_tipologie_results').hide();$('SF_tipologie_loader').show();},
		onComplete  : function(rq){$('SF_tipologie_loader').hide();$('SF_tipologie_results').show();},
		onFailure   : function(rq){alert('Errore ' + rq.status + ' -- ' + rq.statusText);},
		onSuccess   : function(rq){
						ddl_contenitore.options[ddl_contenitore.options.length] = new Option("--", "",  false, false);;
						// populate the dropdown list with data from the xml doc
						var XML_Results = rq.responseXML.documentElement;
						var xml_dati = XML_Results.getElementsByTagName('result');
						for (var i=0; i<xml_dati.length; i++){ddl_contenitore.options[ddl_contenitore.length] = new Option(GetInnerText(xml_dati[i]), xml_dati[i].getAttribute("ID"),  false, false);}
					}
		}
	);

}

