$(document).ready(function(){
  $('#user_role_id').change(function(){
		$('#roles .attributes_block').hide();
    $('#'+this.value+'_block').toggle();
  });

  $('.sub_role_select').change(function(){
    $('#sub_role_' + this.value).toggle();
  });
});