<!--

/*
numericInput

This function will:
- allow only numeric input
- optionally allow 1 decimal point
- optionally prevent negative numbers

Arguments
- event
- this
- numOnly
  "y" if numeric only
  "n" if allow 1 decimal
- negNum
  "y" allow negative numbers
  "n" no negative numbers

Example on how to call
  <input type="text" onKeyPress="return numericInput(event, this, 'y', 'y')">  - this allows only numeric and allow negative numbers
  <input type="text" onKeyPress="return numericInput(event, this, 'n', 'n')">  - this allows numeric and one decimal point and no negative numbers

*/

function numericInput(eventObj, obj, numOnly, negNum) {

	var keyCode
	var str = obj.value;

	// Check For Browser Type
	if (document.all){ 
		keyCode=eventObj.keyCode;
	} else {
		keyCode=eventObj.which;
	}

	// if numOnly NOT "y" - allow only 1 decimal point
	if (numOnly != "y") {	
		if (keyCode == 46) { 
			if (str.indexOf(".") != -1) {
				return false;
			}
		return true;
		}
	}
	
	// if negNum = "n" - do not allow negative numbers
	if (negNum == "n") {	
		// do not allow a negative sign
		if (keyCode == 45) {
			return false;
		}
	}else{
		// allow only one negative sign
		if (keyCode == 45) {
			if (str.indexOf("-") != -1) {
				return false;
			}
			return true;
		}
	}

	// allow only numerics
	// 8=Backspace, 13=Enter
	if (keyCode != 8 && keyCode != 13) {
		if (keyCode < 48 || keyCode > 57) { 
			return false;
		}
	}		


	return true;
}
//-->