		public int compare(Object o1, Object o2)
		{
			int result = -1;
			if (m_criteria.equals(SORTED_BY_DEFAULT))
			{
				int s1 = ((Assignment) o1).getPosition_order();
				int s2 = ((Assignment) o2).getPosition_order();
				if ( s1 == s2 ) 
				{
					Time t1 = ((Assignment) o1).getDueTime();
					Time t2 = ((Assignment) o2).getDueTime();
					if (t1 == null)
					{
						result = -1;
					}
					else if (t2 == null)
					{
						result = 1;
					}
					else if (t1.before(t2))
					{
						result = -1;
					}
					else
					{
						result = 1;
					}
				}				
				else if ( s1 == 0 && s2 > 0 ) 
				{
					result = 1;
				}
				else if ( s2 == 0 && s1 > 0 ) 
				{
					result = -1;
				}
				else 
				{
					result = (s1 < s2) ? -1 : 1;
				}
			}
			if (m_criteria.equals(SORTED_BY_TITLE))
			{
				String s1 = ((Assignment) o1).getTitle();
				String s2 = ((Assignment) o2).getTitle();
				result = s1.compareToIgnoreCase(s2);
			}
			else if (m_criteria.equals(SORTED_BY_SECTION))
			{
				String s1 = ((Assignment) o1).getSection();
				String s2 = ((Assignment) o2).getSection();
				result = s1.compareToIgnoreCase(s2);
			}
			else if (m_criteria.equals(SORTED_BY_DUEDATE))
			{
				Time t1 = ((Assignment) o1).getDueTime();
				Time t2 = ((Assignment) o2).getDueTime();
				if (t1 == null)
				{
					result = -1;
				}
				else if (t2 == null)
				{
					result = 1;
				}
				else if (t1.before(t2))
				{
					result = -1;
				}
				else
				{
					result = 1;
				}
			}
			else if (m_criteria.equals(SORTED_BY_OPENDATE))
			{
				Time t1 = ((Assignment) o1).getOpenTime();
				Time t2 = ((Assignment) o2).getOpenTime();
				if (t1 == null)
				{
					result = -1;
				}
				else if (t2 == null)
				{
					result = 1;
				}
				if (t1.before(t2))
				{
					result = -1;
				}
				else
				{
					result = 1;
				}
			}
			else if (m_criteria.equals(SORTED_BY_ASSIGNMENT_STATUS))
			{
				String s1 = getAssignmentStatus((Assignment) o1);
				String s2 = getAssignmentStatus((Assignment) o2);
				result = s1.compareToIgnoreCase(s2);
			}
			else if (m_criteria.equals(SORTED_BY_NUM_SUBMISSIONS))
			{
				int subNum1 = 0;
				int subNum2 = 0;
				Iterator submissions1 = AssignmentService.getSubmissions((Assignment) o1);
				while (submissions1.hasNext())
				{
					AssignmentSubmission submission1 = (AssignmentSubmission) submissions1.next();
					if (submission1.getSubmitted()) subNum1++;
				}
				Iterator submissions2 = AssignmentService.getSubmissions((Assignment) o2);
				while (submissions2.hasNext())
				{
					AssignmentSubmission submission2 = (AssignmentSubmission) submissions2.next();
					if (submission2.getSubmitted()) subNum2++;
				}
				result = (subNum1 > subNum2) ? 1 : -1;
			}
			else if (m_criteria.equals(SORTED_BY_NUM_UNGRADED))
			{
				int ungraded1 = 0;
				int ungraded2 = 0;
				Iterator submissions1 = AssignmentService.getSubmissions((Assignment) o1);
				while (submissions1.hasNext())
				{
					AssignmentSubmission submission1 = (AssignmentSubmission) submissions1.next();
					if (submission1.getSubmitted() && !submission1.getGraded()) ungraded1++;
				}
				Iterator submissions2 = AssignmentService.getSubmissions((Assignment) o2);
				while (submissions2.hasNext())
				{
					AssignmentSubmission submission2 = (AssignmentSubmission) submissions2.next();
					if (submission2.getSubmitted() && !submission2.getGraded()) ungraded2++;
				}
				result = (ungraded1 > ungraded2) ? 1 : -1;
			}
			else if (m_criteria.equals(SORTED_BY_SUBMISSION_STATUS))
			{
				try
				{
					AssignmentSubmission submission1 = AssignmentService.getSubmission(((Assignment) o1).getId(), m_user);
					String status1 = getSubmissionStatus(submission1, (Assignment) o1);
					AssignmentSubmission submission2 = AssignmentService.getSubmission(((Assignment) o2).getId(), m_user);
					String status2 = getSubmissionStatus(submission2, (Assignment) o2);
					result = status1.compareTo(status2);
				}
				catch (IdUnusedException e)
				{
					return 1;
				}
				catch (PermissionException e)
				{
					return 1;
				}
			}
			else if (m_criteria.equals(SORTED_BY_GRADE))
			{
				try
				{
					AssignmentSubmission submission1 = AssignmentService.getSubmission(((Assignment) o1).getId(), m_user);
					String grade1 = " ";
					if (submission1 != null && submission1.getGraded() && submission1.getGradeReleased())
					{
						grade1 = submission1.getGrade();
					}
					AssignmentSubmission submission2 = AssignmentService.getSubmission(((Assignment) o2).getId(), m_user);
					String grade2 = " ";
					if (submission2 != null && submission2.getGraded() && submission2.getGradeReleased())
					{
						grade2 = submission2.getGrade();
					}
					result = grade1.compareTo(grade2);
				}
				catch (IdUnusedException e)
				{
					return 1;
				}
				catch (PermissionException e)
				{
					return 1;
				}
			}
			else if (m_criteria.equals(SORTED_BY_MAX_GRADE))
			{
				String maxGrade1 = maxGrade(((Assignment) o1).getContent().getTypeOfGrade(), (Assignment) o1);
				String maxGrade2 = maxGrade(((Assignment) o2).getContent().getTypeOfGrade(), (Assignment) o2);
				try
				{
					int max1 = Integer.parseInt(maxGrade1);
					int max2 = Integer.parseInt(maxGrade2);
					result = (max1 < max2) ? -1 : 1;
				}
				catch (NumberFormatException e)
				{
					result = maxGrade1.compareTo(maxGrade2);
				}
			}
			else if (m_criteria.equals(SORTED_BY_FOR))
			{
				String factor1 = getAssignmentRange((Assignment) o1);
				String factor2 = getAssignmentRange((Assignment) o2);
				result = factor1.compareToIgnoreCase(factor2);
			}
			else if (m_criteria.equals(SORTED_BY_GROUP_TITLE))
			{
				String factor1 = ((Group) o1).getTitle();
				String factor2 = ((Group) o2).getTitle();
				result = factor1.compareToIgnoreCase(factor2);
			}
			else if (m_criteria.equals(SORTED_BY_GROUP_DESCRIPTION))
			{
				String factor1 = ((Group) o1).getDescription();
				String factor2 = ((Group) o2).getDescription();
				if (factor1 == null)
				{
					factor1 = "";
				}
				if (factor2 == null)
				{
					factor2 = "";
				}
				result = factor1.compareToIgnoreCase(factor2);
			}
			else if (m_criteria.equals(SORTED_GRADE_SUBMISSION_BY_LASTNAME))
			{
				UserSubmission u1 = (UserSubmission) o1;
				UserSubmission u2 = (UserSubmission) o2;
				if (u1 == null || u2 == null || u1.getUser() == null || u2.getUser() == null )
				{
					result = 1;
				}
				else
				{
					String lName1 = u1.getUser().getLastName();
					String lName2 = u2.getUser().getLastName();
					result = lName1.toLowerCase().compareTo(lName2.toLowerCase());
				}
			}
			else if (m_criteria.equals(SORTED_GRADE_SUBMISSION_BY_SUBMIT_TIME))
			{
				UserSubmission u1 = (UserSubmission) o1;
				UserSubmission u2 = (UserSubmission) o2;
				if (u1 == null || u2 == null)
				{
					result = -1;
				}
				else
				{
					AssignmentSubmission s1 = u1.getSubmission();
					AssignmentSubmission s2 = u2.getSubmission();
					if (s1 == null || s1.getTimeSubmitted() == null)
					{
						result = -1;
					}
					else if (s2 == null || s2.getTimeSubmitted() == null)
					{
						result = 1;
					}
					else if (s1.getTimeSubmitted().before(s2.getTimeSubmitted()))
					{
						result = -1;
					}
					else
					{
						result = 1;
					}
				}
			}
			else if (m_criteria.equals(SORTED_GRADE_SUBMISSION_BY_STATUS))
			{
				UserSubmission u1 = (UserSubmission) o1;
				UserSubmission u2 = (UserSubmission) o2;
				String status1 = "";
				String status2 = "";
				if (u1 == null)
				{
					status1 = rb.getString("listsub.nosub");
				}
				else
				{
					AssignmentSubmission s1 = u1.getSubmission();
					if (s1 == null)
					{
						status1 = rb.getString("listsub.nosub");
					}
					else
					{
						status1 = getSubmissionStatus(m_state, (AssignmentSubmission) s1);
					}
				}
				if (u2 == null)
				{
					status2 = rb.getString("listsub.nosub");
				}
				else
				{
					AssignmentSubmission s2 = u2.getSubmission();
					if (s2 == null)
					{
						status2 = rb.getString("listsub.nosub");
					}
					else
					{
						status2 = getSubmissionStatus(m_state, (AssignmentSubmission) s2);
					}
				}
				result = status1.toLowerCase().compareTo(status2.toLowerCase());
			}
			else if (m_criteria.equals(SORTED_GRADE_SUBMISSION_BY_GRADE))
			{
				UserSubmission u1 = (UserSubmission) o1;
				UserSubmission u2 = (UserSubmission) o2;
				if (u1 == null || u2 == null)
				{
					result = -1;
				}
				else
				{
					AssignmentSubmission s1 = u1.getSubmission();
					AssignmentSubmission s2 = u2.getSubmission();
					if (s1 == null)
					{
						result = -1;
					}
					else if (s2 == null)
					{
						result = 1;
					}
					else
					{
						String grade1 = s1.getGrade();
						String grade2 = s2.getGrade();
						if (grade1 == null)
						{
							grade1 = "";
						}
						if (grade2 == null)
						{
							grade2 = "";
						}
						if ((s1.getAssignment().getContent().getTypeOfGrade() == 3)
								&& ((s2.getAssignment().getContent().getTypeOfGrade() == 3)))
						{
							if (grade1.equals(""))
							{
								result = -1;
							}
							else if (grade2.equals(""))
							{
								result = 1;
							}
							else
							{
								result = (new Integer(grade1)).intValue() > (new Integer(grade2)).intValue() ? 1 : -1;
							}
						}
						else
						{
							result = grade1.compareTo(grade2);
						}
					}
				}
			}
			else if (m_criteria.equals(SORTED_GRADE_SUBMISSION_BY_RELEASED))
			{
				UserSubmission u1 = (UserSubmission) o1;
				UserSubmission u2 = (UserSubmission) o2;
				if (u1 == null || u2 == null)
				{
					result = -1;
				}
				else
				{
					AssignmentSubmission s1 = u1.getSubmission();
					AssignmentSubmission s2 = u2.getSubmission();
					if (s1 == null)
					{
						result = -1;
					}
					else if (s2 == null)
					{
						result = 1;
					}
					else
					{
						String released1 = (new Boolean(s1.getGradeReleased())).toString();
						String released2 = (new Boolean(s2.getGradeReleased())).toString();
						result = released1.compareTo(released2);
					}
				}
			}
			else if (m_criteria.equals(SORTED_SUBMISSION_BY_LASTNAME))
			{
				User[] u1 = ((AssignmentSubmission) o1).getSubmitters();
				User[] u2 = ((AssignmentSubmission) o2).getSubmitters();
				if (u1 == null || u2 == null)
				{
					return 1;
				}
				else
				{
					String submitters1 = "";
					String submitters2 = "";
					for (int j = 0; j < u1.length; j++)
					{
						if (u1[j] != null && u1[j].getLastName() != null)
						{
							if (j > 0)
							{
								submitters1 = submitters1.concat("; ");
							}
							submitters1 = submitters1.concat("" + u1[j].getLastName());
						}
					}
					for (int j = 0; j < u2.length; j++)
					{
						if (u2[j] != null && u2[j].getLastName() != null)
						{
							if (j > 0)
							{
								submitters2 = submitters2.concat("; ");
							}
							submitters2 = submitters2.concat(u2[j].getLastName());
						}
					}
					result = submitters1.toLowerCase().compareTo(submitters2.toLowerCase());
				}
			}
			else if (m_criteria.equals(SORTED_SUBMISSION_BY_SUBMIT_TIME))
			{
				Time t1 = ((AssignmentSubmission) o1).getTimeSubmitted();
				Time t2 = ((AssignmentSubmission) o2).getTimeSubmitted();
				if (t1 == null)
				{
					result = -1;
				}
				else if (t2 == null)
				{
					result = 1;
				}
				else if (t1.before(t2))
				{
					result = -1;
				}
				else
				{
					result = 1;
				}
			}
			else if (m_criteria.equals(SORTED_SUBMISSION_BY_STATUS))
			{
				String status1 = getSubmissionStatus(m_state, (AssignmentSubmission) o1);
				String status2 = getSubmissionStatus(m_state, (AssignmentSubmission) o2);
				result = status1.compareTo(status2);
			}
			else if (m_criteria.equals(SORTED_SUBMISSION_BY_GRADE))
			{
				String grade1 = ((AssignmentSubmission) o1).getGrade();
				String grade2 = ((AssignmentSubmission) o2).getGrade();
				if (grade1 == null)
				{
					grade1 = "";
				}
				if (grade2 == null)
				{
					grade2 = "";
				}
				if ((((AssignmentSubmission) o1).getAssignment().getContent().getTypeOfGrade() == 3)
						&& ((((AssignmentSubmission) o2).getAssignment().getContent().getTypeOfGrade() == 3)))
				{
					if (grade1.equals(""))
					{
						result = -1;
					}
					else if (grade2.equals(""))
					{
						result = 1;
					}
					else
					{
						result = (new Integer(grade1)).intValue() > (new Integer(grade2)).intValue() ? 1 : -1;
					}
				}
				else
				{
					result = grade1.compareTo(grade2);
				}
			}
			else if (m_criteria.equals(SORTED_SUBMISSION_BY_GRADE))
			{
				String grade1 = ((AssignmentSubmission) o1).getGrade();
				String grade2 = ((AssignmentSubmission) o2).getGrade();
				if (grade1 == null)
				{
					grade1 = "";
				}
				if (grade2 == null)
				{
					grade2 = "";
				}
				if ((((AssignmentSubmission) o1).getAssignment().getContent().getTypeOfGrade() == 3)
						&& ((((AssignmentSubmission) o2).getAssignment().getContent().getTypeOfGrade() == 3)))
				{
					if (grade1.equals(""))
					{
						result = -1;
					}
					else if (grade2.equals(""))
					{
						result = 1;
					}
					else
					{
						result = (new Integer(grade1)).intValue() > (new Integer(grade2)).intValue() ? 1 : -1;
					}
				}
				else
				{
					result = grade1.compareTo(grade2);
				}
			}
			else if (m_criteria.equals(SORTED_SUBMISSION_BY_MAX_GRADE))
			{
				Assignment a1 = ((AssignmentSubmission) o1).getAssignment();
				Assignment a2 = ((AssignmentSubmission) o2).getAssignment();
				String maxGrade1 = maxGrade(a1.getContent().getTypeOfGrade(), a1);
				String maxGrade2 = maxGrade(a2.getContent().getTypeOfGrade(), a2);
				try
				{
					int max1 = Integer.parseInt(maxGrade1);
					int max2 = Integer.parseInt(maxGrade2);
					result = (max1 < max2) ? -1 : 1;
				}
				catch (NumberFormatException e)
				{
					result = maxGrade1.compareTo(maxGrade2);
				}
			}
			else if (m_criteria.equals(SORTED_SUBMISSION_BY_RELEASED))
			{
				String released1 = (new Boolean(((AssignmentSubmission) o1).getGradeReleased())).toString();
				String released2 = (new Boolean(((AssignmentSubmission) o2).getGradeReleased())).toString();
				result = released1.compareTo(released2);
			}
			else if (m_criteria.equals(SORTED_SUBMISSION_BY_ASSIGNMENT))
			{
				String title1 = ((AssignmentSubmission) o1).getAssignment().getContent().getTitle();
				String title2 = ((AssignmentSubmission) o2).getAssignment().getContent().getTitle();
				result = title1.toLowerCase().compareTo(title2.toLowerCase());
			}
			if (m_asc.equals(Boolean.FALSE.toString()))
			{
				result = -result;
			}
			return result;
		} 

		public int compare(Object o1, Object o2)
		{
			int result = -1;
			if (m_criteria.equals(SORTED_BY_DEFAULT))
			{
				int s1 = ((Assignment) o1).getPosition_order();
				int s2 = ((Assignment) o2).getPosition_order();
				if ( s1 == s2 ) 
				{
					Time t1 = ((Assignment) o1).getDueTime();
					Time t2 = ((Assignment) o2).getDueTime();
					if (t1 == null)
					{
						result = -1;
					}
					else if (t2 == null)
					{
						result = 1;
					}
					else if (t1.before(t2))
					{
						result = -1;
					}
					else
					{
						result = 1;
					}
				}				
				else if ( s1 == 0 && s2 > 0 ) 
				{
					result = 1;
				}
				else if ( s2 == 0 && s1 > 0 ) 
				{
					result = -1;
				}
				else 
				{
					result = (s1 < s2) ? -1 : 1;
				}
			}
			if (m_criteria.equals(SORTED_BY_TITLE))
			{
				String s1 = ((Assignment) o1).getTitle();
				String s2 = ((Assignment) o2).getTitle();
				result = s1.compareToIgnoreCase(s2);
			}
			else if (m_criteria.equals(SORTED_BY_SECTION))
			{
				String s1 = ((Assignment) o1).getSection();
				String s2 = ((Assignment) o2).getSection();
				result = s1.compareToIgnoreCase(s2);
			}
			else if (m_criteria.equals(SORTED_BY_DUEDATE))
			{
				Time t1 = ((Assignment) o1).getDueTime();
				Time t2 = ((Assignment) o2).getDueTime();
				if (t1 == null)
				{
					result = -1;
				}
				else if (t2 == null)
				{
					result = 1;
				}
				else if (t1.before(t2))
				{
					result = -1;
				}
				else
				{
					result = 1;
				}
			}
			else if (m_criteria.equals(SORTED_BY_OPENDATE))
			{
				Time t1 = ((Assignment) o1).getOpenTime();
				Time t2 = ((Assignment) o2).getOpenTime();
				if (t1 == null)
				{
					result = -1;
				}
				else if (t2 == null)
				{
					result = 1;
				}
				if (t1.before(t2))
				{
					result = -1;
				}
				else
				{
					result = 1;
				}
			}
			else if (m_criteria.equals(SORTED_BY_ASSIGNMENT_STATUS))
			{
				String s1 = getAssignmentStatus((Assignment) o1);
				String s2 = getAssignmentStatus((Assignment) o2);
				result = s1.compareToIgnoreCase(s2);
			}
			else if (m_criteria.equals(SORTED_BY_NUM_SUBMISSIONS))
			{
				int subNum1 = 0;
				int subNum2 = 0;
				Iterator submissions1 = AssignmentService.getSubmissions((Assignment) o1);
				while (submissions1.hasNext())
				{
					AssignmentSubmission submission1 = (AssignmentSubmission) submissions1.next();
					if (submission1.getSubmitted()) subNum1++;
				}
				Iterator submissions2 = AssignmentService.getSubmissions((Assignment) o2);
				while (submissions2.hasNext())
				{
					AssignmentSubmission submission2 = (AssignmentSubmission) submissions2.next();
					if (submission2.getSubmitted()) subNum2++;
				}
				result = (subNum1 > subNum2) ? 1 : -1;
			}
			else if (m_criteria.equals(SORTED_BY_NUM_UNGRADED))
			{
				int ungraded1 = 0;
				int ungraded2 = 0;
				Iterator submissions1 = AssignmentService.getSubmissions((Assignment) o1);
				while (submissions1.hasNext())
				{
					AssignmentSubmission submission1 = (AssignmentSubmission) submissions1.next();
					if (submission1.getSubmitted() && !submission1.getGraded()) ungraded1++;
				}
				Iterator submissions2 = AssignmentService.getSubmissions((Assignment) o2);
				while (submissions2.hasNext())
				{
					AssignmentSubmission submission2 = (AssignmentSubmission) submissions2.next();
					if (submission2.getSubmitted() && !submission2.getGraded()) ungraded2++;
				}
				result = (ungraded1 > ungraded2) ? 1 : -1;
			}
			else if (m_criteria.equals(SORTED_BY_SUBMISSION_STATUS))
			{
				try
				{
					AssignmentSubmission submission1 = AssignmentService.getSubmission(((Assignment) o1).getId(), m_user);
					String status1 = getSubmissionStatus(submission1, (Assignment) o1);
					AssignmentSubmission submission2 = AssignmentService.getSubmission(((Assignment) o2).getId(), m_user);
					String status2 = getSubmissionStatus(submission2, (Assignment) o2);
					result = status1.compareTo(status2);
				}
				catch (IdUnusedException e)
				{
					return 1;
				}
				catch (PermissionException e)
				{
					return 1;
				}
			}
			else if (m_criteria.equals(SORTED_BY_GRADE))
			{
				try
				{
					AssignmentSubmission submission1 = AssignmentService.getSubmission(((Assignment) o1).getId(), m_user);
					String grade1 = " ";
					if (submission1 != null && submission1.getGraded() && submission1.getGradeReleased())
					{
						grade1 = submission1.getGrade();
					}
					AssignmentSubmission submission2 = AssignmentService.getSubmission(((Assignment) o2).getId(), m_user);
					String grade2 = " ";
					if (submission2 != null && submission2.getGraded() && submission2.getGradeReleased())
					{
						grade2 = submission2.getGrade();
					}
					result = grade1.compareTo(grade2);
				}
				catch (IdUnusedException e)
				{
					return 1;
				}
				catch (PermissionException e)
				{
					return 1;
				}
			}
			else if (m_criteria.equals(SORTED_BY_MAX_GRADE))
			{
				String maxGrade1 = maxGrade(((Assignment) o1).getContent().getTypeOfGrade(), (Assignment) o1);
				String maxGrade2 = maxGrade(((Assignment) o2).getContent().getTypeOfGrade(), (Assignment) o2);
				try
				{
					int max1 = Integer.parseInt(maxGrade1);
					int max2 = Integer.parseInt(maxGrade2);
					result = (max1 < max2) ? -1 : 1;
				}
				catch (NumberFormatException e)
				{
					result = maxGrade1.compareTo(maxGrade2);
				}
			}
			else if (m_criteria.equals(SORTED_BY_FOR))
			{
				String factor1 = getAssignmentRange((Assignment) o1);
				String factor2 = getAssignmentRange((Assignment) o2);
				result = factor1.compareToIgnoreCase(factor2);
			}
			else if (m_criteria.equals(SORTED_BY_GROUP_TITLE))
			{
				String factor1 = ((Group) o1).getTitle();
				String factor2 = ((Group) o2).getTitle();
				result = factor1.compareToIgnoreCase(factor2);
			}
			else if (m_criteria.equals(SORTED_BY_GROUP_DESCRIPTION))
			{
				String factor1 = ((Group) o1).getDescription();
				String factor2 = ((Group) o2).getDescription();
				if (factor1 == null)
				{
					factor1 = "";
				}
				if (factor2 == null)
				{
					factor2 = "";
				}
				result = factor1.compareToIgnoreCase(factor2);
			}
			else if (m_criteria.equals(SORTED_GRADE_SUBMISSION_BY_LASTNAME))
			{
				UserSubmission u1 = (UserSubmission) o1;
				UserSubmission u2 = (UserSubmission) o2;
				if (u1 == null || u2 == null || u1.getUser() == null || u2.getUser() == null )
				{
					result = 1;
				}
				else
				{
					String lName1 = u1.getUser().getSortName();
					String lName2 = u2.getUser().getSortName();
					result = lName1.toLowerCase().compareTo(lName2.toLowerCase());
				}
			}
			else if (m_criteria.equals(SORTED_GRADE_SUBMISSION_BY_SUBMIT_TIME))
			{
				UserSubmission u1 = (UserSubmission) o1;
				UserSubmission u2 = (UserSubmission) o2;
				if (u1 == null || u2 == null)
				{
					result = -1;
				}
				else
				{
					AssignmentSubmission s1 = u1.getSubmission();
					AssignmentSubmission s2 = u2.getSubmission();
					if (s1 == null || s1.getTimeSubmitted() == null)
					{
						result = -1;
					}
					else if (s2 == null || s2.getTimeSubmitted() == null)
					{
						result = 1;
					}
					else if (s1.getTimeSubmitted().before(s2.getTimeSubmitted()))
					{
						result = -1;
					}
					else
					{
						result = 1;
					}
				}
			}
			else if (m_criteria.equals(SORTED_GRADE_SUBMISSION_BY_STATUS))
			{
				UserSubmission u1 = (UserSubmission) o1;
				UserSubmission u2 = (UserSubmission) o2;
				String status1 = "";
				String status2 = "";
				if (u1 == null)
				{
					status1 = rb.getString("listsub.nosub");
				}
				else
				{
					AssignmentSubmission s1 = u1.getSubmission();
					if (s1 == null)
					{
						status1 = rb.getString("listsub.nosub");
					}
					else
					{
						status1 = getSubmissionStatus(m_state, (AssignmentSubmission) s1);
					}
				}
				if (u2 == null)
				{
					status2 = rb.getString("listsub.nosub");
				}
				else
				{
					AssignmentSubmission s2 = u2.getSubmission();
					if (s2 == null)
					{
						status2 = rb.getString("listsub.nosub");
					}
					else
					{
						status2 = getSubmissionStatus(m_state, (AssignmentSubmission) s2);
					}
				}
				result = status1.toLowerCase().compareTo(status2.toLowerCase());
			}
			else if (m_criteria.equals(SORTED_GRADE_SUBMISSION_BY_GRADE))
			{
				UserSubmission u1 = (UserSubmission) o1;
				UserSubmission u2 = (UserSubmission) o2;
				if (u1 == null || u2 == null)
				{
					result = -1;
				}
				else
				{
					AssignmentSubmission s1 = u1.getSubmission();
					AssignmentSubmission s2 = u2.getSubmission();
					if (s1 == null)
					{
						result = -1;
					}
					else if (s2 == null)
					{
						result = 1;
					}
					else
					{
						String grade1 = s1.getGrade();
						String grade2 = s2.getGrade();
						if (grade1 == null)
						{
							grade1 = "";
						}
						if (grade2 == null)
						{
							grade2 = "";
						}
						if ((s1.getAssignment().getContent().getTypeOfGrade() == 3)
								&& ((s2.getAssignment().getContent().getTypeOfGrade() == 3)))
						{
							if (grade1.equals(""))
							{
								result = -1;
							}
							else if (grade2.equals(""))
							{
								result = 1;
							}
							else
							{
								result = (new Integer(grade1)).intValue() > (new Integer(grade2)).intValue() ? 1 : -1;
							}
						}
						else
						{
							result = grade1.compareTo(grade2);
						}
					}
				}
			}
			else if (m_criteria.equals(SORTED_GRADE_SUBMISSION_BY_RELEASED))
			{
				UserSubmission u1 = (UserSubmission) o1;
				UserSubmission u2 = (UserSubmission) o2;
				if (u1 == null || u2 == null)
				{
					result = -1;
				}
				else
				{
					AssignmentSubmission s1 = u1.getSubmission();
					AssignmentSubmission s2 = u2.getSubmission();
					if (s1 == null)
					{
						result = -1;
					}
					else if (s2 == null)
					{
						result = 1;
					}
					else
					{
						String released1 = (new Boolean(s1.getGradeReleased())).toString();
						String released2 = (new Boolean(s2.getGradeReleased())).toString();
						result = released1.compareTo(released2);
					}
				}
			}
			else if (m_criteria.equals(SORTED_SUBMISSION_BY_LASTNAME))
			{
				User[] u1 = ((AssignmentSubmission) o1).getSubmitters();
				User[] u2 = ((AssignmentSubmission) o2).getSubmitters();
				if (u1 == null || u2 == null)
				{
					return 1;
				}
				else
				{
					String submitters1 = "";
					String submitters2 = "";
					for (int j = 0; j < u1.length; j++)
					{
						if (u1[j] != null && u1[j].getLastName() != null)
						{
							if (j > 0)
							{
								submitters1 = submitters1.concat("; ");
							}
							submitters1 = submitters1.concat("" + u1[j].getLastName());
						}
					}
					for (int j = 0; j < u2.length; j++)
					{
						if (u2[j] != null && u2[j].getLastName() != null)
						{
							if (j > 0)
							{
								submitters2 = submitters2.concat("; ");
							}
							submitters2 = submitters2.concat(u2[j].getLastName());
						}
					}
					result = submitters1.toLowerCase().compareTo(submitters2.toLowerCase());
				}
			}
			else if (m_criteria.equals(SORTED_SUBMISSION_BY_SUBMIT_TIME))
			{
				Time t1 = ((AssignmentSubmission) o1).getTimeSubmitted();
				Time t2 = ((AssignmentSubmission) o2).getTimeSubmitted();
				if (t1 == null)
				{
					result = -1;
				}
				else if (t2 == null)
				{
					result = 1;
				}
				else if (t1.before(t2))
				{
					result = -1;
				}
				else
				{
					result = 1;
				}
			}
			else if (m_criteria.equals(SORTED_SUBMISSION_BY_STATUS))
			{
				String status1 = getSubmissionStatus(m_state, (AssignmentSubmission) o1);
				String status2 = getSubmissionStatus(m_state, (AssignmentSubmission) o2);
				result = status1.compareTo(status2);
			}
			else if (m_criteria.equals(SORTED_SUBMISSION_BY_GRADE))
			{
				String grade1 = ((AssignmentSubmission) o1).getGrade();
				String grade2 = ((AssignmentSubmission) o2).getGrade();
				if (grade1 == null)
				{
					grade1 = "";
				}
				if (grade2 == null)
				{
					grade2 = "";
				}
				if ((((AssignmentSubmission) o1).getAssignment().getContent().getTypeOfGrade() == 3)
						&& ((((AssignmentSubmission) o2).getAssignment().getContent().getTypeOfGrade() == 3)))
				{
					if (grade1.equals(""))
					{
						result = -1;
					}
					else if (grade2.equals(""))
					{
						result = 1;
					}
					else
					{
						result = (new Integer(grade1)).intValue() > (new Integer(grade2)).intValue() ? 1 : -1;
					}
				}
				else
				{
					result = grade1.compareTo(grade2);
				}
			}
			else if (m_criteria.equals(SORTED_SUBMISSION_BY_GRADE))
			{
				String grade1 = ((AssignmentSubmission) o1).getGrade();
				String grade2 = ((AssignmentSubmission) o2).getGrade();
				if (grade1 == null)
				{
					grade1 = "";
				}
				if (grade2 == null)
				{
					grade2 = "";
				}
				if ((((AssignmentSubmission) o1).getAssignment().getContent().getTypeOfGrade() == 3)
						&& ((((AssignmentSubmission) o2).getAssignment().getContent().getTypeOfGrade() == 3)))
				{
					if (grade1.equals(""))
					{
						result = -1;
					}
					else if (grade2.equals(""))
					{
						result = 1;
					}
					else
					{
						result = (new Integer(grade1)).intValue() > (new Integer(grade2)).intValue() ? 1 : -1;
					}
				}
				else
				{
					result = grade1.compareTo(grade2);
				}
			}
			else if (m_criteria.equals(SORTED_SUBMISSION_BY_MAX_GRADE))
			{
				Assignment a1 = ((AssignmentSubmission) o1).getAssignment();
				Assignment a2 = ((AssignmentSubmission) o2).getAssignment();
				String maxGrade1 = maxGrade(a1.getContent().getTypeOfGrade(), a1);
				String maxGrade2 = maxGrade(a2.getContent().getTypeOfGrade(), a2);
				try
				{
					int max1 = Integer.parseInt(maxGrade1);
					int max2 = Integer.parseInt(maxGrade2);
					result = (max1 < max2) ? -1 : 1;
				}
				catch (NumberFormatException e)
				{
					result = maxGrade1.compareTo(maxGrade2);
				}
			}
			else if (m_criteria.equals(SORTED_SUBMISSION_BY_RELEASED))
			{
				String released1 = (new Boolean(((AssignmentSubmission) o1).getGradeReleased())).toString();
				String released2 = (new Boolean(((AssignmentSubmission) o2).getGradeReleased())).toString();
				result = released1.compareTo(released2);
			}
			else if (m_criteria.equals(SORTED_SUBMISSION_BY_ASSIGNMENT))
			{
				String title1 = ((AssignmentSubmission) o1).getAssignment().getContent().getTitle();
				String title2 = ((AssignmentSubmission) o2).getAssignment().getContent().getTitle();
				result = title1.toLowerCase().compareTo(title2.toLowerCase());
			}
			if (m_asc.equals(Boolean.FALSE.toString()))
			{
				result = -result;
			}
			return result;
		} 
