
//===================================================
// Reload on Resize
//===================================================

//===================================================
// @@@@ AVVIO DOMREADY (pagina ancora in caricamento) @@@@
//===================================================
	
	
window.addEvent('domready', function(){

	if ($_GET['singola_news']!=undefined){
		ajax_news_singola( $_GET['singola_news'])
	}

	//-------------------------------------------------------------------
	// AJAX - Resetta le news rispettando il filtro
	//-------------------------------------------------------------------
	function ajax_news_reset(id_news){	
		
				new Ajax('ajax/news_reset.php', {
		 
				method: 'get',	
				update: $('news_contenitore'),
				data: 'nocache=' + new Date().getTime() + '&filtro_news=' + $_GET['filtro_news'],					
				onRequest: function() {															
					$('news_contenitore').setHTML('<center><br><img src="img/wait30trans.gif"></center>');	
				},					
				onComplete: function() {
					$$('.a_commenti').addEvent('click', function() {
						ajax_news_singola( this.id.replace('a_commenti_','') );								
					});
					document.location.href='#news_'+id_news;
					
				}
				}).request();		
	}	

	//-------------------------------------------------------------------
	// AJAX - Singola news con commenti
	//-------------------------------------------------------------------
	function ajax_news_singola(id_news){
				new Ajax('ajax/news_mostra_singola_e_commenti.php', {
		 
				method: 'post',	
				update: $('news_contenitore'),
				data: 'nocache=' + new Date().getTime() + '&id_news=' + id_news ,					
				onRequest: function() {															
					$('news_contenitore').setHTML('<center><br><img src="img/wait30trans.gif"></center>');	
					document.location.href='#';
				},					
				onComplete: function() {
					// ! ! Torna alle news
					$$('.a_news_reset').addEvent('click', function() {						
						ajax_news_reset(id_news);						
					});				
					document.location.href='#commenti_'+id_news;
				}
				}).request();
	}

	// ! !  Mostra i commenti di una singola news
	$$('.a_commenti').addEvent('click', function() {
		ajax_news_singola( this.id.replace('a_commenti_','') );
		
	});

	
});
//===================================================

	// Funzione allodola
	function sismpa(){
		return;
	}