<!--
/************************************************************************************
*This file contains various validation functions to test text boxs from a form for
*correct input.
************************************************************************************/

//-----------------------------------variables---------------------------------------

//array of various white space characters
var whitespace = " \t\n\r";


//-----------------------------------functions--------------------------------------

/*************************************isEmpty()**************************************
*this tests for an empty string
*pre: the string to be tested
*post: Returns true if the given string is empty.
*************************************************************************************/
function isEmpty(s)
{
        return ((s == null) || (s.length == 0));
}

/*************************************isWhitespace()**********************************
*tests for whitespace characters in the string
*pre: the string to be tested.
*post: Returns true if the given string contains no text.
**************************************************************************************/
function isWhitespace(s) {
        var i;
        
        if (isEmpty(s))
                return true;
        
        for (i = 0; i < s.length; i++)
        {
                var c = s.charAt(i);
                if (whitespace.indexOf(c) == -1) 
                        return false;   
        }
        
        return true;
}

/***************************************is Numeric()**********************************
*tests for a numeric string
*pre: the string to be tested.
*post:Returns True if the given string is a price.
*************************************************************************************/
function isNumeric(s)
{
        var i
                
        for (i = 0; i < s.length; i++)
        {
                if ( s.charAt(i) < "0" || s.charAt(i) > "9" )
                        return false;
        }
        
        return true;
}

/*************************************isNum()**********************************
*tests for whitespace characters in the string
*pre: the string to be tested.
*post: Returns true if the given string contains no currency.
**************************************************************************************/
function isNum(s) {
	var valid="0123456789.";
	var ok=1; var checktemp;
	for (var i=0; i<s.length; i++)	{
		checktemp = ""+s.substring(i, i+1);
		if (valid.indexOf(checktemp) == "-1" )
			 return 0;
	}
        
        return 1;
}

-->
	    