add jquery function to sort elements with user defined comparison function