//Check for US zipcode
function isZipCode (s,FieldName)

{   
	if (s.length != 5) {
		
		alert(FieldName + " must be a 5 digit U.S. Zip Code." );
		return false;
	}
    
    return true;
}



//Check Numeric value
function isNumericValue (s,FieldName)

{   var i;

    // Search through string's characters one by one
    // until we find a non-numeric character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);

        if (!isDigit(c)) {
			alert(FieldName + " must be numeric.");
			return false;
		}
    }

    // All characters are numbers.
    return true;
}



// Returns true if character c is a digit 
// (0 .. 9).
function isDigit (c)
{   return ((c >= "0") && (c <= "9"))
}


//Required Field validation
function textRequired(thisObj, fieldName) {
	if (thisObj.value.length == "") {
		
		//alert(fieldName + " is required.");
		thisObj.value="";
		thisObj.focus();
		return false;
	}
	if (isBlank(thisObj.value)) {
		
		//alert(fieldName + " is required.");
		thisObj.value="";
		thisObj.focus();
		return false;
	}
		
	return true;
}


//Checks to See if user only entered blanks
function isBlank(strValue) 
{
	var intIndex;
	var boolBlank;
	boolBlank = true;
	if (strValue.length != 0)
	{
		for (intIndex = 0; intIndex <  strValue.length; intIndex ++)
		{
			if (strValue.charAt(intIndex) != " ")
			{
				boolBlank = false;
				break;
			}
		}
	}
	return boolBlank;
}
