function init() {

$('th').each(function(){
	var indice = $('th').index(this);
	$(this).append("<div id='"+indice+"' class='avviso'>apri</div>");
});


$('table.accordion table').hide();


$('th div').hide();




//sul rollover appare e scompare  la frase
 $('th').hover(
      function () {
		var indice = $('th').index(this);
		$(this).find("div#"+indice).fadeIn('fast');
      }, 
      function () {
		var indice = $('th').index(this);
		$(this).find("div#"+indice).fadeOut('fast');
      }
    );

 $('th').click(function() { 
 	
 	var indice = $('th').index(this);
    var testo = $(this).find("div#"+indice).text();
    
    
    if(testo=="apri") {
    	$(this).find("div#"+indice).html("chiudi");
    } else {
    	$(this).find("div#"+indice).html("apri");
    }
    
 	
 	 var contenuto = $(this).parent().next().find('table');
 
 	  if( contenuto.is(':visible')) {
        contenuto.hide();
        return false;
        }
        //se è chiuso lo apro
      if(!contenuto.is(':visible')) {
        contenuto.show();
 		contenuto.find("table").hide();
        return false;
        }
        
 	
 });

}



