

$(document).ready(function() {
  $('span[@id*=rep_]').hide();
  $('p[@id=bt_visuall]').click(function() {
    var visible=false;
    $.each($('span[@id*=rep_]'),function(){
      if($(this).attr("id").split('_')[2]=="hidden")//si 1 reponse et cacher on les affiche toutes
        visible=true;
    });
    if(visible){
      $('span[@id*=rep_]').show();
      $.each($('span[@id*=rep_]'),function(){
        $(this).attr("id",$(this).attr("id").split('_')[0] +"_"+ $(this).attr("id").split('_')[1] +"_"+ "show");
      });
    }else{
      $('span[@id*=rep_]').hide();
      $.each($('span[@id*=rep_]'),function(){
        $(this).attr("id",$(this).attr("id").split('_')[0] +"_"+ $(this).attr("id").split('_')[1] +"_"+ "hidden");
      });
    }
    
  });
  
  $('p[@class*=bt_reponse]').click(function() {
    var idrep=$(this).attr("id").split('_')[1];
    if($('span[@id*=rep_' +idrep + ']').attr("id").split('_')[2]=="hidden"){
      $('span[@id*=rep_' +idrep + ']').show();
      $('span[@id*=rep_' +idrep + ']').attr("id","rep_"+ idrep +"_"+ "show");
    }else{
      $('span[@id*=rep_' +idrep + ']').hide();
      $('span[@id*=rep_' +idrep + ']').attr("id","rep_"+ idrep +"_"+ "hidden");
    
    }
  
  });
  
});




