var setSortPriority = function(selector) {
      var index = 0;
      $(selector).each(function(){
        $(this).val(index);
        index++;