<!--
//
/* BSI/SWC						*/
/* validate.js (JsScript)	*/

//standard function header
/*
================================================================
Function:
Summary:
Parameters:
Return Value:
History:
================================================================
*/

/*
================================================================
Function Summary...
================================================================
================================================================
*/



/*
================================================================
Function:		checkInt
Summary:			checks numeric input at "onChange"
Parameters:
	objInt:		input type='text'
Return Value:	void
History:			initial -08.10.09 -swc
================================================================
*/
function checkInt(iInt){

	if(isNaN(iInt)){
		//alert('Invalid Input ' +iInt +'\n\nOnly Numeric Values Allowed');
		return '0';
	}
	//alert(String(Math.abs(parseInt(iInt, 10))));
	return String(Math.abs(parseInt(iInt, 10)));
} //checkInt


/*
================================================================
Function:		checkAndClearInt
Summary:			checks numeric input at "onChange" and clears/resets to zero
					if NaN true... sets input to a valid positive integer if NaN is false
Parameters:
	objInt:		input type='text'
Return Value:	void
History:			initial -06.10.09 -swc
================================================================
*/
function checkAndZeroInt(objInt){
//alert('checkAndClear...');

	//if(isNaN(parseInt(objInt.value, 10))){
	//   alert('Invalid Input ' +objInt.value +'\n\nOnly Numeric Values Allowed');
	//	objInt.value ='';
	//}
	//else{
	//	objInt.value =Math.abs(parseInt(objInt.value, 10));
	//}

	return;
} //checkAndClearInt


/*
================================================================
Function:		checkIntRange
Summary:			checks numeric input at "onChange" and clears/resets to zero
					if NaN true or value not within min/max ranges
Parameters:
	objInt:		input type='text'
	iMin:			min range
	iMax:			max range
Return Value:	void
History:			initial -06.10.09 -swc
================================================================
*/
function checkIntRange(objInt, iMin, iMax){

	//objInt.value =Math.abs(parseInt(objInt.value, 10));
	if(isNaN(parseInt(objInt.value, 10))){
		objInt.value =iMin;
	}
	else if(parseInt(objInt.value) <iMin){
		objInt.value =iMin;
	}
	else if(parseInt(objInt.value) >iMax){
		objInt.value =iMin;
	}
	//else{
		//objInt.value =Math.abs(parseInt(objInt.value, 10));
	//}

	return;
} //checIntRange


/*
================================================================
Function:		validateInt
Summary:			validates numeric input prior to form asp submission
Parameters:
	iValue:		inteter
Return Value:	boolean
History:			initial -05.18.04 -swc
================================================================
*/
function validateInt(iValue){

	if(isNaN(iValue)){
		return false;
	}
	return true;
} //validateInt


// -->
