anchor.diff:        });
         return selectedProjectNames;
       }
  +
  +    var sortProjectsByName = function(){
  +      $('.fa-sort-alpha-asc').click(function(){
  +        projectElements = unselectedProjectsElement.find('.project_wrapper');
  +        projectElements.sort(function(a, b) {
  +          var a = $( a ).data('project-name').toLowerCase() 
  +          var b = $( b ).data('project-name').toLowerCase();
  +          if(a < b){
  +            return -1;
  +          }else if(a > b){
  +            return 1;
  +          }
  +          return 0;
  +        });
  +        unselectedProjectsElement.append(projectElements);
  +      });
  +    }
  +
  +    var sortProjectsByAnnotationsCount = function(){
  +      $('.fa-sort-numeric-desc').click(function(){
  +        projectElements = unselectedProjectsElement.find('.project_wrapper');
  +        projectElements.sort(function(a, b){
  +          var a = $( a ).data('annotations-count')
  +            var b = $( b ).data('annotations-count');
  +          return b- a;
  +          if(a > b) {
  +            return -1;
  +          }
  +          if(a < b) {
  +            return 1;
  +          }
  +          return 0;
  +        });
  +        unselectedProjectsElement.append(projectElements);
  +      });
  +    }
     </script>
   <% end -%>
   
  
positive.code:       <%= t('activerecord.models.annotation') -%>
      </span>
      <span id="unselected_projects_annotations_count"></span>
      
      <div id="hidden-unselected-project-textaes" style="display:none;">
        <% # Visualized projects selector (Show up when textae hidden) -%>
  
negative.code:         annotationsCount = $(unselectedProjectElement).data('annotations-count');
          unselectedProjectsAnnotaionsCount += parseInt( annotationsCount );
        });
        $('#unselected_projects_annotations_count').text('(' + unselectedProjectsAnnotaionsCount + ')');
      }
  
  