function ajax(marca)
{
//Ajax
	// Create an instance of the XMLHttpRequest object
	objXHR = window.XMLHttpRequest ?
	  new XMLHttpRequest() : 
	  new ActiveXObject("MSXML2.XMLHTTP.3.0");

	if (objXHR)
	{
		// Setup the request object
		URL='XMLricerca.php?marca='+marca;
		objXHR.open('GET',URL, false);
		objXHR.send(null);
		doc=objXHR.responseXML.documentElement;
		//elem=doc.getElementsByTagName('paragrafo');
		return doc;
	}

}
function aggiungi_select(marca)
{
	var documento=ajax(marca);
	selectprinc=document.getElementById('modello');
	selectsec=documento.getElementsByTagName('modello');
	 for (j=0; j<selectsec.length; j++)
  	 {
   			selectprinc.options[j]=new Option(selectsec[j].firstChild.nodeValue, selectsec[j].firstChild.nodeValue);
  	 }
   selectprinc.options.length=j;  
}
function invio_ricerca()
{
	modello=document.getElementById('modello');
	marca=document.getElementById('marca');
	marca1=marca.options[marca.selectedIndex].text;
	modello1=modello.options[modello.selectedIndex].text;
    document.modulo.method = "get";
    document.modulo.action = '/ricerca.php?marca=' + marca1 + '&modello=' + modello1;
    document.modulo.submit();
}
