protected void searchByName(String mask) {
		if (mask.isEmpty()) {
			searchFromIdx = 0;
			return;
		}
		try {
			Pattern p = Pattern.compile(mask);
			ArrayList<CourseRec> all = courseModel.getFilteredCourses();
			for (int i = searchFromIdx; i < all.size(); i++) {
				CourseRec cr = all.get(i);
				if (p.matcher(cr.getName()).find()) {
					selectCourse(cr);
					searchFromIdx = i;
					return;
				}
			}
			// If not found, restart from the top. This goes recursively once.
			if (searchFromIdx > 0) {
				searchFromIdx = 0;
				searchByName(mask);
			}
		} catch (Exception e) {
		}
	}