/*
********************************************************************************************
COPYRIGHT:@Copyright 2002 CATFISH SOFTWARE INC. All rights reserved
CREATION DATE:03/20/2003
LAST EDITED:03/20/2003
AUTHOR:Kenneth Kempf
LAST MODIFIED BY:Kenneth Kempf
EMAIL:programmer@catfishsoftware.com
PHONE:858-565-4059
NAME:PhoneVal.js
DESCRIPTION:js file used for the client side validation of phone numbers
'********************************************************************************************
*/
//Function for doing the phone number character validation
//Parameters: strNumber

function CheckPhoneNumber(strNumber)
{
	var strGoodChars = "0123456789()-+ ";
		
	for (i = 0; i <= strNumber.length -1; i++)
	{
		if (strGoodChars.indexOf(strNumber.charAt(i)) == -1)
		{
			return false;
		} // End if statement
		
	} // End for loop
	
	return true;//passes the test
}

//Function for doing phone number length validation
//Parameters:  strPhoneLength

function CheckPhoneLength(strPhoneLength)
{
	//get the length of the phone number
	var iLength = strPhoneLength.length;
	var strChars = " ()-+";
	var iCount = 0;
	
	for(i = 0; i <= iLength; i++)
	{
		//counts how many non-numeric characters from var strChars are in strPhoneLength
		if (strChars.indexOf(strPhoneLength.charAt(i)) != -1)
		{
			iCount = iCount + 1;
			
		}//end if statement
		
	}//end for loop
	
	//checks the phone number length minus the allowed non-numeric characters
	if (iLength - iCount < 9)
	{
		return false;
		
	}//end if statement
	
	return true;
	
}//end function
	