private String getStockImage(Element categories, String contextPath)
			throws CitysearchException {
		if (imageMap == null) {
			getImageMap();
		}
		String imageURL = null;
		if (categories != null && imageMap != null) {
			List<Element> categoryList = categories.getChildren(CATEGORY);
			int size = categoryList.size();
			Set<String> imageKeySet = imageMap.keySet();
			Random randomizer = new Random();
			for (int index = 0; index < size; index++) {
				Element category = categoryList.get(index);
				if (category != null) {
					String name = category.getAttributeValue(CATEGORY_NAME);
					if (StringUtils.isNotBlank(name)
							&& imageKeySet.contains(name)) {
						List<String> imageList = imageMap.get(name);
						int listSize = imageList.size();
						int imgIndex = randomizer.nextInt(listSize);
						StringBuilder imageUrlBuilder = new StringBuilder();
						if (!StringUtils.isBlank(contextPath)) {
							imageUrlBuilder.append(contextPath);
						}
						imageUrlBuilder.append(imageList.get(imgIndex));
						imageURL = imageUrlBuilder.toString();
						break;
					}
				}
			}
		}
		return imageURL;
	}