function removeFormat(input) {
	num = input.value;
	l = num.length;
	numeric = "";
	for (i = l - 1; i >= 0; i--) {
		ch = num.charAt(i);
		if (!(ch == ',')) {
			numeric = ch + numeric;
		}
	}
	input.value = numeric;
	if (input.setSelectionRange) {
		input.focus();
		inputEL.setSelectionRange(0, numeric.length);
	} else  if (input.createTextRange) {
		var range = input.createTextRange();
		range.moveStart('character', 0);
		range.select();
	}
}

function format(input) {
	num = input.value;
	l = num.length;

	numeric = "";
	decimal = "";
	for (i = l - 1; i >= 0; i--) {
		ch = num.charAt(i);
		if (ch == '.') {
			decimal = "." + numeric;
			numeric = "";
		}
		else {
			numeric = ch + numeric;
		}
	}
	
	num = numeric;
	numeric = "";
	for (i = l - 1; i >= 0; i--) {
		ch = num.charAt(i);
		if (!(ch == ',')) {
			numeric = ch + numeric;
		}
	}

	num = numeric;
	l = num.length;
	numeric = "";
	counter = 0;
	
	for (i = l - 1; i >= 0; i--) {
		counter++;
		numeric = num.charAt(i) + numeric;
		if ((counter == 3) && (i > 0)) {
			numeric = "," + numeric;
			counter = 0;
		}
	}
	input.value = numeric + decimal;
}