// ajax per la lista dei rivenditori	
function getResellers(page){	
		var regione=document.getElementById('regione').value;
		var prov=document.getElementById('provincia_dyn').value;
		var citta=document.getElementById('citta_dyn').value;
		document.getElementById('resellers_container').innerHTML=getLoadingImage();
		AyaxRequest("ajax_request.php", "POST", "filetocall=resellers_list&regione="+regione+"&provincia="+ prov+"&citta="+citta+"&page=" + page, setResellers_html);
	}
	function setResellers_html(){
		document.getElementById('resellers_container').innerHTML=this.req.responseText;
	}
	// -------------------------

function getLoadingImage(){
		return '<div align="center" style="padding:20px"><img src="img/loading.gif" alt="" align="absmiddle" id="loading3" /></div>';
	}

function getCommenti(page){	
		document.getElementById('comment_container').innerHTML=getLoadingImage();
		AyaxRequest('ajax_request.php', 'POST', 'filetocall=bacheca&page=' + page, setBacheca_html);
	}
	function setBacheca_html(){
		document.getElementById('comment_container').innerHTML=this.req.responseText;
	}
	// -------------------------
	
function getCategoriaDetail(id){	
		document.getElementById('catalogo_container').innerHTML=getLoadingImage();
		AyaxRequest('ajax_request.php', 'POST', 'filetocall=catalogo&id_categoria='+id, setCatalogo_html);
	}
function setCatalogo_html(){
		document.getElementById('catalogo_container').innerHTML=this.req.responseText;
	}
	// -------------------------
function getProdotti(page,id){	
		document.getElementById('catalogo_prodotti_container').innerHTML=getLoadingImage();
		AyaxRequest('ajax_request.php', 'POST', 'filetocall=catalogo_prodotti&id_categoria='+id+'&page=' + page, setProdotti_html);
	}
function setProdotti_html(){
		document.getElementById('catalogo_prodotti_container').innerHTML=this.req.responseText;
	}
	// -------------------------
function getSelect(what,value){
//	document.getElementById(what+'_container_loader').innerHTML='<img src="img/loader.gif" align="absmiddle" /> ';
	if(what=='provincia'){
		AyaxRequest('ajax_request.php', 'POST', 'filetocall=query_comuni&what='+what+'&value='+value, SelectProvincia_html);
	}
	if(what=='citta'){
		AyaxRequest('ajax_request.php', 'POST', 'filetocall=query_comuni&what='+what+'&value='+value, SelectCitta_html);
	}
	if(what=='cap'){
		AyaxRequest('ajax_request.php', 'POST', 'filetocall=query_comuni&what='+what+'&value='+value, SelectCAP_html);
	}
}
function SelectProvincia_html(){
	document.getElementById('provincia_container').innerHTML=this.req.responseText;
	//document.getElementById('provincia_container_loader').innerHTML='&nbsp;';
	document.getElementById('citta_dyn').value='';
	//document.getElementById('cap').value='';
	document.getElementById('citta_dyn').disabled=true;
	//document.getElementById('cap').disabled=true;
}
function SelectCitta_html(){
	document.getElementById('citta_container').innerHTML=this.req.responseText;
	//document.getElementById('citta_container_loader').innerHTML='&nbsp;';
	//document.getElementById('cap').value='';
	//document.getElementById('cap').disabled=true;
}
function SelectCAP_html(){
	document.getElementById('cap').disabled=false;
	try{
	document.getElementById('cap_container_loader').innerHTML='&nbsp;';
	}catch(e){}
	document.getElementById('cap').value=this.req.responseText;
}
