//--------------------LISTA LOCALI ---------------------------------------------
function getLocali(page){	
		var regione=document.getElementById('regione').value;
		var prov=document.getElementById('provincia_dyn').value;
		var citta=document.getElementById('citta_dyn').value;
		var categoria=document.getElementById('categoria').value;
		var stringa=document.getElementById('testo').value;
		document.getElementById('locali_container').innerHTML=getLoadingImage();
		AyaxRequest('ajax_request.php', 'POST', 'filetocall=lista_locali&regione='+regione+'&provincia='+ prov+'&citta='+citta+'&categoria='+categoria+'&stringa='+stringa+'&page=' + page, setLocali_html);
	}
	function setLocali_html(){
		document.getElementById('locali_container').innerHTML=this.req.responseText;
	}
	// -------------------------

function getLoadingImage(){
		return '<div align="center" style="padding:20px"><img src="imgs/loading.gif" alt="" align="absmiddle" id="loading3" /></div>';
	}
//-----------------------DETTAGLIO LOCALE --------------------------------------
function getLocale(id){	
		document.getElementById('locali_container').innerHTML=getLoadingImage();
		AyaxRequest('ajax_request.php', 'POST', 'filetocall=locale&id='+id, setLocale_html);
	}
	function setLocale_html(){
		document.getElementById('locali_container').innerHTML=this.req.responseText;
	}
// -------------------------
//----------------------MODIFICA CONTENTUTO------------------------------------------
function getModificaContenuto(id){	
	document.getElementById('overlay').innerHTML=getLoadingImage();
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=modifica_contenuto&id='+id, setModificaContenuto_html);
}
function setModificaContenuto_html(){
	document.getElementById('overlay').innerHTML=this.req.responseText;
}
function ModificaContenuto(id){
	showOverPage();
	getModificaContenuto(id);		
}

//--------------------------------------------------------
//----------------------MODIFICA IMMAGINE------------------------------------------
function getCaricaImmagine(id,pos){	
	document.getElementById('overlay').innerHTML=getLoadingImage();
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=carica_immagine&id='+id+'&pos='+pos, setCaricaImmagine_html);
}
function setCaricaImmagine_html(){
	document.getElementById('overlay').innerHTML=this.req.responseText;
}
function CaricaImmagine(id,pos){
	showOverPage();
	getCaricaImmagine(id,pos);		
}

//--------------------------------------------------------
//----------------------MODIFICA DATI------------------------------------------
function getModificaDati(id){	
	document.getElementById('overlay').innerHTML=getLoadingImage();
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=modifica_dati&id='+id, setModificaDati_html);
}
function setModificaDati_html(){
	document.getElementById('overlay').innerHTML=this.req.responseText;
}
function ModificaDati(id){
	showOverPage();
	getModificaDati(id);		
}

//--------------------------------------------------------
//----------------------MODIFICA DATI------------------------------------------
function getIvitaAmici(id){	
	document.getElementById('overlay').innerHTML=getLoadingImage();
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=invita&id='+id, setInvitaAmici_html);
}
function setInvitaAmici_html(){
	document.getElementById('overlay').innerHTML=this.req.responseText;
}
function InvitaAmici(id){
	showOverPage();
	getIvitaAmici(id);		
}

//--------------------------------------------------------
//----------------COMUNI----------------------------
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;
	document.getElementById('cap_container_loader').innerHTML='&nbsp;';
	document.getElementById('cap').value=this.req.responseText;
}
//funzione che apre al primo login la finestra per accettare la privacy
function setPrivacy(){
	document.getElementById('overlay').innerHTML=getLoadingImage();
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=privacy', setPrivacy_html);
}
function setPrivacy_html(){
	document.getElementById('overlay').innerHTML=this.req.responseText;
}
function Privacy(){
	showOverPage();
	setPrivacy();		
}

