function cambioLinea(){
	newLinea=document.getElementById('linea').value;
	URL='../Clienti/remotoRicerca.php';
	postData='flag=1&linea='+ newLinea;
	stringa=sendRequest(URL,postData);
	j=0;
	
	stringa1=stringa.split("|");
	combo=document.getElementById('tpl');
	document.getElementById('liv1').clear;
	document.getElementById('liv1').length=0;
	combo.length=stringa1.length;
	for(var k=0;k<stringa1.length;k++){
		temp=stringa1[k];
		if(temp!=""){
			temp1=temp.split("_");
			combo.options[k]=new Option(temp1[1], temp1[0]);
			j=j+1;
		}
	}		
}


function cambioTpl(){
	newLinea=document.getElementById('linea').value;
	newTpl=document.getElementById('tpl').value;
	URL='../Clienti/remotoRicerca.php';
	postData='flag=2&linea='+ newLinea + '&tpl='+ newTpl;
	stringa=sendRequest(URL,postData);
	j=0;
	stringa1=stringa.split("|");
	combo=document.getElementById('liv1');
	combo.length=stringa1.length;
	for(var k=0;k<stringa1.length;k++){
		temp=stringa1[k];
		if(temp!=""){
			temp1=temp.split("_");
			combo.options[k]=new Option(temp1[1], temp1[0]);
			j=j+1;
		}
	}		
}

function avviaRicerca(){
	newLinea=document.getElementById('linea').value;
	newTpl=document.getElementById('tpl').value;
	newLiv1=document.getElementById('liv1').value;
	model=document.getElementById('mod').value;
	
	if(model!=""){
		inde='../Clienti/elencoProdotti.php?flag=1&modelloRic='+model;
	}else{
		inde='../Clienti/elencoProdotti.php?flag=1&linea='+ newLinea + '&tpl=' + newTpl + '&liv1='+ newLiv1;
	}
	document.location=inde;
}


function cambioFlagPrezzi(){
	stato=document.getElementById('visP').checked;
	URL='../Clienti/remotoRicerca.php';
	if(stato)
		postData='flag=4&linea=checked' ;
	else
		postData='flag=4&linea=' ;
	sendRequest(URL,postData);
}
