function NumbersOnly(TestField,event,PositiveOnly,IntegerOnly) {
var key,keychar;
if (window.event)
	key = window.event.keyCode;
else if (event.which)
	key = event.which;
else
	return true;
keychar = String.fromCharCode(key);

// DASH - Inform user when negative values are not allowed.
if ((keychar=='-') && (PositiveOnly == "1")) {
	alert("Negative numbers are not a valid entry in this field");
	return false;
	}
// DASH - Check for a dash in any position other than the first.
if ((TestField.value.length > 0) && (keychar=='-')) {
	alert("Negative numbers must have the minus sign in the first position");
	return false;
	}

// DECIMALS - Inform user when decimals not allowed.
if (keychar=='.') {
	if (IntegerOnly == "1") {
		alert("Decimals are not a valid entry in this field");
		return false;
		}
	else {// Verify decimal point only exists once - Test for multiple decimal points
		for (var counter = 0; counter < TestField.value.length; counter++) {
			current_char = TestField.value.charAt(counter);
			if (current_char == ".")
				return false;
		}
		return true;
		}
	}

//Check for special characters like backspace then check for the numbers
if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27))
	return true;
else if ((("0123456789.-").indexOf(keychar) > -1))
	return true;
else {
	alert("Field accepts numerical values only");
	return false;
	}
}

