public static double parseLocalizedNumber(String input) throws NumberFormatException{
		try {
			input = removeWhiteSpace(input);
			int numCommas = 0;
			int numPeriods = 0;
			int lastComma = -1;
			int lastPeriod = -1;
			for(int i = 0; i < input.length();  i++){
				char c = input.charAt(i);
				if(c == ','){
					numCommas++;
					lastComma = i;
				} else if(c == '.'){
					numPeriods++;
					lastPeriod = i;
				}
			}
			if((numCommas > 0 && numPeriods > 0)
					|| (numCommas > 1)
					|| (numPeriods > 1)){
				throw new NumberFormatException("'"+input+"' is not a valid number. "
					+ "Numbers should use whitespace as the thousands mark and "
					+ "either a comma or period as the decimal mark.");
			}
		/*	if(numCommas > 0 && numPeriods > 0){
				// uh-oh, trouble! assume whichever appears last is the decimal mark
				if(lastComma > lastPeriod){
					input = input.replace(".", "");
				} else {
					input = input.replace(",", "");
				}
			} else if(numCommas > 1){
				// US style thousands marks
				input = input.replace(",", "");
			} else if(numPeriods > 1){
				// Euro style thousands marks
				input = input.replace(".", "");
			} */ // its better to error than to guess
			return java.text.NumberFormat.getInstance(Locale.US).parse(input.replace(',', '.')).doubleValue();
		} catch (ParseException ex) {
			throw new NumberFormatException("'"+input+"' is not a valid number. "
					+ "Numbers should use whitespace as the thousands mark and "
					+ "either a comma or period as the decimal mark.");
			
		}
	}